Learn R Programming

spmoran (version 0.1.5)

resf_vc: Spatially varying coefficient modeling with automatic coefficient selection

Description

This function estimates a spatially varying coefficient model based on the random effects eigenvector spatial filtering (RE-ESF) approach. Spatially varying coefficients are selected to stablize the estimates.

Usage

resf_vc(y, x, xconst=NULL, meig, method="reml",
        penalty="bic", maxiter=30, sizelimit=2000 )

Arguments

y

Vector of explained variables (\(N\) x 1)

x

Matrix of explanatory variables whose coefficients are allowed to vary across geographical space (\(N\) x \(k\)). Default is NULL

xconst

Matrix of explanatory variables whose coefficients are assumed constant across space (\(N\) x \(K_const\)). Default is NULL

meig

Moran's eigenvectors and eigenvalues. Output from meigen or meigen_f

method

Estimation method. Restricted maximum likelihood method ("reml") and maximum likelihood method ("ml") are available. Default is "reml"

penalty

Penalty to select varying coefficients and stablize the estimates. The current options are "bic" for the Baysian information criterion-type penalty (\(N\) x \(log(K)\)) and "aic" for the Akaike information criterion (\(2N\)) (see Muller et al., 2013). Default is "bic"

maxiter

Maximum number of iterations. Default is 30

sizelimit

Maximum size of matrix being inverted. Roughly speaking, this value contraints \(K\) + \(KL\), where \(K\) and \(L\) are the numbers of the explanatory variables and eigen-pairs, respectively. If \(K\) + \(KL\) exceeds sizelimit, \(L\) is reduced to fullfill the contraint. Default is 2000

Value

b

Matrix with columns for the estimated coefficients on \(xconst\), their standard errors, t-values, and p-values (\(K_const\) x 4)

s

Matrix of estimated shrinkage parameters (2 x \(K\)). The (1, \(k\))-th element denotes the standard error of the \(k\)-th SVCs, while the (2, \(k\))-th element denotes the spatial scale of the same SVCs (see Murakami et al., 2016)

e

Vector whose elements are residual standard error (resid_SE), adjusted conditional R2 (adjR2(cond)), restricted log-likelihood (rlogLik), Akaike information criterion (AIC), and Bayesian information criterion (BIC). When method = "ml", restricted log-likelihood (rlogLik) is replaced with log-likelihood (logLik)

b_vc

Matrix of estimated spatially varying coefficients (SVCs) on \(x\) (\(N\) x \(K\))

bse_vc

Matrix of estimated standard errors for the SVCs (\(N\) x \(k\))

t_vc

Matrix of estimated t-values for the SVCs (\(N\) x \(K\))

p_vc

Matrix of estimated p-values for the SVCs (\(N\) x \(K\))

pred

Vector of predicted values (\(N\) x 1)

resid

Vector of residuals (\(N\) x 1)

vc

Vector indicating whether spatial variations are found or not from each coefficients (\(K\) x 1)

other

List of other outcomes, which are internally used

References

Muller, S., Scealy, J.L., and Welsh, A.H. (2013) Model selection in linear mixed models. Statistical Science, 28 (2), 136-167.

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

resf

Examples

Run this code
# NOT RUN {
require(spdep)
data(boston)
y	    <- boston.c[, "CMEDV"]
x     <- boston.c[,c("ZN", "INDUS" ,"LSTAT")]
xconst<- boston.c[,c("CRIM", "NOX", "CHAS", "AGE", "DIS", "RAD", "TAX", "PTRATIO", "B", "RM" )]
coords<- boston.c[,c("LAT","LON")]

meig 	<- meigen(coords=coords)
# meig_f 	<- meigen_f(coords=coords)  ## for fast computation

res	  <- resf_vc(y=y,x=x,xconst=xconst,meig=meig)
res$b
res$s
res$e

res$vc
res$b_vc[1:10,]
res$bse_vc[1:10,]
res$t_vc[1:10,]
res$p_vc[1:10,]

###Plot the first SVC (INDUS)
#
#require(ggplot2)
#ggplot(mapping = aes(x = coords$LON, y = coords$LAT)) +
#  geom_point(aes(colour = res$b_vc[,3])) +
#  scale_color_gradientn(colours=rev(rainbow(4)))
# }

Run the code above in your browser using DataLab