How do I customize the goodness of fit (gof) in a texreg call?
I have some plm models I want to display, but I only get "Num. obs.", "Adj. R^2",
and , "R^2"
(see working example below). I would howver like to all display small n
, T
, F-statistic
, and p-value
, all stuff I get in the default summary()
call.
A example of what I got. First some data and needed packages,
# install.packages(c("wooldridge", "plm", "texreg"), dependencies = TRUE)
library(wooldridge)
data(wagepan)
library(plm)
Second, some models,
POLS <- plm(lwage ~ educ + black + hisp + exper+I(exper^2)+ married + union +
factor(year), data = wagepan, index=c("nr","year") , model="pooling")
RE <- plm(lwage ~ educ + black + hisp + exper + I(exper^2) + married + union +
factor(year), data = wagepan, index = c("nr","year") , model = "random")
FE <- plm(lwage ~ I(exper^2) + married + union + factor(year),
data = wagepan, index = c("nr","year"), model="within")
Third, my current texreg call and its output,
# library(texreg)
texreg::screenreg(list(POLS, RE, FE), custom.coef.map = list('married' = 'Marrtied', 'union' = 'Union'))
#> ================================================
#> Model 1 Model 2 Model 3
#> ------------------------------------------------
#> Marrtied 0.11 *** 0.06 *** 0.05 *
#> (0.02) (0.02) (0.02)
#> Union 0.18 *** 0.11 *** 0.08 ***
#> (0.02) (0.02) (0.02)
#> ------------------------------------------------
#> R^2 0.19 0.18 0.18
#> Adj. R^2 0.19 0.18 0.06
#> Num. obs. 4360 4360 4360
#> ================================================
#> *** p < 0.001, ** p < 0.01, * p < 0.05
I did try adding , include.fstatistic = TRUE
, but it seems as I can't get it that way. It is as I need some additional customization.
I am aiming for something like this,
#> ------------------------------------------------
#> Obs. (N) 4360 4360 4360
#> Indiv.(n) 545 545 545
#> Time (T) 8 8 8
#> R^2 0.19 0.18 0.18
#> Adj. R^2 0.19 0.18 0.06
#> F-stat 72.458 68.4124 83.8515
#> P-value (2.22e-16) (2.22e-16) (2.22e-16)
#> ================================================
#> *** p < 0.001, ** p < 0.01, * p < 0.05