Following the code below, I am able to estimate a rolling gmm function.
gmm_list_IM <- lapply(1:(length(ALLX$IM)-24), function(i) {
tmp <- ALLX[i:(i+23),]
IM <- as.matrix(as.numeric(tmp$IM))
p <- nrow(IM)
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(IM ~ rmrf_local+SMB_L+HML_L+MOM_L+bond_L, x=h)
})
Need to compute a VIF to detect for a multicollinearity with the following error.
vif(gmm_list_IM) Error in vcov.default(mod) : there is no vcov() method for models of class list In addition: Warning message: In is.na(coef(mod)) : is.na() applied to non-(list or vector) of type 'NULL' Any idea, please?