[R-sig-Geo] Re: AI-GEOSTATS: Interpretation of rho and its control in Splus

Roger Bivand Roger.Bivand at nhh.no
Fri Oct 24 21:19:50 CEST 2003


On Fri, 24 Oct 2003, Volker Bahn wrote:

> 
> | On Wed, 22 Oct 2003, Volker Bahn wrote:
> |
> | > Dear Roger,
> | >
> | > thanks for your tips. I will check Haining. Concerning your latter
> comment:
> | > |
> | > | Perhaps just fit lm(), AIC should be OK, as should the likelihood
> ratio
> | > | test. I don't have access to the software, so I'm generalising from
> how
> | > | similar classes work in R.
> | >
> | > I initially fit my "null" model in lm() but the resulting log-lik was so
> | > different from the corresponding slm() log-lik that a comparsion was not
> | > possible. I figured that this must be because of the different
> optimisation
> | > processes in lm() and slm().
> |
> | I wouldn't think so - the basic R logic in logLik.lm() is:
> |
> |     val <- 0.5 * (sum(log(w)) - N * (log(2 * pi) + 1 - log(N) +
> |         log(sum(w * res^2))))
> |
> | where w is a vector of 1's if there are no weights. val is adjusted for
> | REML estimators, but otherwise is as you would expect. Maybe simply the
> | slm() is a much better fit?
> |
> 
> This is starting to be out of my league - I don't really know or understand
> the formula or its consequences. What I do know, though, is that my loglik
> of "null" models calculated with lm() was actually around 0 while the loglik
> of the equivalent slm() model was around -2000 suggesting that the slm() was
> way worse. I then used the following formula to calculate the loglik of
> slm() myself from the RSE, but, as I learned later, this formula really only
> applies to OLS regressions:
> 
> Loglik = (-n / 2) * LN(RSE^2 * df / n) - (n / 2) * LN(2*PI()) - (n / 2)
> 
> The results were pretty credible, though: The slm() were just about as much
> better than the corresponding lm() as I had expected. My next line of attack
> was to set the spatial coefficient rho or just "parameter" as it is called
> in Splus to 0 to get a comparable loglik for the non-spatial model. I
> accomplished
> this indirectly through a likelihood ratio test (lrt.slm), which allows me
> to control the parameter settings for the reduced model. However, I would
> prefer to be able to do this directly so that I can see whether the
> resulting model is really similar in coefficients and all to an lm model.
> Looking through the help files didn't show me an obvious way to accomplish
> this and looking through the functions themselves is just a little bit over
> my head. If you would happen to know how to control the spatial parameter in
> slm() or would have other suggestions I would appreciate to know.

Since I don't have access to S-PLUS myself, I don't think I can see how to 
help. Does anyone have access to SpatialStats and feel able to help (CC-ed 
to r-sig-geo)? I'm pretty uncomfortable with your logLik by hand, because 
the Jacobian seems to be omitted, is that correct?

Roger

> 
> Cheers
> 
> Volker
> 
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list