Description Usage Arguments Details Value Examples
This function is used to fit the multivariate spline image-on-scalar regression models.
1 | fit.FDAimage(Y, X, Z, V, Tr, d = 5, r = 1, lambda = 0.1)
|
Y |
The response images of dimension |
X |
The design matrix of dimension |
Z |
The cooridinates of dimension |
V |
The |
Tr |
The triangulation matrix of dimention |
d |
The degree of piecewise polynomials – default is 5, and -1 represents piecewise constant.
|
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.
|
This R package is the implementation program for manuscript entitled "Multivariate Spline Estimation and Inference for Image-on-Scalar Regression" by Shan Yu, Guannan Wang, Li Wang and Lijian Yang.
An object with S3 class "FDAimage", including
beta |
The estimated coefficient functions. |
Yhat |
The estimated images. |
sse |
Sum of squared errors. |
df |
Effective degree of freedom. |
gcv |
Generalized cross-validation (GCV). |
lamc |
Selected tuning parameter for bivariate penalized spline based on GCV. |
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 | # Libraries and source files needed
library(devtools)
install_github("funstatpackages/BPST")
library(BPST)
install_github("funstatpackages/Triangulation")
library(Triangulation)
# Location information
n1=95; n2=79;
u1=seq(0,1,length.out=n1)
v1=seq(0,1,length.out=n2)
uu=rep(u1,each=n2)
vv=rep(v1,times=n1)
uu.mtx=matrix(uu,n2,n1)
vv.mtx=matrix(vv,n2,n1)
Z=as.matrix(cbind(uu,vv))
# Parameters
d=5; r=1; rho=0.5; nfold=10; alpha0=0.05;
# Triangulation
data(V1); data(Tr1); # triangulation_1 in the paper;
# data(brain_boundary); # brain imaging boundary of slide 48;
V=V1; Tr=Tr1;
ind=inVT(V,Tr,Z[,1],Z[,2])
ind.inside=ind$ind.inside; ind=ind$ind;
n=50; sigma=0.5; lambda1=0.03; lambda2=0.006;
dat=data.FDAimage(n,Z,ind.inside,sigma,rho,2019,lambda1,lambda2)
Y=dat$Y; X=dat$X; Z=dat$Z;
Y=Y[,ind.inside] # remove the points which are outside the boundary;
lambda=10^(seq(-6,6,by=1))
cv=cv.FDAimage(Y,X,Z,V,Tr,d,r,lambda,nfold)
lamc=cv$lamc
mfit0=fit.FDAimage(Y,X,Z,V,Tr,d,r,lamc)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.