summ.lm: Linear regression summaries with options in jtools: Analysis and Presentation of Social Scientific Data (2024)

summ.lmR Documentation

Linear regression summaries with options

Description

summ() prints output for a regression model in a fashion similar tosummary(), but formatted differently with more options.

Usage

## S3 method for class 'lm'summ( model, scale = FALSE, confint = getOption("summ-confint", FALSE), ci.width = getOption("summ-ci.width", 0.95), robust = getOption("summ-robust", FALSE), cluster = NULL, vifs = getOption("summ-vifs", FALSE), digits = getOption("jtools-digits", 2), pvals = getOption("summ-pvals", TRUE), n.sd = 1, center = FALSE, transform.response = FALSE, scale.only = FALSE, data = NULL, part.corr = FALSE, model.info = getOption("summ-model.info", TRUE), model.fit = getOption("summ-model.fit", TRUE), model.coefs = getOption("summ-model.coefs", TRUE), which.cols = NULL, vcov = NULL, ...)

Arguments

model

A lm object.

scale

If TRUE, reports standardized regressioncoefficients by scaling and mean-centering input data (the latter can bechanged via the scale.only argument). Default is FALSE.

confint

Show confidence intervals instead of standard errors? Defaultis FALSE.

ci.width

A number between 0 and 1 that signifies the width of thedesired confidence interval. Default is .95, which correspondsto a 95% confidence interval. Ignored if confint = FALSE.

robust

If not FALSE, reports heteroskedasticity-robust standarderrors instead of conventional SEs. These are also known as Huber-Whitestandard errors. There are several options provided bysandwich::vcovHC(): "HC0", "HC1", "HC2", "HC3", "HC4","HC4m", "HC5".

Default is FALSE.

This requires the sandwich package to compute thestandard errors.

cluster

For clustered standard errors, provide the column name ofthe cluster variable in the input data frame (as a string). Alternately,provide a vector of clusters. Note that you must set robust to either"HC1", "HC2", or "HC3" in order to have clustered standard errors ("HC4"and "HC5" are not supported.

vifs

If TRUE, adds a column to output with variance inflationfactors (VIF). Default is FALSE.

digits

An integer specifying the number of digits past the decimal toreport in the output. Default is 2. You can change the default number ofdigits for all jtools functions withoptions("jtools-digits" = digits) where digits is the desirednumber.

pvals

Show p values? If FALSE, theseare not printed. Default is TRUE.

n.sd

If scale = TRUE, how many standard deviations shouldpredictors be divided by? Default is 1, though some suggest 2.

center

If you want coefficients for mean-centered variables but don'twant to standardize, set this to TRUE. Note that setting this tofalse does not affect whether scale mean-centers variables. Usescale.only for that.

transform.response

Should scaling/centering apply to responsevariable? Default is FALSE.

scale.only

If you want to scale but not center, set this to TRUE.Note that for legacy reasons, setting scale = TRUE and center = FALSEwill not achieve the same effect. Default is FALSE.

data

If you provide the data used to fit the model here, that dataframe is used to re-fit the model (if scale is TRUE)instead of the stats::model.frame()of the model. This is particularly useful if you have variabletransformations or polynomial terms specified in the formula.

part.corr

Print partial (labeled "partial.r") andsemipartial (labeled "part.r") correlations with the table?Default is FALSE. See details about these quantities when robuststandard errors are used.

model.info

Toggles printing of basic information on sample size,name of DV, and number of predictors.

model.fit

Toggles printing of model fit statistics.

model.coefs

Toggles printing of model coefficents.

which.cols

Developmental feature. By providing columns by name,you can add/remove/reorder requested columns in the output. Not fullysupported, for now.

vcov

You may provide your own variance-covariance matrix for theregression coefficients if you want to calculate standard errors insome way not accommodated by the robust and cluster options.

...

Among other things, arguments are passed to scale_mod() orcenter_mod() when center or scale is TRUE.

Details

By default, this function will print the following items to theconsole:

There are several options available for robust. The heavylifting is done by sandwich::vcovHC(), where those are betterdescribed.Put simply, you may choose from "HC0" to "HC5". Based on therecommendation of the developers of sandwich, the default is set to"HC3". Stata's default is "HC1", so that choice may be betterif the goal is to replicate Stata's output. Any option that is understoodby vcovHC() will be accepted. Cluster-robust standard errors arecomputed if cluster is set to the name of the input data's clustervariable or is a vector of clusters.

The scale and center options are performed viarefittingthe model with scale_mod() and center_mod(),respectively. Each of those in turn uses gscale() for themean-centering and scaling.

If using part.corr = TRUE, then you will get these two commoneffect size metrics on the far right two columns of the output table.However, it should be noted that these do not go hand in hand withrobust standard error estimators. The standard error of the coefficientdoesn't change the point estimate, just the uncertainty. However,this function uses t-statistics in its calculation of thepartial and semipartial correlation. This provides what amounts to aheteroskedasticity-adjusted set of estimates, but I am unaware of anystatistical publication that validates this type of use. Pleaseuse these as a heuristic when used alongside robust standard errors; donot report the "robust" partial and semipartial correlations inpublications.

Value

If saved, users can access most of the items that are returned inthe output (and without rounding).

coeftable

The outputted table of variables and coefficients

model

The model for which statistics are displayed. This would bemost useful in cases in which scale = TRUE.

Much other information can be accessed as attributes.

Author(s)

Jacob Long jacob.long@sc.edu

References

King, G., & Roberts, M. E. (2015). How robust standard errors exposemethodologicalproblems they do not fix, and what to do about it. PoliticalAnalysis,23(2), 159–179. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/pan/mpu015")}

Lumley, T., Diehr, P., Emerson, S., & Chen, L. (2002). The Importance of theNormality Assumption in Large Public Health Data Sets.Annual Review ofPublic Health, 23, 151–169.\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1146/annurev.publhealth.23.100901.140546")}

See Also

scale_mod() can simply perform the standardization ifpreferred.

gscale() does the heavy lifting for mean-centering and scalingbehind the scenes.

Other summ: summ.glm(),summ.merMod(),summ.rq(),summ.svyglm()

Examples

# Create lm objectfit <- lm(Income ~ Frost + Illiteracy + Murder, data = as.data.frame(state.x77))# Print the output with standardized coefficients and 3 digitssumm(fit, scale = TRUE, digits = 3)
summ.lm: Linear regression summaries with options in jtools: Analysis and Presentation of Social Scientific Data (2024)

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Gov. Deandrea McKenzie

Last Updated:

Views: 6396

Rating: 4.6 / 5 (46 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Gov. Deandrea McKenzie

Birthday: 2001-01-17

Address: Suite 769 2454 Marsha Coves, Debbieton, MS 95002

Phone: +813077629322

Job: Real-Estate Executive

Hobby: Archery, Metal detecting, Kitesurfing, Genealogy, Kitesurfing, Calligraphy, Roller skating

Introduction: My name is Gov. Deandrea McKenzie, I am a spotless, clean, glamorous, sparkling, adventurous, nice, brainy person who loves writing and wants to share my knowledge and understanding with you.