Description Usage Arguments Value
View source: R/model_summary_with_plot.R
A integrated function that combines all of the functionality of the pacakge.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | model_summary_with_plot(
data,
response_variable,
level_1_factors,
level_2_factors = NULL,
two_way_interaction_factor = NULL,
three_way_interaction_factor = NULL,
cateogrical_var = NULL,
id,
graph_label_name = NULL,
estimation_method = "REML",
opt_control = "optim",
na.action = na.exclude,
model_performance = c("R2_fixed_effect", "R2_full_model"),
return_result = NULL,
print_result = c("short_summary", "plot"),
y_lim = NULL,
plot_color = F,
debug = F
)
|
data |
required dataframe |
response_variable |
required character or vector of length 1 |
level_1_factors |
required vector. Lower level variables (e.g., individual-level) |
level_2_factors |
optional vector. Higher level variables (e.g., country-level) |
two_way_interaction_factor |
optional vector of length more than 2. Default to 'null'. vector in the form of c(predict_var1, predict_var2) |
three_way_interaction_factor |
optional vector of length 3. Default to 'null'. vector in the form of c(predict_var1, predict_var2,predict_var3) |
cateogrical_var |
optional vector. |
id |
required character or vector of length 1. The nesting variable (e.g. country) |
graph_label_name |
optional vector or function. vector of length 2 for two-way interaction graph. vector of length 3 for three-way interaction graph. Vector should be passed in the form of c(response_var, predict_var1, predict_var2, [predict_var3]). Function should be passed as a switch function. See below for an example. |
estimation_method |
optional character. See 'nlme::lme' for other options |
opt_control |
optional character. default to 'optim'. Be aware that 'nlme::lme' default to nlminb. See 'nlme::lme' for other option |
na.action |
required default to 'na.exclude'. See 'nlme::lme' for other options |
model_performance |
optional vector. default to c('R2_fixed_effect','R2_full_model'). 'R2_full_model' for conditional R^2. 'R2_fixed_effect' for marginal R^2. 'icc' for intraclass correlation coefficient. Used the 'performance::r2()' and 'performance::icc()' for model performance |
return_result |
optional vector. Choose from 'short_summary','long_summary', 'model','plot','none'. 'none' return nothing. 'short_summary' return a short model summary. 'long_summary' return the summary using the 'base::summary' function. 'model' return a lme object. 'plot' return the interaction plot. |
print_result |
optional vector. Choose from 'both', 'long_summary', 'short_summary', 'plot', 'none'. 'short_summary' return a short model summary. 'long_summary' return the summary using the base::summary. 'plot' return the interaction plot. |
y_lim |
vector of length 2. c(lower_limit, upper_limit) |
plot_color |
logical. default as F. Set to T if you want to plot in color |
debug |
ignore this parameter |
return a list of all requested items in the order of model, short_summary, long_summary, plot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.