Description Usage Arguments Details Value See Also Examples
View source: R/model_summary.r
The function model_summary computes coefficient estimates for linear regression models or linear fixed effects models. For linear models, the user can provide a cluster variable to cluster the standard errors and can select to use bootstraping for clustering.
1 |
input |
Object of class "mod_vcov", linear model of class "lm" or "glm", or linear fixed effects model of class "lmerMod" or "glmerMod" |
type |
Indicator which type of standard errors is to be computed: 0 - no clustering, 1 - clustering using |
var_cluster |
Vector, matrix, or data.frame containing the variables that are used for clustering |
randfe |
|
show |
|
sg |
|
For input of class "lm" or "glm" the options type == 0, type == 1, and type == 2 control how the variance-covariance matrix for standard error estimation is computed. The options type == 1 and type == 2 require a cluster variable defined in var_cluster.
Coefficient estimates for the model provided as "input" based on model class and selection in type.
When the option show is set to TRUE the output is printed to the console. If the package knitr is available, the output is printed using knitr::kable.
When sg is set to TRUE the output is printed in html format (this overrules show == FALSE). When show is set to FALSE the output is returned as data.frame or tibble (when package tibble is available).
For models of class "lmerMod" and "glmerMod" and randfe == TRUE, random fixed effects are either printed (show == TRUE) or returned as part of a named list containing Variables = coefficient estimates and RandFE containing the random fixed effects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | data <- supportR::create_data()
mod1 <- lm(firm_value ~ profit + cogs + rnd + competition * board_size, data = data)
mod1_vcov <- model_vcov(model = mod1, type = 1, var_cluster = data$country)
model_summary(input = mod1_vcov, show = TRUE, sg = FALSE)
model_summary(input = mod1, type = 0, var_cluster = NULL, show = TRUE, sg = FALSE)
mod2 <- glm(female_ceo ~ profit + cogs + rnd + ceo_age * board_size, data = data, family = "binomial")
model_summary(input = mod2, type = 2, var_cluster = data$industry, show = TRUE, sg = FALSE)
mod3 <- lme4::lmer(firm_value ~ profit + cogs + rnd + competition * board_size + (1 | country), data = data)
model_summary(input = mod3, randfe = TRUE, show = FALSE, sg = FALSE)
mod4 <- lme4::glmer(female_ceo ~ profit + cogs + rnd + ceo_age * board_size + (1 | industry), data = data, family = "binomial")
model_summary(input = mod4, randfe = FALSE, show = FALSE, sg = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.