I wanted to ask when doing panel data models: random, fixed and LSDV using lm
function. When using stargazer to get nice table of results, we get a additional variables coef for all cross section dummy coefs. like in the example below:
#Load packages
library(foreign)
library(plm)
library(stargazer)
#Load in Wooldridge data on crime
crime <- read.dta("http://fmwww.bc.edu/ec-p/data/wooldridge/crime4.dta")
#Declare our data to be a panel data set
crime.p <- pdata.frame(crime,index=c("county","year"))
#Run a panel model
#fixed effects / within
fixedeff <- plm(log(crmrte) ~ polpc + lwtuc + avgsen + wfed + d82 + d82 + d84 + d85,data=crime.p,model="within")
#Random effects
randomeff <- plm(log(crmrte) ~ polpc + lwtuc + avgsen + wfed + d82 + d82 + d84 + d85,data=crime.p,model="random")
#LSDV
LSDV <- lm(log(crmrte) ~ polpc + lwtuc + avgsen + wfed + d82 + d82 + d84 + d85 + factor(county)-1, data=crime.p)
stargazer(fixedeff, randomeff, LSDV, type = "text")
Is there a way how to have a nice table and do not have all factor(county)
coefs in it?
I know we can do it "by hand" when printing the table, however I need this inside a function So I NEED type = "text"
.
as coeffeinjunky said, it should work with omit
. Add it as option to stargazer
:
stargazer(fixedeff, randomeff, LSDV, type = "text", omit=c("county"))
Is this the output you're looking for?