[R-sig-Geo] TPS with linear predictors

Cristian Montes cmontes at arauco.cl
Thu Mar 7 16:29:00 CET 2013


Hello,

I am trying to add linear predictions to my thinn-plate spline model. 
Fitting the model works fine, however I don´t get to produce a map
afterwards.  Any ideas?

Cristián

library(RODBC)    
library(sp)       
library(rgdal)    
library(fields)   
library(maptools) 
library(raster)


#The following is my database for model fitting
my_file <- odbcConnectExcel2007("PTOS_FIN2_mat.xlsx")
data   <- sqlFetch(my_file, "PTOS_FIN2_mat")
close(my_file)

coordinates(data) <- c("X_COORD", "Y_COORD")

data.tp            <- Tps( coordinates(data),
                                            data$IS_W,
                                            Z = c(mpar = data$M_PARENTAL),  
                                            scale.type = "unscaled")

#Eventually I could add more than one linear predictor using cbind as in
Z=cbind(mpar=data$M_PARENTAL, clay = data$M_ARCILLA)



#Now I read the grids from Hdrive.
my_matpar   <- readGDAL("mat_par1.tif")

#Transform them to lists to get each vector for interpolation
my_matpar <- as.image.SpatialGridDataFrame(my_matpar)

data.predicho      <- predict.surface(data.tp, grid.list = list(X_COORD =
my_matpar$x,
                                                                Y_COORD =
my_matpar$y),  Z= my_matpar$z)


However this last line doesn´t work.



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/TPS-with-linear-predictors-tp7583004.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list