Hi, My question is about NAs in the function "gmm", but I believe that the same issues occur in the case of "lm".
I try to estimate a model by "gmm" function (GMM, generalized method of moments). Each of the variables has 94 rows, but the resulting fitted model has only 89 rows. Then the function removes the rows with NAs. I want to add a 94*1 vector, ONI, to the resulting fitted values; I want to find the fitted value with NAs kept. How can I do it? na.action? Code: > gmm8<-gmm(y~RDR1+xx, xiv) Warning message: In getDat(object$g, object$x) : There are missing values. Associated observations have been removed > ONI.gmm8<-fitted(gmm8)+0.85*ONI Error in NextMethod(.Generic) : dims [product 89] do not match the length of object [94] In addition: Warning message: In `+.default`(fitted(gmm8), 0.85 * ONI) : longer object length is not a multiple of shorter object length Help on na.action: na.action a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options, and is na.fail if that is unset. The ‘factory-fresh’ default is na.omit. Another possible value is NULL, no action. Value na.exclude can be useful. Thanks! Miao [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.