umx (version 1.9.1)

umxAPA: Creates nicely formatted journal style summaries of lm models, p-values, data-frames etc.

Description

umxAPA creates summaries from a range of inputs. Use it for reporting lm models, effects, and summarizing data.

1. Given an lm, will return a formatted effect, including 95% CI in square brackets, for one of the effects (specified by name in se). e.g.: umxAPA(m1, "wt") yields:

\(\beta\) = -5.344 [-6.486, -4.203], p< 0.001

2. Given a dataframe, summaryAPA will return a table of correlations, with the mean and SD of each variable as the last row. So, umxAPA(mtcars[,c("cyl", "wt", "mpg", )]) yields a table of correlations, means and SDs thus:

cyl wt mpg
cyl 1 0.78 -0.85
wt 0.78 1 -0.87
mpg -0.85 -0.87 1

3. Given obj and se, umxAPA returns a CI based on 1.96 times the se.

4. Given only a number as obj will be treated as a p-value as returned in APA format.

Usage

umxAPA(obj, se = NULL, std = FALSE, digits = 2, use = "complete",
  min = 0.001, addComparison = NA, report = c("table", "html"),
  lower = TRUE)

Arguments

obj

Either a model (lm), a beta-value, or a data.frame

se

If b is a model, then name of the parameter of interest, else the SE (standard-error)

std

If obj is an lm, whether to re-run the model on standardized data and report std betas

digits

Round numbers to how many values

use

If obj is a data.frame, how to handle NA (default = "complete")

min

= .001 for a p-value, the smallest value to report numerically

addComparison

for a p-value, whether to add "</=" default (NA) adds "<" if necessary

report

what to return (default = markdown table). Use "html" to open a web page table

lower

whether to report on the lower triangle of correlations for a data.frame (Default = TRUE)

Value

- string

References

- https://github.com/tbates/umx, https://tbates.github.io

See Also

Other Reporting Functions: loadings.MxModel, tmx_is.identified, umxFactorScores, umxGetParameters, umxReduce, umxSummary, umx_APA_pval, umx_aggregate, umx_parameters, umx_print, umx_show, umx_time, umx

Examples

Run this code
# NOT RUN {
# =============================
# = Report regression results =
# =============================
umxAPA(lm(mpg ~ wt + disp, mtcars))
umxAPA(lm(mpg ~ wt + disp, mtcars), "disp")
# ===============================================================
# = Generate summary of dataframe: Correlations + Means and SDs =
# ===============================================================
umxAPA(mtcars[,1:3])
umxAPA(mtcars[,1:3], digits = 3)
umxAPA(mtcars[,1:3], lower = FALSE)
umxAPA(mtcars[,1:3], report = "html")
# ===============================================
# = Generate a CI string based on effect and se =
# ===============================================
umxAPA(.4, .3)
# ====================
# = Format a p-value =
# ====================
umxAPA(.0182613)
umxAPA(.000182613)
# ====================
# = Format a p-value =
# ====================
data(twinData)
selDVs = c("wt1", "wt2")
mzData <- subset(twinData, zygosity %in% c("MZFF", "MZMM"))
dzData <- subset(twinData, zygosity %in% c("DZFF", "DZMM", "DZOS"))
x = cor.test(~ wt1 + wt2, data = mzData)
umxAPA(x)
# }

Run the code above in your browser using DataCamp Workspace