Description Usage Arguments Details Value Examples
fit.gsvcm
fits the generalized spatially varying coeffcient models.
1 2 3 |
y |
The response of dimension |
X |
The design matrix of dimension |
S |
The cooridinates of dimension |
V |
The |
Tr |
The triangulation matrix of dimention |
d |
The degree of piecewise polynomials – default is 2.
|
r |
The smoothness parameter – default is 1, and 0 ≤ |
lambda |
The vector of the candidates of penalty parameter – default is grid points of 10 to the power of a sequence from -6 to 6 by 0.5.
|
family |
The family object, specifying the distribution and link to use.
|
off |
offset – default is 0.
|
r.theta |
The endpoints of an interval to search for an additional parameter |
eps.sigma |
Error tolerance for the Pearson estimate of the scale parameter, which is as close as possible to 1, when estimating an additional parameter |
method |
GSVCM or GSVCMQR. GSVCM is based on Algorithm 1 in Subsection 3.1 and GSVCMQR is based on Algorithm 2 in Subsection 3.2 – default is GSVCM.
|
Cp |
TRUE or FALSE. There are two modified measures based on the QRGSVCM method for smoothness parameters in the manuscript. TRUE is for Cp measure and FALSE is for GCV measure.
|
This R package is the implementation program for manuscript entitled "Generalized Spatially Varying Coefficinet Models" by Myungjin Kim and Li Wang.
The function returns an object with S3 class "gsvcm" with the following items:
beta |
The estimated coefficient functions. |
theta_hat |
The estimated spline coefficient functions. |
lambdac |
Selected tuning (penalty) parameter for bivariate penalized spline based on GCV. |
gcv |
Generalized cross-validation (GCV). |
df |
Effective degree of freedom. |
theta |
The estimated additional parameter for a negative binomial random component. |
V |
The |
Tr |
The triangulation matrix of dimention |
d |
The degree of piecewise polynomials |
r |
The smoothness parameter |
B |
The spline basis function of dimension |
Q2 |
The Q2 matrix after QR decomposition of the smoothness matrix |
K |
The thin-plate energy function. |
ind.inside |
A vector contains the indexes of all the points which are inside the triangulation. |
tria.all |
The area of each triangle within the given triangulation. |
X |
The design matrix of dimension |
y |
The response of dimension |
S |
The cooridinates of dimension |
family |
The family object |
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 | family=poisson()
ngrid = 0.05
# Data generation:
all_pop = as.matrix(Datagenerator(family, ngrid))
pop.r=all_pop[!is.na(all_pop[,'m1']),]
N=nrow(pop.r)
# Triangulations and setup:
Tr = Tr0_horse; V = V0_horse; n = 1000; d = 2; r = 1
# set up for smoothing parameters in the penalty term:
lambda_start=0.0001; lambda_end=10; nlambda=10
lambda=exp(seq(log(lambda_start),log(lambda_end),length.out=nlambda))
# Generate Sample:
ind.s=sample(N,n,replace=FALSE)
data=as.matrix(pop.r[ind.s,])
y=data[,1]; beta0=data[,c(2:3)]; X=data[,c(4:5)]; S=data[,c(6:7)]
# Fit the model:
mfit0 = fit.gsvcm(y, X, S, V, Tr, d, r, lambda, family)
# Prediction:
y_hat = predict(mfit0, X, S)
# 10 Crossvalidation:
MSPE = cv.gsvcm(y, X, S, V, Tr, d = d, r = r, lambda, family, off = 0, r.theta = c(4, 8), nfold = 10)
# GQLR Test:
test.gsvcm(y, X, S, V, Tr, d, r, lambda, test_iter = 1, family = family, nB = 20)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.