predict0_vc: Spatial predictions for explained variables and spatially...

Description Usage Arguments Value References See Also Examples

View source: R/predict0_vc.R

Description

This function predicts explained variables and spatially and non-spatially varying coefficients. The Nystrom extension is used to perform a prediction minimizing the expected prediction error

Usage

1
2
predict0_vc( mod, meig0, x0 = NULL, xgroup0 = NULL, xconst0 = NULL,
             offset0 = NULL, weight0 = NULL, compute_quantile = FALSE )

Arguments

mod

Output from resf_vc or besf_vc

meig0

Moran eigenvectors at predicted sites. Output from meigen0

x0

Matrix of explanatory variables at predicted sites whose coefficients are allowed to vary across geographical space (N_0 x K). Default is NULL

xgroup0

Matrix of group indeces that may be group IDs (integers) or group names (N_0 x K_group). Default is NULL

xconst0

Matrix of explanatory variables at predicted sites whose coefficients are assumed constant (or NVC) across space (N_0 x K_const). Default is NULL

offset0

Vector of offset variables at predicted sites (N x 1). Available if y is count (see nongauss_y). Default is NULL

weight0

Vector of weights for predicted sites (N_0 x 1). Required if compute_quantile = TRUE

compute_quantile

If TRUE, Matrix of the quantiles for the predicted values (N x 15) is evaulated. Default is FALSE

Value

pred

Matrix with the first column for the predicted values (pred). The second and the third columns are the predicted trend component (i.e., component explained by x0 and xconst0) (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 resf_vc, another column including the predicted values in the transformed/normalized scale (pred_trans) is inserted into the second column

b_vc

Matrix of estimated spatially (and non-spatially) varying coefficients (S(N)VCs) on x0 (N_0 x K)

bse_vc

Matrix of estimated standard errors for the S(N)VCs (N_0 x K)

t_vc

Matrix of estimated t-values for the S(N)VCs (N_0 x K)

p_vc

Matrix of estimated p-values for the S(N)VCs (N_0 x K)

c_vc

Matrix of estimated non-spatially varying coefficients (NVCs) on xconst0 (N_0 x K)

cse_vc

Matrix of estimated standard errors for the NVCs (N_0 x K)

ct_vc

Matrix of estimated t-values for the NVCs (N_0 x K)

cp_vc

Matrix of estimated p-values for the NVCs (N_0 x K)

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.

Murakami, D., Yoshida, T., Seya, H., Griffith, D.A., and Yamagata, Y. (2017) A Moran coefficient-based mixed effects approach to investigate spatially varying relationships. Spatial Statistics, 19, 68-89.

See Also

meigen0, predict0

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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", "LSTAT")]
xconst  <- d[,c("CRIM", "NOX", "AGE", "DIS", "RAD", "TAX", "PTRATIO", "B", "RM")]
coords  <- d[,c("LON", "LAT")]

d0      <- boston.c[-samp, ]    ## Data at unobserved sites
x0      <- d0[,c("ZN", "LSTAT")]
xconst0 <- d0[,c("CRIM", "NOX", "AGE", "DIS", "RAD", "TAX", "PTRATIO", "B", "RM")]
coords0 <- d0[,c("LON", "LAT")]

############ Model estimation
meig 	  <- meigen( coords = coords )
mod	    <- resf_vc(y=y, x=x, xconst=xconst, meig=meig )

############ Spatial prediction of y and spatially varying coefficients
meig0 	<- meigen0( meig = meig, coords0 = coords0 )
pred0   <- predict0_vc( mod = mod, x0 = x0, xconst0=xconst0, meig0 = meig0 )

pred0$pred[1:10,]  # Predicted explained variables
pred0$b_vc[1:10,]  # Predicted SVCs
pred0$bse_vc[1:10,]# Predicted standard errors of the SVCs
pred0$t_vc[1:10,]  # Predicted t-values of the SNVCs
pred0$p_vc[1:10,]  # Predicted p-values of the SNVCs

############ or spatial prediction of spatially varying coefficients only
# pred00  <- predict0_vc( mod = mod, meig0 = meig0 )
# pred00$b_vc[1:10,]
# pred00$bse_vc[1:10,]
# pred00$t_vc[1:10,]
# pred00$p_vc[1:10,]

######################## If SNVCs are assumed on x
# mod2	   <- resf_vc(y=y, x=x, xconst=xconst, meig=meig, x_nvc=TRUE,xconst_nvc=TRUE )
# pred02  <- predict0_vc( mod = mod2, x0 = x0, xconst0=xconst0 ,meig0 = meig0 )
# pred02$pred[1:10,]  # Predicted explained variables
# pred02$b_vc[1:10,]  # Predicted SNVCs
# pred02$bse_vc[1:10,]# Predicted standard errors of the SNVCs
# pred02$t_vc[1:10,]  # Predicted t-values of the SNVCs
# pred02$p_vc[1:10,]  # Predicted p-values of the SNVCs

spmoran documentation built on Sept. 13, 2021, 9:07 a.m.

Related to predict0_vc in spmoran...