--- title: "Test choice tree" output: rmarkdown::pdf_document classoption: landscape header-includes: - \usepackage{tikz} - \usepackage{tikz-cd} - \usepackage{stackengine} - \tikzcdset{scale cd/.style={every label/.append style={scale=#1}, cells={nodes={scale=#1}}}, every arrow/.append style={line width=0.1}} - \parindent=0pt - \pagenumbering{gobble} pkgdown: as_is: true extension: pdf title: Test choice tree vignette: > %\VignetteIndexEntry{b_test_choice_tree} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` The graph below describes the test choice algorithm employed in the \texttt{DescrTab2} package. Some of the branching steps are dependent on the data and some can be manipulated by the user. The type of data (\texttt{numeric}, \texttt{ordered} factor and unordered \texttt{factor}) is automatically determined, as is the number of groups and the number of categories in categorical variables. The user may choose to apply nonparametric instead of parametric tests, asymptotic instead of exact and paired instead of unpaired tests. The default configuration of arguments is \texttt{test\_options=list(paired=F, nonparametric=F, exact=F)}. In a scenario with 2 groups, this will give Welch's t-test for numerical variables and a chi-squared test for categorical variables with 2 categories. Test choices can be manually overwritten via the appropriately titled parameter \texttt{test\_override}. If, for example, you want to calculate Boschloo's test only for the gender variable and use a chi-squared test (default) for everything else, you can request this by supplying the following argument: \newline \texttt{var\_options=list(gender=list(test\_options = list(test\_override="Boschloo's test")))}. \vspace{1.5cm} \hspace{-2.5cm}\begin{tikzcd}[scale cd=0.28, sep=10pt] & & & & & & & & & & \textbf{\text{Which test is chosen for the variable } \texttt{var}\text{?}} \arrow[ld, "\texttt{is.factor(var)==T}" description] \arrow[rd, "\texttt{is.numeric(var)==T}" description] & & & & & & & \\ & & & & & & & & & \textbf{\text{Categorical}} \arrow[rd, "\texttt{is.ordered(var)==T}" description] \arrow[llld, "\texttt{is.ordered(var)==F}" description] & & \textbf{\text{Numerical}} \arrow[ld, "\texttt{nonparametric==T}" description] \arrow[rrrd, "\texttt{nonparametric==F}" description] & & & & & & \\ & & & & & & \textbf{\text{Nominal}} \arrow[ld, "\texttt{exact==F}" description] \arrow[rd, "\texttt{exact==T}" description] & & & & \textbf{\text{Ordinal}} \arrow[ldd, "\texttt{paired==T}" description] \arrow[rdd, "\texttt{paired==F}" description] & & & & \textbf{\text{\stackanchor{Continuous}{and normally distributed}}} \arrow[ldd, "\texttt{paired==T}" description] \arrow[rrdd, "\texttt{paired==F}" description] & & & \\ & & & & & \textbf{\text{Asymptotic}} \arrow[d, "\texttt{paired==F}" description] \arrow[ld, "\texttt{paired==T}" description] & & \textbf{\text{Exact}} \arrow[ld, "\texttt{paired==T}" description] \arrow[d, "\texttt{paired==F}" description] & & & & & & & & & & \\ & & & & \textbf{\text{Paired}} \arrow[llld] \arrow[lllld] & \textbf{\text{Independent}} \arrow[lld] \arrow[llld] & \textbf{\text{Paired}} \arrow[lld] & \textbf{\text{Independent}} \arrow[ld] \arrow[d] \arrow[lld] & & \textbf{\text{Paired}} \arrow[ld] \arrow[d] & & \textbf{\text{Independent}} \arrow[rd] \arrow[ld] \arrow[d] & & \textbf{\text{Paired}} \arrow[rd] \arrow[d] & & & \textbf{\text{Independent}} \arrow[ld] \arrow[d] \arrow[rd] & \\ \text{2x2 table} \arrow[d] & {\text{\stackanchor{K repetitions x L Groups table,}{binary response}}} \arrow[d] & \text{1xL table} \arrow[d] & \text{KxL table} \arrow[d] & \text{2x2 table} \arrow[d] & \text{1xL table} \arrow[d] & \text{2x2 table} \arrow[d] & \text{\stackanchor{KxL table or}{large n}} \arrow[d] & \text{2 groups} \arrow[d] & \geq \text{3 groups} \arrow[d] & \text{1 group} \arrow[d] & \text{2 groups} \arrow[d] & \geq\text{ 3 groups} \arrow[d] & \text{2 groups} \arrow[d] & \geq \text{3 groups} \arrow[d] & \text{1 group} \arrow[d] & \text{2 groups} \arrow[d] & \geq \text{3 groups} \arrow[d] \\ \text{McNemar's test} & \text{Cochrane's Q test} & \text{Chi-squared goodness-of-fit test} & \text{Pearson's Chi-squared test} & \text{Exact McNemar's test} & \text{Exact binomial test} & \text{Boschloo's test} & \text{Fisher's exact test} & \text{Wilcoxon's two-sample signed-rank test} & \text{Friedman's test} & \text{Wilcoxon's one-sample signed-rank test} & \text{Mann-Whitney's U test} & \text{Kruskal-Wallis's one-way ANOVA} & \text{Student's paired t-test} & {\text{\stackanchor{Mixed model ANOVA,}{subject ID as random effect}}} & \text{Student's one-sample t-test} & \text{Welch's t-test} & \text{F-test (ANOVA)} \end{tikzcd}