The apastat function summarizes statistic test results scientific publication. This currently will take stats::t.test, stats::cor.test, or stats::lm results as input. The output is intended to be included as in-text parenthetical statistics in publication.

apastat(test, roundN = 2, es = c(TRUE, FALSE), ci = c(TRUE, FALSE), var = NULL)

Arguments

test

The stats::t.test, stats::cor.test, or stats::lm object to be formatted.

roundN

The number of decimal places to round all output to (default=2).

es

Include effect side (Cohen's d for t-test or 2-level factor lm variable), default to TRUE.

ci

Include confidence interval of estimate, default to TRUE.

var

Only for lm object, select name of variable to summarize (default=NULL), if NULL, will summarize overall model fit.

Value

Output formatted statistics

Examples

apastat(stats::cor.test(psydat$Age, psydat$Height))
#> r=.41, t(4991)=32.06, 95% CI=[.39,.44], p<.001
apastat(stats::t.test(Height ~ Sex, data = psydat))
#> t(4855.74)=0.83, p=.41, d=0.02
apastat(stats::lm(data = psydat, Height ~ Age + Sex))
#> N=4991, F(2,4988)=517.49, R2=.17, adj. R2=.17, p<.001
apastat(stats::lm(data = psydat, Height ~ Age + Sex), var = "Age")
#> N=4991, b=0.18, t(4988)=32.16, p<.001