VCAM: Sieve estimation: B-spline based estimation procedure for...

View source: R/VCAM.R

VCAMR Documentation

Sieve estimation: B-spline based estimation procedure for time-varying additive models. The VCAM function can be used to perform function-to-scalar regression.

Description

Sieve estimation: B-spline based estimation procedure for time-varying additive models. The VCAM function can be used to perform function-to-scalar regression.

Usage

VCAM(Lt, Ly, X, optnAdd = list(), optnVc = list())

Arguments

Lt

An n-dimensional list of N_i-dimensional vectors whose elements consist of longitudinal time points for each i-th subject.

Ly

An n-dimensional list of N_i-dimensional vectors whose elements consist of longitudinal response observations of each i-subject corresponding to Lt.

X

An n by d matrix whose row vectors consist of covariate vector of additive components for each subject.

optnAdd

A list of options controls B-spline parameters for additive components, specified by list(name=value). See 'Details'.

optnVc

A list of options controls B-spline parameters for varying-coefficient components, specified by list(name=value). See 'Details'.

Details

VCAM provides a simple algorithm based on B-spline basis to estimate its nonparametric additive and varying-coefficient components.

Available control options for optnAdd are

nKnot

A d-dimensional vector which designates the number of knots for each additive component function estimation (default=10).

order

A d-dimensional vector which designates the order of B-spline basis for each additive component function estimation (default=3).

grid

A N by d matrix whose column vector consist of evaluation grid points for each component function estimation.

and control options for optnVc are

nKnot

A (d+1)-dimensional vector which designates the number of knots for overall mean function and each varying-coefficient component function estimation (default=10).

order

A (d+1)-dimensional vector which designates the order of B-spline basis for overall mean function and each varying-coefficient component function estimation (default=3).

grid

A M by (d+1) matrix whose column vectors consist of evaluation grid points for overall mean function and each varying-coefficient component function estimation.

Value

A list containing the following fields:

Lt

The same with input given by Lt

LyHat

Fitted values corresponding to Ly

phiEst

An N by d matrix whose column vectors consist of estimates for each additive component function evaluated at gridX.

beta0Est

An M-dimensional vector for overall mean function estimates evaluated at gridT.

betaEst

An M by d matrix whose column vectors consist of estimates for each varying-coefficient components evaluated at gridT.

gridX

The same with input given by optnAdd$grid

gridT

The same with input given by optnVc$grid

References

Zhang, X. and Wang, J.-L. (2015), "Varying-coefficient additive models for functional data", Biometrika, Vol.102, No.1, p.15-32.

Examples


library(MASS)

set.seed(100)

n <- 100
d <- 2

Lt <- list()
Ly <- list()

m <- rep(0,2)
S <- matrix(c(1,0.5,0.5,1),nrow=2,ncol=2)
X <- pnorm(mvrnorm(n,m,S))

beta0 <- function(t) 1.5*sin(3*pi*(t+0.5))
beta1 <- function(t) 3*(1-t)^2
beta2 <- function(t) 4*t^3

phi1 <- function(x) sin(2*pi*x)
phi2 <- function(x) 4*x^3-1

for (i in 1:n) {
  Ni <- sample(10:20,1)
  
  Lt[[i]] <- sort(runif(Ni,0,1))
  Ly[[i]] <- beta0(Lt[[i]]) + 
     beta1(Lt[[i]])*phi1(X[i,1]) + beta2(Lt[[i]])*phi2(X[i,2]) + rnorm(Ni,0,0.1)
  
}


vcam <- VCAM(Lt,Ly,X)

op <- par(no.readonly = TRUE)

par(mfrow=c(1,1))
plot(unlist(vcam$LyHat),unlist(Ly),xlab='observed Y',ylab='fitted Y')
abline(coef=c(0,1),col=8)

par(mfrow=c(1,2))
plot(vcam$gridX[,1],vcam$phiEst[,1],type='l',ylim=c(-1,1),xlab='x1',ylab='phi1')
points(vcam$gridX[,1],phi1(vcam$gridX[,1]),col=2,type='l',lty=2,lwd=2)
legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2))

plot(vcam$gridX[,2],vcam$phiEst[,2],type='l',ylim=c(-1,3),xlab='x2',ylab='phi2')
points(vcam$gridX[,2],phi2(vcam$gridX[,2]),col=2,type='l',lty=2,lwd=2)
legend('topleft',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2))

par(mfrow=c(1,3))
plot(vcam$gridT,vcam$beta0Est,type='l',xlab='t',ylab='beta0')
points(vcam$gridT,beta0(vcam$gridT),col=2,type='l',lty=2,lwd=2)
legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2))

plot(vcam$gridT,vcam$betaEst[,1],type='l',xlab='t',ylab='beta1')
points(vcam$gridT,beta1(vcam$gridT),col=2,type='l',lty=2,lwd=2)
legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2))

plot(vcam$gridT,vcam$betaEst[,2],type='l',xlab='t',ylab='beta2')
points(vcam$gridT,beta2(vcam$gridT),col=2,type='l',lty=2,lwd=2)
legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2))

par(op)


fdapace documentation built on July 3, 2024, 5:08 p.m.