This function computes the confidence interval of parameter estimates obtained from a
model estimated with femlm
, feols
or feglm
.
Usage
# S3 method for fixest
confint(
object,
parm,
level = 0.95,
vcov,
se,
cluster,
ssc = NULL,
coef.col = FALSE,
...
)
Arguments
- object
A
fixest
object. Obtained using the functionsfemlm
,feols
orfeglm
.- parm
The parameters for which to compute the confidence interval (either an integer vector OR a character vector with the parameter name). If missing, all parameters are used.
- level
The confidence level. Default is 0.95.
- vcov
Versatile argument to specify the VCOV. In general, it is either a character scalar equal to a VCOV type, either a formula of the form:
vcov_type ~ variables
. The VCOV types implemented are: "iid", "hetero" (or "HC1"), "cluster", "twoway", "NW" (or "newey_west"), "DK" (or "driscoll_kraay"), and "conley". It also accepts object fromvcov_cluster
,vcov_NW
,NW
,vcov_DK
,DK
,vcov_conley
andconley
. It also accepts covariance matrices computed externally. Finally it accepts functions to compute the covariances. See thevcov
documentation in the vignette.- se
Character scalar. Which kind of standard error should be computed: “standard”, “hetero”, “cluster”, “twoway”, “threeway” or “fourway”? By default if there are clusters in the estimation:
se = "cluster"
, otherwisese = "iid"
. Note that this argument is deprecated, you should usevcov
instead.- cluster
Tells how to cluster the standard-errors (if clustering is requested). Can be either a list of vectors, a character vector of variable names, a formula or an integer vector. Assume we want to perform 2-way clustering over
var1
andvar2
contained in the data.framebase
used for the estimation. All the followingcluster
arguments are valid and do the same thing:cluster = base[, c("var1", "var2")]
,cluster = c("var1", "var2")
,cluster = ~var1+var2
. If the two variables were used as fixed-effects in the estimation, you can leave it blank withvcov = "twoway"
(assumingvar1
[resp.var2
] was the 1st [resp. 2nd] fixed-effect). You can interact two variables using^
with the following syntax:cluster = ~var1^var2
orcluster = "var1^var2"
.- ssc
An object of class
ssc.type
obtained with the functionssc
. Represents how the degree of freedom correction should be done.You must use the functionssc
for this argument. The arguments and defaults of the functionssc
are:adj = TRUE
,fixef.K="nested"
,cluster.adj = TRUE
,cluster.df = "min"
,t.df = "min"
,fixef.force_exact=FALSE)
. See the help of the functionssc
for details.- coef.col
Logical, default is
FALSE
. IfTRUE
the columncoefficient
is inserted in the first position containing the coefficient names.- ...
Not currently used.
Value
Returns a data.frame with two columns giving respectively the lower and upper bound of the confidence interval. There is as many rows as parameters.
Examples
# Load trade data
data(trade)
# We estimate the effect of distance on trade (with 3 fixed-effects)
est_pois = femlm(Euros ~ log(dist_km) + log(Year) | Origin + Destination +
Product, trade)
# confidence interval with "normal" VCOV
confint(est_pois)
#> 2.5 % 97.5 %
#> log(dist_km) -1.754564 -1.301171
#> log(Year) 58.934594 86.305838
# confidence interval with "clustered" VCOV (w.r.t. the Origin factor)
confint(est_pois, se = "cluster")
#> 2.5 % 97.5 %
#> log(dist_km) -1.754564 -1.301171
#> log(Year) 58.934594 86.305838