[R-sig-Geo] Bug in surf.ls (spatial package)?
Gabor Grothendieck
ggrothendieck at gmail.com
Tue Apr 10 15:59:23 CEST 2007
They are using different coefficient parameterizations but the models
are otherwise
the same. For example, they give the same fitted values:
> all.equal(fitted(surface.surf), as.vector(fitted(surface.lm)))
[1] TRUE
On 4/10/07, ONKELINX, Thierry <Thierry.ONKELINX at inbo.be> wrote:
> Dear listers,
>
> When fitting a trend surface I noticed that surf.ls() generates other
> values for the model parameters than an ordinary lm(). Since both fit,
> in my opinion, the same model to the same data. So I would suppect that
> both would generate the same parameter values. Or am I missing
> something?
>
> Some sample code.
>
> library("gstat")
> data(jura)
> library("spatial")
> surface.surf <- surf.ls(np = 1, x = prediction.dat$Xloc, y =
> prediction.dat$Yloc, z = prediction.dat$Ni)
> surface.lm <- lm(Ni ~ Xloc + Yloc, data = prediction.dat)
> surface.surf$beta
>
> [1] 18.828803 4.823595 -2.375896
>
> surface.lm$coef
>
> (Intercept) Xloc Yloc
> 15.5140337 2.2466673 -0.9299007
>
> Thanks,
>
> Thierry
>
> ------------------------------------------------------------------------
> ----
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature
> and Forest
> Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
> methodology and quality assurance
> Gaverstraat 4
> 9500 Geraardsbergen
> Belgium
> tel. + 32 54/436 185
> Thierry.Onkelinx at inbo.be
> www.inbo.be
>
> Do not put your faith in what statistics say until you have carefully
> considered what they do not say. ~William W. Watt
> A statistical analysis, properly conducted, is a delicate dissection of
> uncertainties, a surgery of suppositions. ~M.J.Moroney
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
More information about the R-sig-Geo
mailing list