1
votes

I have several regression models using plm and pooling. My data is a pooled cross sectional / time series data, with data on bond issuances. The data consists of observations of around 2000 bond issuances, with around 25 bond-descriptive variables.

I want to calculate the robust standard errors for one or all of the regression models, in order to add it in my stargazer visualization. My regressions are as follows:

#Regression    
primaryreg4 <- plm(issueyield ~ issuer + exchange + yearmonth + maturity.cat + size.cat + coupontype, 
                   data = data, 
                   index = c("ID", "issuedate"), 
                   model = "pooling") 

All the variables are fixed effects (FE), so they are dummy variables. I want to calculate the robust standard errors of this model, and add it to stargazer. The code I have tried in order to calculate the standard errors is:

cov.r4 <- vcovHC(primaryreg4, type = "HC3")
robust_se_r4 <- sqrt(diag(cov.r4))

# or (it is the same)

robust_se_r4 <- sqrt(diag(vcovHC(primaryreg4, type = "HC3")))

I would then specify the standard errors in stargazer to be robust_se_r. However, i get this error message:

Error: cannot allocate vector of size 15.8 Gb

Does anyone know how to solve this? I understand that it is a memory problem, but the file really should not be too big - my data is about 2000 observations of 25 variables (not too big!).

1
Can you make the data available somewhere? Or provide a self-contained reproducible example?Helix123

1 Answers

0
votes

Your code is running on minimal panel data:

library("plm")
data("Produc", package = "plm")

# Regression    
model <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
          data = Produc, 
          index = c("state","year"),
          method="pooling")

# Robust Standard Errors
robust_se <- sqrt(diag(vcovHC(model, type = "HC3")))

Can you describe your variable more in detail? What categories does maturity and size have? Try glimpse from dplyr to check the data type and format of each variable.