Reputation: 91
If I'm running a fixed effects model in r using lm and the factor command, how can I suppress the factor variable coefficients in a stargazer model?
i.e. my model is:
m1<-lm(GDP~pop_growth + factor(city))
and I want to report findings with only an intercept and coefficient on pop_growth, not coefficients on every dummy variable for cities.
EDIT: Issue was, as it turns out, with variable name encoding. omit="city" works.
Upvotes: 8
Views: 10261
Reputation: 2817
As the author said there is an omit
option:
library(stargazer)
model<-lm(mpg~disp+factor(cyl), data=mtcars)
stargazer(model, type="text", omit="cyl")
===============================================
Dependent variable:
---------------------------
mpg
-----------------------------------------------
disp -0.027**
(0.011)
Constant 29.535***
(1.427)
-----------------------------------------------
Observations 32
R2 0.784
Adjusted R2 0.760
Residual Std. Error 2.950 (df = 28)
F Statistic 33.807*** (df = 3; 28)
===============================================
Note: *p<0.1; **p<0.05; ***p<0.01
Upvotes: 1