Model-based continuous summary tables
Source:vignettes/articles/table-continuous-lm.Rmd
table-continuous-lm.Rmdtable_continuous_lm() is the model-based companion to
table_continuous(). It fits one linear model per selected
continuous outcome –
lm(outcome ~ by + covariate1 + covariate2 + ...) if
covariates are supplied, otherwise lm(outcome ~ by) – and
returns a compact reporting table. This is the right choice when you
want to stay in a linear-model workflow with
heteroskedasticity-consistent or cluster-robust standard errors,
bootstrap / jackknife variance, case weights, additive covariate
adjustment, or one of four effect-size families (f2,
Cohen’s d, Hedges’s g, Hays’s \(\omega^2\)) with noncentral CIs. Formatting
follows APA conventions by default; style = "jama" (or
"nejm", "lancet", "annals",
"aer") switches the whole table to that journal’s published
rules — the House styles section of Summary tables for
reporting shows each style and the guideline sentence behind
every rule.
Basic usage
Use select for one or more continuous outcomes and
by for the single predictor:
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi, life_sat_health),
by = sex
)
#> Continuous outcomes by sex
#>
#> M 95% CI
#> ───────────── ───────────
#> Variable │ Female Male Δ LL UL p R² n
#> ─────────────────┼─────────────────────────────────────────────────────
#> wellbeing_score │ 67.16 71.05 3.89 2.13 5.64 <.001 0.02 1200
#> bmi │ 25.69 26.20 0.51 0.09 0.93 .018 0.00 1188
#> life_sat_health │ 3.51 3.59 0.08 -0.06 0.22 .267 0.00 1192
#>
#> Note. N = 1200: Female (n = 620), Male (n = 580). Missing values removed: bmi (12), life_sat_health (8). P-values: t-test from the linear model. Δ = Male − Female. CI = confidence interval; LL = lower limit; UL = upper limit.For categorical predictors, the table reports estimated means by level. When the predictor is dichotomous, it can also show a single mean difference and confidence interval.
Robust standard errors
Use vcov = "HC*" when you want
heteroskedasticity-consistent standard errors and tests:
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = sex,
vcov = "HC3",
statistic = TRUE
)
#> Continuous outcomes by sex
#>
#> M 95% CI
#> ───────────── ──────────
#> Variable │ Female Male Δ LL UL t p R² n
#> ─────────────────┼──────────────────────────────────────────────────────────
#> wellbeing_score │ 67.16 71.05 3.89 2.12 5.65 4.32 <.001 0.02 1200
#> bmi │ 25.69 26.20 0.51 0.09 0.93 2.38 .018 0.00 1188
#>
#> Note. N = 1200: Female (n = 620), Male (n = 580). Missing values removed: bmi (12). P-values: t-test from the linear model. Std. errors: heteroskedasticity-robust (HC3). Δ = Male − Female. CI = confidence interval; LL = lower limit; UL = upper limit.The HC* family is computed via
sandwich::vcovHC() and includes "HC0",
"HC1", "HC2", "HC3" (the
sandwich::vcovHC() default, recommended for small to
moderate samples by Long and Ervin 2000), "HC4",
"HC4m", and "HC5". spicy’s own default remains
vcov = "classical".
Cluster-robust standard errors
When observations are not independent (repeated measurements per
individual, students nested in classes, panel data), classical and
HC* standard errors are typically biased downward — the
direction holds under the positive intra-cluster correlation such
designs usually induce; with negative intra-cluster correlation the bias
reverses. Use the CR* family together with
cluster = id_var to get cluster-robust inference,
dispatched to clubSandwich:
table_continuous_lm(
sleep,
select = extra,
by = group,
vcov = "CR2",
cluster = ID,
statistic = TRUE
)
#> Continuous outcomes by group
#>
#> M 95% CI
#> ────────── ──────────
#> Variable │ 1 2 Δ LL UL t(9) p R² n
#> ──────────┼────────────────────────────────────────────────────
#> extra │ 0.75 2.33 1.58 0.70 2.46 4.06 .003 0.16 20
#>
#> Note. N = 20: 1 (n = 10), 2 (n = 10). P-value: Satterthwaite t-test, cluster-robust df. Std. errors: cluster-robust (CR2), clusters by ID. Δ = 2 − 1. CI = confidence interval; LL = lower limit; UL = upper limit."CR2" is the bias-reduced estimator of Bell &
McCaffrey (2002), which with its Satterthwaite degrees of freedom keeps
tests close to their nominal level when clusters are few (Pustejovsky
& Tipton 2018, p. 25 of the accepted manuscript). It generally
produces fractional Satterthwaite degrees of freedom, rendered in the
displayed test header as e.g. t(8.7) or
F(2, 12.4); in the balanced sleep design above
(10 subjects, 2 observations each) the Satterthwaite df is exactly 9,
hence the t(9) header. "CR1" applies the G/(G
− 1) small-sample correction only. Stata’s vce(cluster id)
uses the larger G(N − 1)/((G − 1)(N − p)) factor with t(G − 1) inference
— clubSandwich’s "CR1S", which spicy does not expose — so
no CR* option here reproduces Stata’s cluster-robust
output.
Bootstrap and jackknife
For situations where the residual distribution is non-standard or the
sample is small, vcov = "bootstrap" and
vcov = "jackknife" provide resampling-based variance
estimators in pure base R (no dependency added):
set.seed(2026)
table_continuous_lm(
sochealth,
select = wellbeing_score,
by = sex,
vcov = "bootstrap",
boot_n = 1000, # default
statistic = TRUE
)
#> Continuous outcomes by sex
#>
#> M 95% CI
#> ───────────── ──────────
#> Variable │ Female Male Δ LL UL z p R² n
#> ─────────────────┼──────────────────────────────────────────────────────────
#> wellbeing_score │ 67.16 71.05 3.89 2.12 5.66 4.30 <.001 0.02 1200
#>
#> Note. N = 1200: Female (n = 620), Male (n = 580). P-value: z-test from the linear model. Std. errors: nonparametric bootstrap (1000 replicates). Δ = Male − Female. CI = confidence interval; LL = lower limit; UL = upper limit.When cluster is supplied, bootstrap switches to a
cluster bootstrap (Cameron, Gelbach & Miller 2008) and jackknife to
leave-one-cluster-out (Quenouille 1956; Tukey 1958). Both estimators use
asymptotic inference: z for single-coefficient contrasts
(the z header above, shown because
statistic = TRUE) and chi^2(q) for the global
Wald test of a categorical predictor with k > 2 levels
(q = k - 1 restrictions).
Case weights
Use weights when you want weighted estimated means or
slopes in the same model-based table:
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = education,
weights = weight,
show_weighted_n = TRUE
)
#> Continuous outcomes by education
#>
#> M
#> ──────────────────────────────────────────
#> Variable │ Lower secondary Upper secondary Tertiary p R²
#> ─────────────────┼─────────────────────────────────────────────────────────
#> wellbeing_score │ 57.71 68.39 76.55 <.001 0.19
#> bmi │ 27.85 25.79 24.23 <.001 0.13
#>
#> Variable │ n Weighted n
#> ─────────────────┼──────────────────
#> wellbeing_score │ 1200 1196.47
#> bmi │ 1188 1183.32
#>
#> Note. N = 1200 (unweighted): Lower secondary (n = 261), Upper secondary (n = 539), Tertiary (n = 400). Statistics weighted by weight. Missing values removed: bmi (12). P-values: F-test from the linear model.This is often the most natural summary-table function when your reporting workflow already relies on weighted linear models.
Numeric predictors
If by is numeric, table_continuous_lm()
reports the slope rather than group means:
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = age,
vcov = "HC3"
)
#> Continuous outcomes by age
#>
#> 95% CI
#> ───────────────
#> Variable │ B LL UL p R² n
#> ───────────────────┼──────────────────────────────────────────────────
#> wellbeing_score │ 0.04 -0.02 0.10 .176 0.00 1200
#> bmi │ 0.04 0.02 0.05 <.001 0.02 1188
#>
#> Note. N = 1200. Missing values removed: bmi (12). P-values: t-test from the linear model. Std. errors: heteroskedasticity-robust (HC3). CI = confidence interval; LL = lower limit; UL = upper limit.When you need the underlying returned data for further processing,
use output = "data.frame" for the displayed table with its
numbers, one row per outcome, or output = "long" for the
analytic long table, one row per level of by and outcome,
or one row per outcome with a numeric by like this one.
Covariate adjustment
When the comparison of by-group means is potentially
confounded by other variables, supply them through
covariates. Each per-outcome linear model becomes
lm(outcome ~ by + covariate1 + covariate2 + ...), and the
reported Δ (categorical by) or slope (numeric
by), its CI, p, R² and effect size are all
adjusted for the covariates. The default ASCII print
emits an APA-style footer naming the adjustment so the reader knows
which estimand they are reading.
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = sex,
covariates = c(age, education),
vcov = "HC3"
)
#> Continuous outcomes by sex
#>
#> M 95% CI
#> ───────────── ──────────
#> Variable │ Female Male Δ LL UL p R² n
#> ─────────────────┼────────────────────────────────────────────────────
#> wellbeing_score │ 67.27 70.93 3.65 2.08 5.23 <.001 0.22 1200
#> bmi │ 25.65 26.23 0.58 0.19 0.97 .004 0.16 1188
#>
#> Note. N = 1200: Female (n = 620), Male (n = 580). Adjusted for age, education (proportional). Missing values removed: bmi (12). P-values: t-test from the linear model. Std. errors: heteroskedasticity-robust (HC3). Δ = Male − Female. CI = confidence interval; LL = lower limit; UL = upper limit.covariates accepts the full tidyselect vocabulary
(c(age, sex),
tidyselect::starts_with("life_sat_"),
tidyselect::all_of(cov_names)) or a literal character
vector. A covariate named in select is an error (class
spicy_invalid_input), as are the by and
weights columns, and so is a covariate equal to
by.
Two estimands for the adjusted marginal means
Two methodologically distinct conventions exist for computing the
covariate-adjusted per-group means displayed in the table (the columns
under M in the printed output, M (level) in
output = "data.frame", and the emmean /
emmean_se / emmean_ci_lower /
emmean_ci_upper columns of the output = "long"
data frame) when by is categorical.
table_continuous_lm() exposes the choice via
adjustment; both are valid but produce different numerical
answers when at least one categorical covariate (factor, character, or
logical) has non-uniform observed proportions.
adjustment = "proportional"(the default) — G-computation / population-weighted standardization. For each focal level ofby, predictions are evaluated at every observation in the data withbyreplaced by that level (covariates kept at their observed values), then averaged. This is the convention of Stata’smarginsandmarginaleffects::avg_predictions(variables). Interpretation: “What is the predicted mean in this population if everyone hadby = lvl, holding their actual covariate profile?”. Best for causal / counterfactual reporting.adjustment = "balanced"— equal-weight averaging on a synthetic grid. Categorical-covariate level combinations are crossed and weighted uniformly (1 / k); numeric covariates are fixed at their sample mean. Logical covariates count as categorical here:lm()encodes a logical as a treatment-contrastTRUEdummy, so the grid crossesFALSE/TRUEwith equal weight. This is the convention ofemmeans::emmeans()(default), SPSS UNIANOVA EMMEANS, and SAS LSMEANS. Interpretation: “What is the predicted mean assuming a balanced covariate design?”. Best for descriptive / ANOVA-style APA reporting.
The two methods coincide trivially when covariates is
NULL, and also when all covariates are numeric: in a linear
model, averaging predictions over the observed values of a numeric
covariate equals predicting at its mean. They diverge whenever a
categorical covariate — including a logical — has non-uniform observed
proportions, because "proportional" weights its levels by
their empirical frequencies while "balanced" weights them
equally.
# Same model, balanced (emmeans-style) marginal means:
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = sex,
covariates = c(age, education),
adjustment = "balanced",
vcov = "HC3"
)
#> Continuous outcomes by sex
#>
#> M 95% CI
#> ───────────── ──────────
#> Variable │ Female Male Δ LL UL p R² n
#> ─────────────────┼────────────────────────────────────────────────────
#> wellbeing_score │ 65.90 69.56 3.65 2.08 5.23 <.001 0.22 1200
#> bmi │ 25.89 26.46 0.58 0.19 0.97 .004 0.16 1188
#>
#> Note. N = 1200: Female (n = 620), Male (n = 580). Adjusted for age, education (balanced). Missing values removed: bmi (12). P-values: t-test from the linear model. Std. errors: heteroskedasticity-robust (HC3). Δ = Male − Female. CI = confidence interval; LL = lower limit; UL = upper limit.Effect sizes under adjustment
Adding covariates changes which effect sizes remain meaningful:
-
effect_size = "f2"and"omega2"are reported as partial f² / partial ω² via the partial F restricted to the focal term (the Type-II test ofbyafter all covariates, equal tostats::drop1()in this additive setting) — the correct generalization of the bivariate effect size to a covariate-adjusted model. -
effect_size = "cohens_d"and"hedges_g"raisespicy_unsupported: Cohen’s d and Hedges’s g have no defined extension under adjustment (the pooled SD has no canonical analog). The error message points tof2/omega2as the partial-F generalizations.
Both effect-size variants and their noncentral CIs (when
effect_size_ci = TRUE) are computed from the same fitted
model as the displayed coefficients and remain invariant to
vcov (HC* / CR* / bootstrap / jackknife only affect the
contrast SE).
Scope: additive only in v1
covariates accepts additive terms only. Formula syntax
with interactions or transforms (covariates = ~ age * sex,
covariates = ~ I(age^2)) raises
spicy_unsupported with a migration hint. Interactions and
polynomials are reserved for a future spicy release. To fit a
fully-specified model right now, do so with lm() directly
and inspect via summary() or
table_regression() (which accepts interaction / polynomial
/ I() terms natively).
Effect sizes
table_continuous_lm() supports four effect sizes via the
effect_size argument. All are derived from the same
fitted model as the displayed coefficients and R²,
so the table stays internally consistent — and all are invariant
to vcov (the choice of classical or
HC* standard errors changes the contrast SE, CI, and test
statistic but not the standardized effect size itself).
Cohen’s d and Hedges’s g are the conventions for
two-group comparisons (Cohen 1988; Hedges and Olkin 1985; APA 2020) and
require by to have exactly two non-empty levels:
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = smoking,
effect_size = "cohens_d"
)
#> Continuous outcomes by smoking
#>
#> M 95% CI
#> ──────────── ───────────
#> Variable │ No Yes Δ LL UL p R² d n
#> ─────────────────┼───────────────────────────────────────────────────────────
#> wellbeing_score │ 69.36 67.65 -1.72 -3.91 0.47 .124 0.00 -0.11 1175
#> bmi │ 25.96 25.93 -0.03 -0.55 0.49 .905 0.00 -0.01 1163
#>
#> Note. N = 1175: No (n = 926), Yes (n = 249). Missing values removed: bmi (12), smoking (25). P-values: t-test from the linear model. Δ = Yes − No. CI = confidence interval; LL = lower limit; UL = upper limit.Hedges’s g applies the small-sample correction
J = 1 - 3/(4·df_resid - 1). It is generally preferred over
raw d in published reports (Goulet-Pelletier and Cousineau
2018):
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = smoking,
effect_size = "hedges_g"
)
#> Continuous outcomes by smoking
#>
#> M 95% CI
#> ──────────── ───────────
#> Variable │ No Yes Δ LL UL p R² g n
#> ─────────────────┼───────────────────────────────────────────────────────────
#> wellbeing_score │ 69.36 67.65 -1.72 -3.91 0.47 .124 0.00 -0.11 1175
#> bmi │ 25.96 25.93 -0.03 -0.55 0.49 .905 0.00 -0.01 1163
#>
#> Note. N = 1175: No (n = 926), Yes (n = 249). Missing values removed: bmi (12), smoking (25). P-values: t-test from the linear model. Δ = Yes − No. CI = confidence interval; LL = lower limit; UL = upper limit.For categorical predictors with three or more levels (or numeric
predictors), use Hays’s omega² for a less biased estimate
of the population variance explained (Hays 1963; Olejnik and Algina
2003; Lakens 2013):
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = education,
effect_size = "omega2"
)
#> Continuous outcomes by education
#>
#> M
#> ──────────────────────────────────────────
#> Variable │ Lower secondary Upper secondary Tertiary p R²
#> ─────────────────┼─────────────────────────────────────────────────────────
#> wellbeing_score │ 57.22 68.97 76.85 <.001 0.21
#> bmi │ 28.09 26.02 24.39 <.001 0.13
#>
#> Variable │ ω² n
#> ─────────────────┼────────────
#> wellbeing_score │ 0.21 1200
#> bmi │ 0.13 1188
#>
#> Note. N = 1200: Lower secondary (n = 261), Upper secondary (n = 539), Tertiary (n = 400). Missing values removed: bmi (12). P-values: F-test from the linear model.Cohen’s f² (= R² / (1 - R²)) is the effect
size familiar from power-analysis frameworks (e.g. G*Power) and is
defined for any predictor type:
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = age,
effect_size = "f2"
)
#> Continuous outcomes by age
#>
#> 95% CI
#> ───────────────
#> Variable │ B LL UL p R² f² n
#> ───────────────────┼──────────────────────────────────────────────────────────
#> wellbeing_score │ 0.04 -0.02 0.10 .177 0.00 0.00 1200
#> bmi │ 0.04 0.02 0.05 <.001 0.02 0.02 1188
#>
#> Note. N = 1200. Missing values removed: bmi (12). P-values: t-test from the linear model. CI = confidence interval; LL = lower limit; UL = upper limit; f² = Cohen's f².Confidence intervals for effect sizes
Setting effect_size_ci = TRUE adds a confidence interval
for the effect size. The implementation uses the modern
noncentral-distribution inversion approach — the consensus standard in
commercial statistical software (Stata esize /
estat esize, SAS PROC TTEST and
PROC GLM EFFECTSIZE) and in mainstream R packages
(effectsize, MOTE, TOSTER;
effsize offers it as an option via
noncentral = TRUE, its default being the central-t
approximation):
- Noncentral t inversion for
"cohens_d"and"hedges_g"(Steiger and Fouladi 1997; Goulet-Pelletier and Cousineau 2018). Applied to d, this interval keeps a coverage close to 95% at every effect size and sample size (Fitts 2021, p. 2412). - Noncentral F inversion for
"omega2"and"f2"(Steiger 2004; Smithson 2003).
In the printed and rendered outputs, the effect size is displayed with the bracketed CI (article-ready):
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = smoking,
effect_size = "hedges_g",
effect_size_ci = TRUE
)
#> Continuous outcomes by smoking
#>
#> M 95% CI
#> ──────────── ───────────
#> Variable │ No Yes Δ LL UL p R²
#> ─────────────────┼──────────────────────────────────────────────
#> wellbeing_score │ 69.36 67.65 -1.72 -3.91 0.47 .124 0.00
#> bmi │ 25.96 25.93 -0.03 -0.55 0.49 .905 0.00
#>
#> Variable │ g [95% CI] n
#> ─────────────────┼───────────────────────────
#> wellbeing_score │ -0.11 [-0.25, 0.03] 1175
#> bmi │ -0.01 [-0.15, 0.13] 1163
#>
#> Note. N = 1175: No (n = 926), Yes (n = 249). Missing values removed: bmi (12), smoking (25). P-values: t-test from the linear model. Δ = Yes − No. CI = confidence interval; LL = lower limit; UL = upper limit.The CI level follows ci_level (default
0.95). For programmatic access,
output = "data.frame" keeps the bounds beside the effect
size as separate numeric columns, and the long output always includes
them:
table_continuous_lm(
sochealth,
select = wellbeing_score,
by = smoking,
effect_size = "hedges_g",
effect_size_ci = TRUE,
output = "data.frame"
)
#> variable label M (No) M (Yes) Δ 95% CI LL
#> 1 wellbeing_score wellbeing_score 69.36317 67.64538 -1.717793 -3.906437
#> 95% CI UL p R² g es_ci_lower es_ci_upper n
#> 1 0.4708504 0.1238546 0.002017481 -0.1098571 -0.2497291 0.03006164 1175
out <- table_continuous_lm(
sochealth,
select = wellbeing_score,
by = smoking,
effect_size = "hedges_g",
effect_size_ci = TRUE,
output = "long"
)
out[, c("variable", "es_type", "es_value", "es_ci_lower", "es_ci_upper")]
#> variable es_type es_value es_ci_lower es_ci_upper
#> 1 wellbeing_score hedges_g -0.1098571 -0.2497291 0.03006164
#> 2 wellbeing_score <NA> NA NA NAWhen weights is supplied, all four effect sizes (and
their CIs) are computed from the weighted least-squares fit, keeping
them consistent with the weighted contrast and its CI. This is the right
convention for case-weighted reporting; for propensity-score balance
assessment (Austin and Stuart 2015) or complex-survey designs, dedicated
packages (cobalt::bal.tab() and survey) are
more appropriate.
Article-style polish
Pretty outcome labels and a comma decimal separator (useful for European reporting):
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = sex,
labels = c(
wellbeing_score = "WHO-5 wellbeing (0-100)",
bmi = "Body-mass index (kg/m²)"
),
effect_size = "hedges_g",
effect_size_ci = TRUE,
decimal_mark = ","
)
#> Continuous outcomes by sex
#>
#> M 95% CI
#> ───────────── ──────────
#> Variable │ Female Male Δ LL UL p R²
#> ─────────────────────────┼───────────────────────────────────────────────
#> WHO-5 wellbeing (0-100) │ 67,16 71,05 3,89 2,13 5,64 <0,001 0,02
#> Body-mass index (kg/m²) │ 25,69 26,20 0,51 0,09 0,93 0,018 0,00
#>
#> Variable │ g [95% CI] n
#> ─────────────────────────┼─────────────────────────
#> WHO-5 wellbeing (0-100) │ 0,25 [0,14; 0,36] 1200
#> Body-mass index (kg/m²) │ 0,14 [0,02; 0,25] 1188
#>
#> Note. N = 1200: Female (n = 620), Male (n = 580). Missing values removed: Body-mass index (kg/m²) (12). P-values: t-test from the linear model. Δ = Male − Female. CI = confidence interval; LL = lower limit; UL = upper limit.Publication-ready output
The function supports the same output formats as the other
summary-table helpers, including tinytable,
gt, flextable, excel,
word, and clipboard.
pkgdown_dark_gt(
table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi, life_sat_health),
by = sex,
vcov = "HC3",
statistic = TRUE,
output = "gt"
)
)| Continuous outcomes by sex | |||||||||
|
Variable
|
M
|
Δ
|
95% CI
|
t
|
p
|
R²
|
n
|
||
|---|---|---|---|---|---|---|---|---|---|
| Female | Male | LL | UL | ||||||
| wellbeing_score | 67.16 | 71.05 | 3.89 | 2.12 | 5.65 | 4.32 | <.001 | 0.02 | 1200 |
| bmi | 25.69 | 26.20 | 0.51 | 0.09 | 0.93 | 2.38 | .018 | 0.00 | 1188 |
| life_sat_health | 3.51 | 3.59 | 0.08 | −0.06 | 0.22 | 1.11 | .267 | 0.00 | 1192 |
| Note. N = 1200: Female (n = 620), Male (n = 580). Missing values removed: bmi (12), life_sat_health (8). P-values: t-test from the linear model. Std. errors: heteroskedasticity-robust (HC3). Δ = Male − Female. CI = confidence interval; LL = lower limit; UL = upper limit. | |||||||||
Tidying for downstream pipelines
table_continuous_lm() returns an object that can be
coerced to a plain data.frame / tbl_df (the
displayed table, as with output = "data.frame") or piped
into broom::tidy() / broom::glance() for any
downstream tidyverse-stats workflow:
out <- table_continuous_lm(
sochealth,
select = c(wellbeing_score, bmi),
by = sex,
effect_size = "hedges_g",
effect_size_ci = TRUE
)
# One row per estimated parameter: emmean per level, contrast for
# binary predictors, slope for numeric predictors.
broom::tidy(out)
#> # A tibble: 6 × 10
#> variable label term estimate_type estimate std.error conf.low conf.high
#> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 wellbeing_sco… well… Fema… emmean 67.2 0.623 65.9 68.4
#> 2 wellbeing_sco… well… Male emmean 71.0 0.644 69.8 72.3
#> 3 wellbeing_sco… well… Male… difference 3.89 0.896 2.13 5.64
#> 4 bmi bmi Fema… emmean 25.7 0.150 25.4 26.0
#> 5 bmi bmi Male emmean 26.2 0.155 25.9 26.5
#> 6 bmi bmi Male… difference 0.512 0.216 0.0888 0.935
#> # ℹ 2 more variables: statistic <dbl>, p.value <dbl>
# One row per outcome with model-level statistics: the test the table
# shows (here the t of the contrast, with its df), p.value, r.squared,
# adj.r.squared, nobs, weighted_nobs, plus the effect-size summary.
broom::glance(out)
#> # A tibble: 2 × 16
#> variable label predictor_type test_type statistic df df.residual p.value
#> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 wellbeing_… well… categorical t 4.34 1198 NA 1.55e-5
#> 2 bmi bmi categorical t 2.37 1186 NA 1.78e-2
#> # ℹ 8 more variables: r.squared <dbl>, adj.r.squared <dbl>, es_type <chr>,
#> # es_value <dbl>, es_ci_lower <dbl>, es_ci_upper <dbl>, nobs <int>,
#> # weighted_nobs <dbl>See also
- See Continuous summary tables for descriptive continuous summary tables with classical group-comparison tests.
- See Publication-ready regression
tables for the full coefficient table when the analysis moves
from a per-outcome one-predictor model to a single multi-predictor
lm/glm, including interactions, polynomials, and standardized coefficients. - See Summary tables for reporting for a cross-function reporting workflow using the summary-table helpers along the APA Table 1 / 2 / 3 sequence.
References
- American Psychological Association (2020). Publication Manual of the American Psychological Association (7th ed.).
- Austin, P. C., & Stuart, E. A. (2015). Moving towards best practice when using inverse probability of treatment weighting (IPTW) using the propensity score to estimate causal treatment effects in observational studies. Statistics in Medicine, 34(28), 3661–3679.
- Bell, R. M., & McCaffrey, D. F. (2002). Bias reduction in standard errors for linear regression with multi-stage samples. Survey Methodology, 28(2), 169–181.
- Cameron, A. C., Gelbach, J. B., & Miller, D. L. (2008). Bootstrap-based improvements for inference with clustered errors. Review of Economics and Statistics, 90(3), 414–427.
- Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences (2nd ed.). Lawrence Erlbaum.
- Fitts, D. A. (2021). Expected and empirical coverages of different methods for generating noncentral t confidence intervals for a standardized mean difference. Behavior Research Methods, 53(6), 2412–2429.
- Goulet-Pelletier, J.-C., & Cousineau, D. (2018). A review of effect sizes and their confidence intervals, Part I: The Cohen’s d family. The Quantitative Methods for Psychology, 14(4), 242–265.
- Hays, W. L. (1963). Statistics for Psychologists. Holt, Rinehart and Winston.
- Hedges, L. V., & Olkin, I. (1985). Statistical Methods for Meta-Analysis. Academic Press.
- Lakens, D. (2013). Calculating and reporting effect sizes to facilitate cumulative science: A practical primer for t-tests and ANOVAs. Frontiers in Psychology, 4, 863.
- Long, J. S., & Ervin, L. H. (2000). Using heteroscedasticity consistent standard errors in the linear regression model. The American Statistician, 54(3), 217–224.
- Olejnik, S., & Algina, J. (2003). Generalized eta and omega squared statistics: Measures of effect size for some common research designs. Psychological Methods, 8(4), 434–447.
- Pustejovsky, J. E., & Tipton, E. (2018). Small-sample methods for cluster-robust variance estimation and hypothesis testing in fixed effects models. Journal of Business & Economic Statistics, 36(4), 672–683.
- Quenouille, M. H. (1956). Notes on bias in estimation. Biometrika, 43(3/4), 353–360.
- Smithson, M. (2003). Confidence Intervals. Sage.
- Steiger, J. H. (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.
- Steiger, J. H., & Fouladi, R. T. (1997). Noncentrality interval estimation and the evaluation of statistical models. In L. L. Harlow, S. A. Mulaik, & J. H. Steiger (Eds.), What if there were no significance tests? (pp. 221–257). Lawrence Erlbaum.
- Tukey, J. W. (1958). Bias and confidence in not-quite large samples (Abstract). The Annals of Mathematical Statistics, 29(2), 614.