Skip to contents

Creates manuscript-oriented outputs from a fitted mlmr model. These helpers return APA-style tables, level-by-level equations, combined equations, and LaTeX equation displays.

Usage

mlm_apa_tables(result, format = c("list", "html", "latex"))

mlm_equations(result)

mlm_latex_equations(result)

Arguments

result

A fitted result returned by mlm_fit.

format

Output format for APA tables: "list", "html", or "latex". The list format returns individual data frames; HTML and LaTeX formats return complete manuscript-oriented table documents.

Value

mlm_apa_tables() returns a named list of tables, an HTML document, or a LaTeX document. mlm_equations() returns plain-text equation descriptions. mlm_latex_equations() returns raw LaTeX equation components.

Details

The fixed-effects table includes estimates, standard errors, large-sample test statistics, p values, and Wald 95 percent confidence intervals. For Gaussian mixed models fit with lme4, p values are large-sample normal approximations and should be interpreted cautiously.

mlm_latex_equations() returns level-by-level equations, a combined full equation, and Tau variance-covariance matrix displays. These outputs are meant to support manuscript preparation and teaching; users should review notation and substantive labels before publication.

Examples

# \donttest{
if (requireNamespace("lme4", quietly = TRUE)) {
  dat <- example_hsb(n_schools = 4, min_students = 5, max_students = 6)
  spec <- mlm_spec(
    outcome = "mathscore",
    fixed = list(ses = list(center = "CWC")),
    grouping = list(schoolid = "schoolid"),
    random = list(schoolid = list(intercept = TRUE, slopes = character(),
      correlation = TRUE)),
    data = dat
  )
  result <- mlm_fit(spec)
  mlm_apa_tables(result)
  mlm_latex_equations(result)
}
#> $level
#> [1] "Level 1" "Level 2"
#> 
#> $equations
#> [1] "mathscore_{ij} = \\beta_{0j} + \\beta_{1j}\\mathrm{ses\\_CWC}_{ij} + r_{ij}"
#> [2] "\\beta_{0j} = \\gamma_{00} + u_{0j}\\\\ \\beta_{1j} = \\gamma_{10}"         
#> 
#> $combined
#> [1] "mathscore_{ij} = \\gamma_{00} + \\gamma_{10}\\mathrm{ses\\_CWC}_{ij} + u_{0j} + r_{ij}"
#> 
#> $tau
#> [1] "\\begin{bmatrix}u_{0j}\\\\ u_{1j}\\end{bmatrix}_{schoolid} \\sim MVN\\left(\\begin{bmatrix}0\\\\ 0\\end{bmatrix},\\begin{bmatrix}\\tau_{00} & \\cdot\\\\ 0 & 0\\end{bmatrix}\\right)\\quad \\text{schoolid: Intercept, ses\\_CWC}"
#> 
# }