[R-sig-eco] Problem with "fun=predict.se" for stand. errors from "Tps"

Robert J. Hijmans r.hijmans at gmail.com
Wed Aug 18 19:52:13 CEST 2010


Dear Jaime,

The example in the help file for interpolate does exactly that, and it
works for me. My guess is that you need to update the 'raster' package
to a more recent version, as the 'fun=' argument is a relatively
recent addition. Perhaps you ran the script on a different computer
with a different version of 'raster'?

As for question #2, this is wrong:
Raster2 <- interpolate(Elevacion, Slope, Eva2, xyOnly=FALSE)

it should be something like:

s <- stack(Elevacion, Slope)
Raster2 <- interpolate(s, Eva2, xyOnly=FALSE)

Robert

2010/8/18 Jaime Burbano Girón <jaimebg27 at gmail.com>:
> Hi to everybody. Few weeks ago I performed successfully a Thin plate spline
> regression ("Tps" function from fields package) following instructions given
> in this forum by professor Robert J. Hijmans.
>
> In that moment I calculated successfully the standard errors for the Tps
> predictions using the option fun=predict.se from "interpolate" function in
> raster package. I ran this procedure following this code:
>
> Datos <-
> read.table("F:/Especies_Invasoras/Evaporacion/evaporacion_sabana.txt",
> header=T, sep="\t", na.strings="NA", dec=".", strip.white=TRUE)
> Eva2 <- Tps(Datos[,17:19], Datos$Anual) # X,Y and Elevation as independent
> variables for predict annual evaporation values
> Elevacion <- raster("F:/Especies_Invasoras/Evaporacion/altura.asc") # ascii
> grid of elevation values projected onto the desired area
> Raster2 <- interpolate(Elevacion, Eva2, xyOnly=FALSE)
> RasterSe2 <- interpolate(Elevacion, Eva2, xyOnly=FALSE, fun=predict.se)
>
> I´ve tried to repeat this procedure in this moment but I can´t obtain the
> standard errors from predictions. When I run the last line code I obtain the
> same values for Tps predictions ran in penultimate line code. It seems to be
> that now the option "fun=predict.se" is not being recognized. I work under
> Rx64 version 2.11.1 and raster package version 1.2-6.
>
> Additionally I have a question about the code when I include an other
> independent variable like slope for example. I think the code should be
> something like:
>
>  Datos <-
> read.table("F:/Especies_Invasoras/Evaporacion/evaporacion_sabana.txt",
> header=T, sep="\t", na.strings="NA", dec=".", strip.white=TRUE)
> Eva2 <- Tps(Datos[,17:20], Datos$Anual) # X,Y, Slope and Elevation as
> independent variables for predict annual evaporation values
> Elevacion <- raster("F:/Especies_Invasoras/Evaporacion/altura.asc") # ascii
> grid of elevation values projected onto the desired area
> Slope <- raster("F:/Especies_Invasoras/Evaporacion/slope.asc") # ascii grid
> of slope values projected onto the desired area
> Raster2 <- interpolate(Elevacion, Slope, Eva2, xyOnly=FALSE)
> RasterSe2 <- interpolate(Elevacion, Slope, Eva2, xyOnly=FALSE, fun=
> predict.se)
>
> but "interpolate" function presents this error: "Error in model$terms : $
> operator not defined for this S4 class"
>
> I appreciate your help. Best regards for every body.
>
> --
> Jaime Burbano Girón
> Departamento de Ecología y Territorio
> Pontificia Universidad Javeriana
> Bogotá - Colombia
> 3208320 Ext. 4839 - 3168573713
>
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
>



More information about the R-sig-ecology mailing list