Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

commarobust

Build lm_robust object from lm fit


Description

Build lm_robust object from lm fit

Usage

commarobust(model, se_type = NULL, clusters = NULL, ci = TRUE, alpha = 0.05)

Arguments

model

an lm model object

se_type

The sort of standard error sought. If clusters is not specified the options are "HC0", "HC1" (or "stata", the equivalent), "HC2" (default), "HC3", or "classical". If clusters is specified the options are "CR0", "CR2" (default), or "stata". Can also specify "none", which may speed up estimation of the coefficients.

clusters

A vector corresponding to the clusters in the data.

ci

logical. Whether to compute and return p-values and confidence intervals, TRUE by default.

alpha

The significance level, 0.05 by default.

Value

an lm_robust object.

Examples

lmo <- lm(mpg ~ hp, data = mtcars)

# Default HC2
commarobust(lmo)

commarobust(lmo, se_type = "HC3")

commarobust(lmo, se_type = "stata", clusters = mtcars$carb)

estimatr

Fast Estimators for Design-Based Inference

v0.30.2
MIT + file LICENSE
Authors
Graeme Blair [aut, cre], Jasper Cooper [aut], Alexander Coppock [aut], Macartan Humphreys [aut], Luke Sonnet [aut], Neal Fultz [ctb], Lily Medina [ctb], Russell Lenth [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.