commarobust: Build lm_robust object from lm fit

Description Usage Arguments Value Examples

View source: R/helper_starprep.R

Description

Build lm_robust object from lm fit

Usage

1
2
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

1
2
3
4
5
6
7
8
lmo <- lm(mpg ~ hp, data = mtcars)

# Default HC2
commarobust(lmo)

commarobust(lmo, se_type = "HC3")

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

graemeblair/DDestimate documentation built on Sept. 10, 2019, 7:38 p.m.