cp2beta: Transformation between Parameters and B-spline Coefficients

Description Usage Arguments Value References Examples

View source: R/Package_HAC_RAC_SHAC.r

Description

Given a B-spline basis, transfer parameters (mean, variance, skewness) to the corresponding coefficients, and vice versa.

Usage

1
2
cp2beta(cp.list, Basis.list)
beta2cp(vec.beta, Basis.list)

Arguments

cp.list

list of parameters with names to be (mean, var, skew) corresponding to (mean, variance, skew)

Basis.list

list of basis matrices for the mean, variance and skewness

vec.beta

vector of coefficients

Value

cp2beta returns a vector of coefficients with the same form of vec.beta; beta2cp returns a list of parameters with the same form of cp.list

References

[1]. Meng Li, Ana-Maria Staicu and Howard D. Bondell (2013), Incorporating Covariates in Skewed Functional Data Models. http://www.stat.ncsu.edu/information/library/papers/mimeo2654_Li.pdf.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(data.simulation)
# bivariate for mean and variance; univariate for shape parameter
cases = c(2,2,1)   
# 2 knots at time direction for each parameter
nknots.tp = c(2,2,2) 
# 2 knots at covariate direction for mean and variance
nknots.cp = c(2,2)   
basis.list <- lapply(1:3, function(k) 
  kpbb(DST$tp, DST$cp, nknots.tp = nknots.tp[k],
       nknots.cp= nknots.cp[k], sub.case=cases[k]))
cp.hat <- DST$pars # true parameters 
cp.hat$var <- exp(cp.hat$logvar) # follow the fomart stricely: (mean, var, skew)
beta <- cp2beta(cp.hat, basis.list)
cp.recover <- beta2cp(beta, basis.list)
norm(cp.hat$mean - cp.recover$mean) 

cSFM documentation built on May 29, 2017, 6:10 p.m.

Related to cp2beta in cSFM...