apa_print.list: Typeset Statistical Results from Linear-Model Comparisons

View source: R/apa_print_list.R

apa_print.listR Documentation

Typeset Statistical Results from Linear-Model Comparisons

Description

This method performs comparisons of lm-objects and creates formatted character strings and a model comparison table to report the results in accordance with APA manuscript guidelines.

Usage

## S3 method for class 'list'
apa_print(
  x,
  anova_fun = stats::anova,
  conf.int = 0.9,
  boot_samples = 10000,
  progress_bar = interactive(),
  observed = TRUE,
  in_paren = FALSE,
  ...
)

Arguments

x

List. A list containing to-be-compared lm objects. If the list is completely named, element names are used as model names in the output object.

anova_fun

Function. Function to compare model-objects contained in x.

conf.int

Numeric. Confidence level for the bootstrap confidence interval for \Delta R^2 (range [0, 1]); ignored if boot_samples = 0.

boot_samples

Numeric. Number of bootstrap samples to estimate confidence intervals for \Delta R^2.

progress_bar

Logical. Determines whether a progress bar is printed while bootstrapping.

observed

Logical. Indicates whether predictor variables were observed. See details.

in_paren

Logical. Whether the formatted string is to be reported in parentheses. If TRUE, parentheses in the formatted string (e.g., those enclosing degrees of freedom) are replaced with brackets.

...

Additional arguments passed to the function specified as anova_fun.

Details

As demonstrated by Algina, Keselman & Penfield (2007), asymptotic confidence intervals for \Delta R^2 are often unreliable. Confidence intervals for model comparisons of lm objects are, therefore, estimated using their modified percentile bootstrap method. Note that the accuracy of the confidence intervals depends on the number of predictors p, their distribution, and the sample size n:

"When the predictor distribution is multivariate normal, one can obtain accurate CIs for \rho^2 with n \geq~50 when p = 3. For p = 6 and for p = 9, n \geq~100 is advisable. When the predictor distribution is nonnormal in form, sample size requirements vary with type of nonnormality." (p. 939, Algina, Keselman & Penfield, 2010)

If MBESS is available, confidence intervals for R^2 are computed using MBESS::ci.R2() to obtain a confidence region that corresponds to the confidence level conf.int, the default being a 90% CI (see Steiger, 2004). If observed = FALSE, it is assumed that predictors are fixed variables, i.e., "the values of the [predictors] were selected a priori as part of the research design" (p. 15, Kelly, 2007); put differently, it is assumed that predictors are not random. The confidence intervals for the regression coefficients in the model comparison table correspond to the \alpha-level chosen for R^2 and \Delta R^2 (e.g., 90% CI or \alpha = 0.10 for R^2 and \Delta R^2 yields a 95% CI for regression coefficients, Steiger, 2004).

Value

apa_print()-methods return a named list of class apa_results containing the following elements:

estimate

One or more character strings giving point estimates, confidence intervals, and confidence level. A single string is returned in a vector; multiple strings are returned as a named list. If no estimate is available the element is NULL.

statistic

One or more character strings giving the test statistic, parameters (e.g., degrees of freedom), and p-value. A single string is returned in a vector; multiple strings are returned as a named list. If no estimate is available the element is NULL.

full_result

One or more character strings comprised 'estimate' and 'statistic'. A single string is returned in a vector; multiple strings are returned as a named list.

table

A data.frame of class apa_results_table that contains all elements of estimate and statistics. This table can be passed to apa_table() for reporting.

Column names in apa_results_table are standardized following the broom glossary (e.g., term, estimate conf.int, statistic, df, df.residual, p.value). Additionally, each column is labelled (e.g., $\hat{\eta}^2_G$ or $t$) using the tinylabels package and these labels are used as column names when an apa_results_table is passed to apa_table().

References

Algina, J., Keselman, H. J., & Penfield, R. D. (2007). Confidence intervals for an effect size measure in multiple linear regression. Educational and Psychological Measurement, 67(2), 207–218. doi: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1177/0013164406292030")}

Algina, J., Keselman, H. J., & Penfield, R. D. (2010). Confidence intervals for squared semipartial correlation coefficients: The effect of nonnormality. Educational and Psychological Measurement, 70(6), 926–940. doi: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1177/0013164410379335")}

Steiger (2004). Beyond the F test: Effect size confidence intervals and tests of close fit in the analysis of variance and contrast analysis. Psychological Methods, 9(2), 164–182. doi: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/1082-989X.9.2.164")}

Kelley, K. (2007). Confidence intervals for standardized effect sizes: Theory, application, and implementation. Journal of Statistical Software, 20(8), 1–24. doi: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v020.i08")}

See Also

stats::anova()

Other apa_print: apa_print.BFBayesFactor(), apa_print.aov(), apa_print.emmGrid(), apa_print.glht(), apa_print.htest(), apa_print.lme(), apa_print.lm(), apa_print.merMod(), apa_print()

Examples

  mod1 <- lm(Sepal.Length ~ Sepal.Width, data = iris)
  mod2 <- update(mod1, formula = . ~ . + Petal.Length)
  mod3 <- update(mod2, formula = . ~ . + Petal.Width)

  # No bootstrapped Delta R^2 CI
  apa_print(list(Baseline = mod1, Length = mod2, Both = mod3), boot_samples = 0)

crsh/papaja documentation built on Feb. 21, 2024, 6:11 p.m.