predict0 | R Documentation |
This function predicts explained variables using eigenvector spatial filtering (ESF) or random effects ESF. The Nystrom extension is used to perform a prediction minimizing the expected prediction error
predict0( mod, meig0, x0 = NULL, xgroup0 = NULL, offset0 = NULL,
weight0 = NULL, compute_se=FALSE, compute_quantile = FALSE )
mod |
Output from |
meig0 |
Moran eigenvectors at predicted sites. Output from |
x0 |
Matrix of explanatory variables at predicted sites (N_0 x K). Default is NULL |
xgroup0 |
Matrix of group IDs that may be group IDs (integers) or group names (N_0 x K_group). Default is NULL |
offset0 |
Vector of offset variables at predicted sites (N_0 x 1). Effective if y is count (see |
weight0 |
Vector of weights for predicted sites (N_0 x 1). Required if compute_se = TRUE or compute_quantile = TRUE |
compute_se |
If TRUE, predictive standard error is evaulated. It is currently supported only for continuous variables. If nongauss is specified in mod, standard error for the transformed y is evaluated. Default is FALSE |
compute_quantile |
If TRUE, Matrix of the quantiles for the predicted values (N x 15) is evaulated. It is currently supported only for continuous variables. Default is FALSE |
pred |
Matrix with the first column for the predicted values (pred). The second and the third columns are the predicted trend component (xb) and the residual spatial process (sf_residual). If xgroup0 is specified, the fourth column is the predicted group effects (group). If tr_num > 0 or tr_nonneg ==TRUE (i.e., y is transformed) in |
pred_quantile |
Effective if compute_quantile = TRUE. Matrix of the quantiles for the predicted values (N x 15). It is useful to evaluate uncertainty in the predictive value |
c_vc |
Matrix of estimated non-spatially varying coefficients (NVCs) on x0 (N x K). Effective if nvc =TRUE in |
cse_vc |
Matrix of standard errors for the NVCs on x0 (N x K).Effective if nvc =TRUE in |
ct_vc |
Matrix of t-values for the NVCs on x0 (N x K). Effective if nvc =TRUE in |
cp_vc |
Matrix of p-values for the NVCs on x0 (N x K). Effective if nvc =TRUE in |
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.
meigen0
, predict0_vc
require(spdep)
data(boston)
samp <- sample( dim( boston.c )[ 1 ], 400)
d <- boston.c[ samp, ] ## Data at observed sites
y <- d[, "CMEDV"]
x <- d[,c("ZN","INDUS", "NOX","RM", "AGE", "DIS")]
coords <- d[,c("LON", "LAT")]
d0 <- boston.c[-samp, ] ## Data at unobserved sites
y0 <- d0[, "CMEDV"]
x0 <- d0[,c("ZN","INDUS", "NOX","RM", "AGE", "DIS")]
coords0 <- d0[,c("LON", "LAT")]
############ 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$pred[1:10,]
######################## If NVCs are assumed
#mod2 <- resf(y=y, x=x, meig=meig, nvc=TRUE)
#pred02 <- predict0( mod = mod2, x0 = x0, meig0 = meig0 )
#pred02$pred[1:10,] # Predicted explained variables
#pred02$c_vc[1:10,] # Predicted NVCs
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.