DJJ
DJJ

Reputation: 2539

Not enough RAM to run stargazer the normal way

The table data1 has around 350k observations. I would like to estimate the 6 models below and output the results in latex using stargazer.I should specify that y1 is a binary variable and I'm dealing with 100 firms. I'm afraid I don't have any data to post.

Here is my code. The problem is that each estimation is stored in the RAM and there are not enough memory left to run Stargazer.

I'll have two questions?

  1. Is there a way to store the `glm' objects on the disk and then call them back with stargazer?
  2. Does stargazer need the whole 'glm' object to output the latex code.?

    l0 <- glm(y1~ x1 + log(x2)+ x3+ factor(x5)+ factor(firms) ,data=data1, family=binomial(link=logit), model=FALSE)

    l1 <- glm(y1~ x1 + log(x2)+ x3+
                factor(x5)+  x4+factor(firms) ,data = data1,family=binomial(link=logit), model=FALSE)
    
    l2 <- glm(y1~x1 +log(x2)+  x3+ 
                factor(x5)+x4+ factor(x6) + factor(firms), data=data1,family=binomial(link=logit)
              , model=FALSE)
    
    l3 <- glm(y1~x1 +log(x2) + x3+
                factor(x5) + x4+factor(x6)   + x7+ factor(firms)
             ,data = data1,family=binomial(link=logit), model=FALSE)
    
    l4 <- glm(y1~x1 + log(x2) + x3+ 
                factor(x5) +x4+ factor(x6)+ x7+installments + 
                factor(firms) ,data = data1,family=binomial(link=logit), model=FALSE)
    
    l5 <- glm(y1~x1 + log(x2) + x3+ 
                factor(x5) +x4+ factor(x6)+ x7 +installments + x8+
                factor(firms) ,data = data1,family=binomial(link=logit), model=FALSE)
    
    
    stargazer(l0,l1,l2,l3,l4,title="Regression Results with Fixed Effects",     align=TRUE,apply.coef=or
          ,out = "path.tex", covariate.labels=covlabel,omit="firms",
          omit.labels="Firms", omit.yes.no=c("Yes","No"))
    

Upvotes: 1

Views: 537

Answers (2)

Grant
Grant

Reputation: 1626

My approach when faced with this problem is to first convert the *lm object to a "coeftest" class using the lmtest package. For more details, see my answer to a related question here.

Upvotes: 1

Maxim.K
Maxim.K

Reputation: 4180

As per stargazer manual, it does not support the packages you mention at the time of this writing. As for other options, I would first try running the analysis with the stock lm(). If it does not lead to RAM-related problems, you'll have a choice to make between the speed of estimation and the ease of formatting your table.

You might also choose to contact the developer, asking to add bigglm and speedglm to the feature wish list.

Upvotes: 0

Related Questions