简体   繁体   中英

Omit output of a factor variable in stargazer?

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?

ie 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.

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM