[R-sig-Geo] Sampling from a SAR error model
Roger Bivand
Roger.Bivand at nhh.no
Sat Sep 16 00:09:28 CEST 2006
On Fri, 15 Sep 2006, Sam Field wrote:
> 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
>
Interesting question. Where is the sigma^2 going in your case - is it in
the generation of e? Could you try to use the columbus dataset and
set.seed to generate a reproducible example - it may be that what you have
written does not communicate exactly what you have done?
Roger
>
> 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!
>
>
>
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list