fit.FDAimage: Fitting multivariate spline image-on-scalar regression models

Description Usage Arguments Details Value Examples

View source: R/fit.FDAimage.R

Description

This function is used to fit the multivariate spline image-on-scalar regression models.

Usage

1
fit.FDAimage(Y, X, Z, V, Tr, d = 5, r = 1, lambda = 0.1)

Arguments

Y

The response images of dimension n by npix, where n is the number of observed images and npix is the number of pixels/voxels in each image. Each row is an observation of the images.

X

The design matrix of dimension n by p, with an intercept. Each row is an observation vector.

Z

The cooridinates of dimension npix by two. Each row is the coordinates of a pixel/voxel.

V

The N by two matrix of vertices of a triangulation, where N is the number of vertices. Each row is the coordinates for a vertex.

Tr

The triangulation matrix of dimention nT by three, where nT is the number of triangles in the triangulation. Each row is the indices of vertices in V.

d

The degree of piecewise polynomials – default is 5, and -1 represents piecewise constant.

r

The smoothness parameter – default is 1, and 0 r < d.

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.

Details

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.

Value

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.

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
# 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)

funstatpackages/FDAimage documentation built on Oct. 11, 2019, 12:50 p.m.