Get the standard error of the estimates of the model parameters.

se(model, vce = NULL)

Arguments

model

an estimated model returned by lm or similar functions.

vce

an object indicating how to obtain the covariance matrix.

Value

A named vector with the standard errors of the estimates.

Details

The parameter vce controls how the covariance matrix of estimates is computed:

  • If vce is NULL (the default), the covariance matrix is computed using vcov: vcov(model).

  • vce can be a string that indicates which type of covariance matrix is used. Covariance matrices robust to heteroskedasticity are computed with vce = "HC". Other variants valid under heteroskedasticity are "HC0", "HC1", "HC2" and "HC3" (which is equivalent to "HC"). Newey and West proposed a covariance matrix estimator valid under autocorrelation and heteroskedasticity. This estimator is computed by setting vceequal to "NW" or "HAC".

  • vce can also be a function. In that case the covariance matrix is estimated by calling that function: vce(model).

  • Finally, a covariance matrix can be passed directly to vce.

The model object should support the coef and vcov methods.

See also

Examples

data("hprice1") mod <- lm(price ~ sqrft + bdrms, data = hprice1) se(mod)
#> (Intercept) sqrft bdrms #> 31.04661929 0.01382446 9.48351703
# Get heteroskedasticity robust standard errors se(mod, vce = "HC")
#> (Intercept) sqrft bdrms #> 44.97970789 0.02136283 9.99386464