[Experimental]
Generate tables with multiple response, predictor, or two-way interaction variables (only lmer models are supported). You can pass multiple variables for one type of variable (either response, pred, or interaction) only. If you want to pass multiple variables for multiple type of variable, try lmer_model_explore instead. At the moment, multi-categorical variables are not supported as predictors or interactions (but control is fine). Binary variable should be numeric instead of factor This function also do not supports changing random slopes. Please use other_parameters if you want to add non-changing interaction term.

lme_model_table(
  ...,
  data,
  response_variable,
  predictor_variable,
  two_way_interaction_variable = NULL,
  random_effect,
  control_variable = NULL,
  other_parameters = NULL,
  marginal_alpha = 0.1,
  return_result = FALSE,
  verbose = TRUE,
  show_p = FALSE
)

Arguments

...

additional parameters pass to lmerTest::lmer()

data

data.frame

response_variable

response variable. Support dplyr::select() syntax.

predictor_variable

predictor variable. Support dplyr::select() syntax. It will automatically remove the response variable from predictor variable, so you can use contains() or start_with() safely.

two_way_interaction_variable

Two-way interaction variable. Each two-way interaction variable will interact with the predictor variable. Support dplyr::select() syntax.

random_effect

The random-effects terms in the format of (|). See lm4::lmer for specifics.

control_variable

control variables. Support dplyr::select() syntax.

other_parameters

catch call for all other parameters that need to be entered (e.g., non-changing interaction terms). Have to be character type.

marginal_alpha

the set marginal_alpha level for marginally significant (denoted by .). Set to 0.05 if do not want marginally significant denotation.

return_result

It set to TRUE, it return the model estimates data frame.

verbose

default is TRUE. Set to FALSE to suppress outputs

show_p

show the p-value in parenthesis

Value

data.frame

Examples

# If you want all varibles to be changing, try lmer_model_explore.
# For more examples, see ?lm_model_table. 

# Changing interaction terms with a non-changing response variable
lme_model_table(data = popular,
                 response_variable = popular,
                 predictor_variable = texp,
                 two_way_interaction_variable = c(extrav,sex),
                 random_effect = '(1 | class)')
#> ────────────────────────────────────────────────────────
#>   Parameter/Focal_interact_term  texp*extrav    texp*sex
#> ────────────────────────────────────────────────────────
#>                     (Intercept)   -1.219 ***   3.502 ***
#>                            texp    0.253 ***   0.063 ***
#>             Focal_interact_pred    0.892 ***   1.577 ***
#>             Focal_interact_term   -0.028 ***  -0.016 *  
#>                  SD (Intercept)    0.629       0.596    
#>               SD (Observations)    0.944       0.911    
#>                              df     1994.000    1994.000
#>                  r2_conditional        0.536       0.540
#>                     r2_marginal        0.329       0.344
#> ────────────────────────────────────────────────────────
#> Note: + < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001

# A non-changing interaction term with changing response variables
lme_model_table(data = popular,
                 response_variable = c(popular,sex),
                 predictor_variable = texp,
                 other_parameters = 'texp*extrav',
                 random_effect = '(1 | class)')
#> ──────────────────────────────────────────────────
#>   Parameter/Focal_response     popular         sex
#> ──────────────────────────────────────────────────
#>                (Intercept)  -1.219 ***  -0.103    
#>                       texp   0.253 ***   0.027 ***
#>                     extrav   0.892 ***   0.088 ***
#>                texp:extrav  -0.028 ***  -0.003 *  
#>             SD (Intercept)   0.629       0.153    
#>          SD (Observations)   0.944       0.470    
#>                         df    1994.000    1994.000
#>             r2_conditional       0.536       0.115
#>                r2_marginal       0.329       0.021
#> ──────────────────────────────────────────────────
#> Note: + < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001