conf_int: Calculate confidence intervals for all or selected regression...

Description Usage Arguments Value See Also Examples

View source: R/conf_int.R

Description

conf_int reports confidence intervals for each coefficient estimate in a fitted linear regression model, using a sandwich estimator for the standard errors and a small sample correction for the critical values. The small-sample correction is based on a Satterthwaite approximation.

Usage

1
conf_int(obj, vcov, level = 0.95, test = "Satterthwaite", coefs = "All", ...)

Arguments

obj

Fitted model for which to calculate confidence intervals.

vcov

Variance covariance matrix estimated using vcovCR or a character string specifying which small-sample adjustment should be used to calculate the variance-covariance.

level

Desired coverage level for confidence intervals.

test

Character vector specifying which small-sample corrections to calculate. "z" returns a z test (i.e., using a standard normal reference distribution). "naive-t" returns a t test with m - 1 degrees of freedom. "Satterthwaite" returns a Satterthwaite correction. "saddlepoint" returns a saddlepoint correction. Default is "Satterthwaite".

coefs

Character, integer, or logical vector specifying which coefficients should be tested. The default value "All" will test all estimated coefficients.

...

Further arguments passed to vcovCR, which are only needed if vcov is a character string.

Value

A data frame containing estimated regression coefficients, standard errors, and confidence intervals.

See Also

vcovCR

Examples

1
2
3
4
5
6
7
data("Produc", package = "plm")
lm_individual <- lm(log(gsp) ~ 0 + state + log(pcap) + log(pc) + log(emp) + unemp, data = Produc)
individual_index <- !grepl("state", names(coef(lm_individual)))
conf_int(lm_individual, vcov = "CR2", cluster = Produc$state, coefs = individual_index)

V_CR2 <- vcovCR(lm_individual, cluster = Produc$state, type = "CR2")
conf_int(lm_individual, vcov = V_CR2, level = .99, coefs = individual_index)

clubSandwich documentation built on Jan. 24, 2021, 1:07 a.m.