Jack
Jack

Reputation: 857

How to get confidence intervals after extracting robust standard errors in R?

First, i run a regression model. Then, i extract robust standard errors. However, i am not sure how to extract the confidence interval afterwards, coeftest() seems to include only the standard errors. Is there a way to do it automatically?

Here is the reproducible data and code:

library(plm)
library(lmtest)
library(broom)

data(Cigar)   
model<- plm(price ~ sales + cpi, index=c("state", "year"), model = 'within', 
                data = Cigar)
#Extract the robust standard errors    
plot_coeftest = tidy(coeftest(model))

Upvotes: 1

Views: 1123

Answers (1)

Jack
Jack

Reputation: 857

as @deschen proposed, this is the solution:

plot_coeftest= broom::tidy(lmtest::coeftest(model), conf.int = TRUE)

Upvotes: 1

Related Questions