Learn R Programming

spmoran (version 0.1.5)

predict0: Spatial prediction using eigenvector spatial filtering (ESF) or random effects ESF

Description

This function predicts explained variables using eigenvector spatial filtering (ESF) or random effects ESF. The Nystrom extension is used to minimize the expected prediction error

Usage

predict0( mod, meig0, x0 = NULL )

Arguments

mod

ESF or RE-ESF model estimates. Output from esf or resf

meig0

Moran's eigenvectors at predicted sites. Output from meigen0

x0

Matrix of explanatory variables at predicted sites (\(N_0\) x K). Default is NULL

Value

pred

Matrix with the first column for the predicted values. The second and the third columns are the trend component and the spatial component in the predicted values (\(N\) x 3)

References

Drineas, P. and Mahoney, M.W. (2005) On the Nystrom method for approximating a gram matrix for improved kernel-based learning. Journal of Machine Learning Research, 6 (2005), 2153-2175.

See Also

meigen0, predict0_vc

Examples

Run this code
# NOT RUN {
require(spdep)
data(boston)
samp    <- sample( dim( boston.c )[ 1 ], 300)

d       <- boston.c[ samp, ]  ## Data at observed sites
y	      <- d[, "CMEDV"]
x       <- d[,c("ZN","INDUS", "NOX","RM", "AGE", "DIS")]
coords  <- d[,c("LAT","LON")]

d0      <- boston.c[-samp, ]  ## Data at unobserved sites
x0      <- d0[,c("ZN","INDUS", "NOX","RM", "AGE", "DIS")]
coords0 <- d0[,c("LAT","LON")]

############ Model estimation
meig 	  <- meigen( coords = coords )
mod	    <- resf(y=y,x=x,meig=meig)
## or
# mod   <- esf(y=y,x=x,meig=meig)

############ Spatial prediction
meig0 	<- meigen0( meig = meig, coords0 = coords0 )
pred0   <- predict0( mod = mod, x0 = x0, meig0 = meig0 )
pred0[1:10,]
# }

Run the code above in your browser using DataLab