Create a nice table from one or more regression models
nice_regression_table(
...,
round = 2,
labels_models = NULL,
rename_labels = list(),
rename_cols = list(),
remove_cols = NULL,
auto_col_names = TRUE,
file = NULL,
or = FALSE,
nice_p = TRUE,
title = "Regression model",
footnote = NULL
)
Arguments
- remove_cols
Either column number or column names to be removed
- or
If TRUE, the estimators are assumed to be logits and are
exponentiated to yield odds ratios
Examples
lm(mpg ~ am + disp + hp, data = mtcars) |>
nice_regression_table()
Table Regression model |
Predictor |
mpg
|
---|
Estimate |
SE |
t |
p |
---|
|
---|
(Intercept) |
27.87 |
1.62 |
17.2 |
<.001*** |
am |
3.8 |
1.42 |
2.67 |
.013* |
disp |
-0.01 |
0.01 |
-1.55 |
.133 |
hp |
-0.04 |
0.01 |
-3.03 |
.005** |
Model |
---|
R² |
0.8 |
|
|
|
R² adjusted |
0.78 |
|
|
|
Observations |
32 |
|
|
|
nice_regression_table(
nlme::lme(mpg~disp, data = mtcars, random = ~1|am),
nlme::lme(mpg~disp + hp, data = mtcars, random = ~1|am)
)
Table Regression model |
Predictor |
mpg
|
mpg 1
|
---|
Estimate |
SE |
DF |
t |
p-value |
Estimate |
SE |
DF |
t |
p-value |
---|
|
---|
(Intercept) |
29.28 |
1.4 |
29 |
20.85 |
<.001*** |
29.9 |
2.16 |
28 |
13.83 |
<.001*** |
disp |
-0.04 |
0.01 |
29 |
-7.71 |
<.001*** |
-0.02 |
0.01 |
28 |
-1.86 |
.073 |
hp |
|
|
|
|
|
-0.04 |
0.01 |
28 |
-2.9 |
.007** |
Model |
---|
(Intercept) am |
0.65 |
|
|
|
|
6.19 |
|
|
|
|
Residual |
10.35 |
|
|
|
|
8.08 |
|
|
|
|
ICC |
0.06 |
|
|
|
|
0.43 |
|
|
|
|
N am |
2 |
|
|
|
|
2 |
|
|
|
|
R² Conditional |
0.7 |
|
|
|
|
0.76 |
|
|
|
|
R² Marginal |
0.69 |
|
|
|
|
0.58 |
|
|
|
|
Observations |
32 |
|
|
|
|
32 |
|
|
|
|
nice_regression_table(
wmisc:::model_lmer_1, wmisc:::model_lmer_2,
rename_labels = list(
"EffectTrend" = "Trend", "EffectSlope" = "Slope", "TimePost" = "Post",
"ConditionTraining" = "Training", "id_subject" = "Subject"),
rename_cols = list("Estimate" = "B", "SE" = "se"),
labels_models = c("Only pretest", "Pre- and posttest")
)
#> Loading required namespace: lmerTest
Table Regression model |
Predictor |
Only pretest
|
Pre- and posttest
|
---|
B |
se |
df |
t |
p |
B |
se |
df |
t |
p |
---|
|
---|
(Intercept) |
-0.07 |
0.06 |
192.42 |
-1.1 |
.273 |
-0.05 |
0.09 |
224.18 |
-0.51 |
.610 |
Trend |
-0.11 |
0.06 |
300 |
-2.03 |
.043* |
-0.2 |
0.08 |
484.83 |
-2.6 |
.010** |
Slope |
-0.33 |
0.06 |
300 |
-5.81 |
<.001*** |
-0.43 |
0.08 |
484.83 |
-5.6 |
<.001*** |
Trend & Slope |
0.76 |
0.06 |
300 |
13.47 |
<.001*** |
0.78 |
0.08 |
484.83 |
10.17 |
<.001*** |
Post |
|
|
|
|
|
-0.15 |
0.07 |
240.04 |
-2.02 |
.044* |
Training |
|
|
|
|
|
-0.04 |
0.12 |
224.18 |
-0.31 |
.758 |
Post:Training |
|
|
|
|
|
0.16 |
0.1 |
240.04 |
1.69 |
.091 |
Post:Trend |
|
|
|
|
|
0.24 |
0.07 |
7569.02 |
3.29 |
.001** |
Post:Slope |
|
|
|
|
|
0.16 |
0.07 |
7569.02 |
2.28 |
.023* |
Post:Trend & Slope |
|
|
|
|
|
0.07 |
0.07 |
7569.02 |
0.97 |
.332 |
Training:Trend |
|
|
|
|
|
0.15 |
0.1 |
484.83 |
1.46 |
.144 |
Training:Slope |
|
|
|
|
|
0.18 |
0.1 |
484.83 |
1.74 |
.083 |
Training:Trend & Slope |
|
|
|
|
|
-0.03 |
0.1 |
484.83 |
-0.33 |
.740 |
Post:Training:Trend |
|
|
|
|
|
-0.26 |
0.09 |
7569.02 |
-2.71 |
.007** |
Post:Training:Slope |
|
|
|
|
|
0.01 |
0.09 |
7569.02 |
0.07 |
.940 |
Post:Training:Trend & Slope |
|
|
|
|
|
-0.33 |
0.09 |
7569.02 |
-3.51 |
<.001*** |
Model |
---|
(Intercept) Subject |
0.24 |
|
|
|
|
0.19 |
|
|
|
|
(Intercept) Subject:Effect |
0.11 |
|
|
|
|
0.07 |
|
|
|
|
(Intercept) Subject:Time |
|
|
|
|
|
0.06 |
|
|
|
|
Residual |
0.55 |
|
|
|
|
0.55 |
|
|
|
|
ICC |
0.39 |
|
|
|
|
0.37 |
|
|
|
|
N Subject |
101 |
|
|
|
|
101 |
|
|
|
|
N Effect |
4 |
|
|
|
|
4 |
|
|
|
|
N Time |
|
|
|
|
|
2 |
|
|
|
|
R² Conditional |
0.48 |
|
|
|
|
0.45 |
|
|
|
|
R² Marginal |
0.16 |
|
|
|
|
0.14 |
|
|
|
|
Observations |
4040 |
|
|
|
|
8080 |
|
|
|
|