I have the following regressions:
fit1 <- lm(y ~ x1, data = data)
fit2 <- lm(y ~ x1 + x2, data = data)
fit3 <- lm(y ~ x3 * x1, data = data)
I want in the output the explanatory variables to be order (x1, x2, x3 and finally the interaction). I try the following with order but still the interaction appears second after x1. What may be wrong here?
stargazer(fit1, fit2, fit3, align=TRUE, table.placement="H",omit.stat=c("f", "ser"), order=c("x1", "x2", "x3", "x3:x1"))
The help-file for order states "order - a vector of regular expressions (or of numerical indexes) that indicates the order in which variables will appear in the output". So your strings were parsed as regex, and x1 matches x3:x1. You could do a numeric order:
stargazer(fit1, fit2, fit3, align=TRUE,
table.placement="H",omit.stat=c("f", "ser"), order=c(2,3,1,4,5))