Search code examples
rstargazerfixest

Can you make Stargazer regression output tables when you have a list?


I ran an binomial logit model while controlling for bank- and time-fixed effects by using the feglm() function from the fixest package. However this function saves the regression output as a list. Unfortunately Stargazer doesn't seem to recognize this. Can anyone help me with this?

This is the regression I ran:

BinomialLogitModelWinsorizedLag <- feglm(CoCoIssuance ~ log(TotalAssetsLagged) + DepositsOverAssetsLagged + T1RatioLagged + AssetGrowthLagged + EquityOverAssetsLagged + CashOverAssetsLagged + CET1RatioLagged + DividendsOverEquityLagged + PriceOverBookLagged + ROALagged + LoansOverAssetsLagged | IssuerName + YearOfIssuance, data = WinsorizedDataLagged , family = binomial("logit") )

I tried extracting the estimated coefficients and standard errors from this list and save it as a data frame. However when I do this, Stargazer gives me the descriptive statistics and not the regression output table that I want.

# extract coefficients and standard errors
coef_tableLogitLag <- BinomialLogitModelWinsorizedLag$coeftable

stargazer(coef_tableLogitLag, type = "text")

Solution

  • I am not sure about stargazer, why it is not producing the result what you wanted, I would suggest you to try out texreg package instead.

    Below code work fine for me:

    library(fixest)
    library(texreg)
    
    # Fit a binomial logit model with bank- and time-fixed effects
    model1 <- feglm(am ~ mpg + cyl + hp | factor(vs) + factor(gear), 
                   data = mtcars, family = binomial("logit"))
    
    
    htmlreg(model1, file = "texreg.html", 
            inline.css = FALSE, doctype = TRUE, html.tag = TRUE, 
            head.tag = TRUE, body.tag = TRUE)
    

    This produces the result as:

    enter image description here

    Or for the models:

    # Fit a binomial logit model 
    model1 <- feglm(am ~ mpg + cyl + hp | factor(vs) + factor(gear), 
                   data = mtcars, family = binomial("logit"))
    
    model2 <- feglm(am ~ mpg + cyl + hp + factor(vs) + factor(gear), 
                   data = mtcars, family = binomial("logit"))
    

    The code below:

    htmlreg(list(model1, model2), file = "texreg2.html", 
            inline.css = FALSE, doctype = TRUE, html.tag = TRUE, 
            head.tag = TRUE, body.tag = TRUE)
    

    Produces:

    enter image description here