estimatr (version 0.14)

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

Run this code
# NOT RUN {
lmo <- lm(mpg ~ hp, data = mtcars)

# Default HC2
commarobust(lmo)

commarobust(lmo, se_type = "HC3")

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

# }

Run the code above in your browser using DataLab