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