Learn R Programming

cSFM (version 1.1)

unmll: Negative loglikelihood function and the Gradient

Description

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

Usage

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)

Value

  • case2.unmll.optimnegative loglikehood at beta when data = dataone and the Basis.list is used
  • case2.grgradient vector of case2.unmll.optim at beta when data = dataone and the Basis.list is used

Details

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

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

Run this code
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)

Run the code above in your browser using DataLab