I have three regression and all variables name are identical.
reg1<-lm(y~x1+x2+x3+x4,data=data1)
reg2<-lm(y~x1+x2+x3+x4,data=data2)
reg3<-lm(y~x1+x2+x3+x4,data=data3)
Then I try to do: stargazer(reg1,reg2,reg3,type="text",keep.stat = "all",align = TRUE)
The table is produced but misplaced (line 1, row 1-4 are the result for reg1, but line 2, row 5-8 are the result for reg 2, row 9-12 for reg3).
Can anyone suggest? Thanks
Can you go more into detail, what you expect the output to look like? When you use identical models (variables) with different datasets, I don't see misplaced output.
library("plm")
library("stargazer")
data("Produc", package = "plm")
model1 <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
data = Produc,
index = c("state","year"),
method="pooling")
model2 <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
data = Produc,
index = c("state","year"),
method="between")
model3 <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
data = Produc,
index = c("state","year"),
method="within")
stargazer(model1,model2,model3,type="text",keep.stat = "all",align = TRUE)
stargazer(model1,model2,model3,type="latex",keep.stat = "all",align = TRUE, out="output.tex")
Notice that the align
option only works in latex output and only if you have loaded the package dcolumn
. Latex, with and without the dcolumn
:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.