2

The below code perfectly provides my gmm estimates for 216 rolling windows.

    gmm_list <-  lapply(1:(length(ALLX$DE)-24), function(i) {
  tmp <- ALLX[i:(i+23),]
  DE <- as.matrix(as.numeric(tmp$DE))
  p <- nrow(DE) 
  rmrf_local <- as.matrix(as.numeric(tmp$rmrf_local))
  SMB_L <- as.matrix(as.numeric(tmp$SMB_L))
  HML_L <- as.matrix(as.numeric(tmp$HML_L))
  MOM_L <- as.matrix(as.numeric(tmp$MOM_L))
  bond_L <- as.matrix(as.numeric(tmp$bond_L))
  h <- cbind(rmrf_local,SMB_L,HML_L,MOM_L,bond_L)
  gmm(DE ~ rmrf_local+SMB_L+HML_L+bond_L, x=h)
})

I'm able to extract the coef (estimate, SE, t_value and P_value) with

lapply(gmm_list, function(x) coef(summary(x))[,1:4])

However, i am unable to extract the adj.Rsquared.

I used the code below but i have NULL, and any idea??

> sapply(gmm_list, function(x) summary(x) $r.squared)
  NULL
zx8754
  • 52,746
  • 12
  • 114
  • 209
Enrico Dace
  • 115
  • 10
  • @Parfait Any idea? – Enrico Dace Jun 05 '18 at 12:39
  • @ theforestecologist Any comments please? – Enrico Dace Jun 05 '18 at 13:15
  • There is no reported R-squared for gmm objects. See yourself `summary.gmm(gmm_list[[1]])`. – Parfait Jun 05 '18 at 14:16
  • @Parfait Do you think, if there could be a way to compute manually (R2)? I have seen a stackoverflow post, that tried to compute a standard error of a regression manually with a self made codes. Any idea? – Enrico Dace Jun 06 '18 at 12:09
  • You might use a "Pseudo R2". For OLS-estimated models with intercept, R2 can be calculated as R2 = cor(y_observed, y_fitted)^2 .... BTW, that's where the name R2 comes from. In gmm, R2 is not reported as Total Sum of Squares \neq Explained SS + Residual SS. However, the squared correlation between observed and fitted dep_var can be calculated and reported (one should point out what is being reported). – Tomas May 20 '22 at 12:03

0 Answers0