The simplest way of producing the table output is by passing the fitted models as parameter. By default, estimates (B), confidence intervals (CI) and p-values (p) are reported. The models are named Model 1 and Model 2.

Custom variable labels

In the above example, the original variable labels are long and not so pretty. You can change variable labels either with sjmisc::set_label(), which will affect all future plots and tables, or pass own labels via pred.labels.

More space bewteen model columns

Especially when fitting and summarizing some more models, it might help to increase the distance between the columns that separate the models. This can be done by tweaking the css.separatorcol style-sheet:

Automatic grouping of categorical predictors

In case you have categorical variables with more than two factor levels, the sjt.lm() function automatically groups the category levels to give a better overview of predictors in the table.

By default, automatic grouping is activated. To disable this feature, use group.pred = FALSE as parameter.

To demonstrate this feature, we first convert two predictors to factors (what they actually are, indeed). To do this, we use the sjmisc::to_factor() function, which converts numerical variables into factors, however, does not remove the variable and value label attributes.

Removing estimates from the output

With remove.estimates, specific estimates can be removed from the table output. This may make sense in case you have stepwise regression models and only want to compare the varying predictors but not the controls. remove.estimates either accepts the row indices of the rows of the table output that should be removed, or the coefficient’s names.

When using numeric indices, the estimates’ index number relates to the same order as coef(fit).

Note that automatic grouping of categorical predictors (argumentgroup.pred) does not yet work properly when removing estimates! See also Example 6 for further details.

Example 1: Complete table output

Here you have the complete table output. This helps you identify the row index numbers. Especially when you have multiple models with different predictors, the estimate’s position in the last model may differ from this estimate’s position in the table output.

sjt.lm(fit1, fit2, fit3, group.pred =FALSE)

Negative impact with 7 items

Negative impact with 7 items

Negative impact with 7 items

B

CI

p

B

CI

p

B

CI

p

(Intercept)

8.40

6.72 – 10.08

<.001

9.18

7.53 – 10.83

<.001

8.48

6.99 – 9.97

<.001

carer’ age

0.04

0.02 – 0.06

<.001

0.01

-0.01 – 0.03

.306

0.01

-0.01 – 0.03

.384

Education (intermediate level of education)

0.16

-0.52 – 0.83

.652

0.12

-0.54 – 0.78

.728

0.08

-0.56 – 0.72

.806

Education (high level of education)

0.79

-0.05 – 1.64

.066

0.91

0.09 – 1.74

.030

0.52

-0.28 – 1.32

.203

carer’s gender

0.70

0.09 – 1.32

.025

0.59

-0.01 – 1.19

.053

average number of hours of care per week

0.02

0.01 – 0.02

<.001

Dependency (slightly dependent)

1.18

0.16 – 2.20

.024

Dependency (moderately dependent)

2.53

1.53 – 3.52

<.001

Dependency (severely dependent)

4.32

3.31 – 5.33

<.001

Services for elderly

0.21

0.01 – 0.41

.042

Observations

832

832

833

R2 / adj. R2

.026 / .021

.081 / .075

.154 / .147

Example 2: Removing the intercept

Note that currently the intercept cannot be removed from the model output. However, you can “fake” a removed intercept by setting the font size of the first row (with intercept) to zero via CSS = list(css.topcontentborder = "+font-size: 0px;").

Example 6: Custom predictor labels

In most cases you need to define your own labels when removing estimates, especially when you have grouped categorical predictors, because automatic label detection is quite tricky in such situations. If you provide own labels, please note that grouped predictors’ headings (the variable name of the grouped, categorical variable) are still automatically set by the sjt.lm() function (variable labels are used, so use set_label() for those categorical predictors). All data rows in the table, i.e. for each coefficient appearing in the model, you need to specify a label string.

In the next example, we have seven table rows with data (excluding intercept): mid and hi education (categories of the variable Education), Hours of Care, slight, moderate and severe dependency (categories of the variable Dependency) and Service Usage. These ‘rows’ need to be labelled.