View source: R/lm_model_table.R
lm_model_table | R Documentation |
Generate tables with multiple response, predictor, or two-way interaction variables (only lm
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 lm_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
lm_model_table(
data,
response_variable,
predictor_variable,
two_way_interaction_variable = NULL,
control_variable = NULL,
other_parameters = NULL,
marginal_alpha = 0.1,
return_result = FALSE,
verbose = TRUE,
show_p = FALSE
)
data |
|
response_variable |
response variable. Support |
predictor_variable |
predictor variable. Support |
two_way_interaction_variable |
Two-way interaction variable. Each two-way interaction variable will interact with the predictor variable. Support |
control_variable |
control variables. Support |
other_parameters |
catch call for all other parameters that need to be entered (e.g., non-changing interaction terms). Have to be |
marginal_alpha |
the set marginal_alpha level for marginally significant (denoted by |
return_result |
It set to |
verbose |
default is |
show_p |
show the p-value in parenthesis |
data.frame
# If you want all varibles to be changing, try lm_model_explore.
test = data.frame(y1 = rnorm(1000,2,3),
y2 = rnorm(1000,10,2),
y3 = rnorm(1000,1,4),
x1 = rnorm(1000,100,10),
x2 = rnorm(1000,10,1),
x3 = rnorm(1000,6,2),
m1 = rnorm(1000,3,1),
m2 = rnorm(1000,2,0.5),
m3 = rnorm(1000,9,0.1),
c1 = rnorm(1000,5,0.4),
c2 = rnorm(1000,2,0.2),
c3 = rnorm(1000,7,0.9)
)
# Changing response variable
lm_model_table(data = test,
response_variable = c(y1,y2,y3),
predictor_variable = x1,
control_variable = c(c1,c2,c3))
# Changing predictors
lm_model_table(data = test,
response_variable = y1,
predictor_variable = c(x1,x2,x3),
control_variable = c(c1,c2,c3))
# Changing interaction terms with a non-changing response variable
lm_model_table(data = test,
response_variable = y1,
predictor_variable = x1,
two_way_interaction_variable = c(m1,m2,m3),
control_variable = c(c1,c2,c3))
# A non-changing interaction term with changing response variables
lm_model_table(data = test,
response_variable = c(y1,y2,y3),
predictor_variable = x1,
other_parameters = c('x1*m1'),
control_variable = c(c1,c2,c3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.