case2.unmll.optim: Negative loglikelihood function and the Gradient

Description Usage Arguments Details Value Note References See Also Examples

View source: R/Package_HAC_RAC_SHAC.r

Description

Calculate the negative loglikelihood function as the objective function to be minimize in terms of coefficients β's. The mean and variance parameters are bivariate, while the skewness parameter is univariate. The gradient is calculated by a closed form.

Usage

1
2
case2.unmll.optim(beta, dataone, Basis.list, cate = 1)
case2.gr(beta, dataone, Basis.list, cate = 1)

Arguments

beta

smoothing coefficients as a vector

dataone

observation as a matrix n by m (n: number of subjects; m: number of timepoints)

Basis.list

a list of 3 components corresponding to smooth matrices for (mu, logvar, and skewness), typically generated by kpbb

cate

category of model to be considered; 1 for full model, 2 for the model when the skewness is fixed at 0 (no skewness)

Details

The coefficient beta is a vector by combining all coefficients for the mean, variance and skewness.

Value

case2.unmll.optim

negative loglikehood at beta when data = dataone and the Basis.list is used

case2.gr

gradient vector of case2.unmll.optim at beta when data = dataone and the Basis.list is used

Note

This is the negative log Marginal likelihood function of the data assuming independence.

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.

See Also

kpbb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(data.simulation)
y <- DST$obs
tp <- DST$tp
cp <- DST$cp
# generate basis
cases = c(2,2,1)   # bivariate for mean and variance; univariate for shape 
nknots.tp = c(2,2,2) # 2 knots at time direction for each parameter
nknots.cp = c(2,2)   # 2 knots at covariate direction for mean and variance
basis.list <- lapply(1:3, function(k) 
  kpbb(tp, cp, nknots.tp = nknots.tp[k],
       nknots.cp= nknots.cp[k], sub.case=cases[k]))
# obtain coefficients randomly
length.beta <- sum(sapply(basis.list, ncol))
beta <- runif(length.beta)
unmll <- case2.unmll.optim(beta, y, basis.list)
gradient <- case2.gr(beta, y, basis.list)

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

Related to case2.unmll.optim in cSFM...