List, I am having trouble writing a script that samples from an SAR error process. I've done it successfully for a spatial lag model, but not for the spatial error model. For the spatial lag model, I have the following:
y_lag <- (solve(diag(100)- p*w))%*%X_mat%*%parms + solve(diag(100)-p*w)%*%e where parms is a parameter vector X_mat is n by p matrix of independent variables (+ constant) e is a vector of indepndent normal deviates (mean = 0) p is the autoregressive paramter and w is a square, n by n contiguity matrix (row normalized). This works beautifully. lagsarlm recovers parms and p without a problem. Over repeated sampling, the estimated values are centered on the value for p in the simulation. Is there something wrong with the following for the spatial error model? y_error <- X_mat%*%parms + (solve(diag(100)-p*w))%*%e The distribution of values for p obtain from errorsarlm over repeated sampling are not centered around the value for the simulation, but are typically much lower and all over the place. I have only looked at values for p ranging from .3 to .7. any help would be greatly appreciated! -- Samuel H. Field, Ph.D. Associate Research Scholar Institute for Social and Economic Research and Policy (ISERP) Columbia University 420 W. 118th Street Mail code 3355 New York, NY 10027 215-731-0106 _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo