Description Usage Arguments Value References Examples
View source: R/Package_HAC_RAC_SHAC.r
Given a B-spline basis, transfer parameters (mean, variance, skewness) to the corresponding coefficients, and vice versa.
1 2 |
cp.list |
list of parameters with names to be |
Basis.list |
list of basis matrices for the mean, variance and skewness |
vec.beta |
vector of coefficients |
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
[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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.