0

alldata5 is my data and OROA,IROA,UROA,X2Y,PGR,LTA,gcode are different variables in this

basico2<-lm(alldata5$OROA~alldata5$X2Y+alldata5$PGR+alldata5$LTA+factor(alldata5$gcode))


basici2<-lm(alldata5$IROA~alldata5$X2Y+alldata5$PGR+alldata5$LTA+factor(alldata5$gcode))


basicu2<-lm(alldata5$UROA~alldata5$X2Y+alldata5$PGR+alldata5$LTA+factor(alldata5$gcode))


stargazer(basico2,basici2,basicu2, dep.var.labels=c("OROA","IROA","UROA"),
          omit="gcode",type="html", out="E:\\1.basic ols output\\1.1two year.ols.htm")

enter image description here

I can use stargazer for lm() function,but how can I use it for lm.cluster() function?Like:

library( miceadds)


basico2c<-lm.cluster(data=alldata5,formula=OROA~X2Y+PGR+LTA+factor(gcode),cluster="year")


basici2c<-lm.cluster(data=alldata5,formula=IROA~X2Y+PGR+LTA+factor(gcode),cluster="year")


basicu2c<-lm.cluster(data=alldata5,formula=UROA~X2Y+PGR+LTA+factor(gcode),cluster="year")

It will be faild if I use

stargazer(basico2C,basici2C,basicu2C, dep.var.labels=c("OROA","IROA","UROA"), omit="gcode",type="html", out="E:\1.basic ols output\1.1two year.ols.htm")
bretauv
  • 7,756
  • 2
  • 20
  • 57
XUN ZHANG
  • 83
  • 11
  • Or if i don't use lm.cluster() function,do you know any function that i can use then have the output like the picture shows? If anyone know the answer,please let me know, thank you very much! – XUN ZHANG Dec 31 '19 at 06:04
  • In https://cran.r-project.org/web/packages/stargazer/vignettes/stargazer.pdf 2.3 you find a list of supported statistical models. Looks like `miceadds` is not included. Perhaps you find some supported package which supports clusters. – Marco Jan 14 '20 at 08:02
  • Yes, Marco, I think so. Thank you very much. I may use STATA to export the output, it's more convenient than R while doing the regression – XUN ZHANG Jan 14 '20 at 15:47
  • I meant, you can use another package in R to calculate clustered robust standard errors, which in turn can be used in `stargazer` see https://stackoverflow.com/questions/58923112/robust-standard-errors-in-lm-using-stargazer/59156668#59156668 – Marco Jan 14 '20 at 16:01
  • @MarcoDoe I got it now. Thanks again! – XUN ZHANG Jan 14 '20 at 16:03

0 Answers0