Description Usage Arguments Details Value Note See Also Examples
Select the best number of knots to minimize AIC. This is a convinient function to implement cSFM.est
for different combination of knots by allowing parallel computing.
1 2 3 4 |
data |
The fully observed data matrix n by m. The number of row n is the number of subjects; the number of columns m is the number of time points for each subject. |
tp |
The timepoint vector of length m, shared by each subject |
cp |
The covariate vector of length n corresponding to n subjects |
nknots.tp |
knots matrix with each row to be a vector (k1,k2,k3) for the number of knots (mean, variance, skewness) in the time direction |
nknots.cp |
knots matrix with each row to be a vector (s1,s2,s3) for the number of knots (mean, variance, skewness) in the covariant direction; the effective length is |
max.knots |
the maximum number of knots to be considerred; |
parallel |
logical indicator; whether parallel computing will be used or not |
num.core |
number of cores to be used when |
method |
Estimation method for the model. See |
bi.level |
Bivariate level taking values at 0, 1, 2, 3. See |
degree.poly |
The vector (d1,d2,d3) for the degree of B-splines (mean, variance, skewness) in both the time and covariant direction; the cubic splines are the default splines. |
nbasis.mean |
Number of basis functions to smooth the mean; only applicable when |
gam.method |
Method to smooth the mean; only applicable when |
This function is mainly based on cSFM.est, except that different sets of knots are considerred here. The parallel computing is based on the package parallel.
When supplied, max.kntos will determine (knots.tp, knots.cp) as follows. For each direction (time and covariate) and each parameter (mean, variance and skewness), the number of knots is from 1 to max.knots; we enforce the lower moments have more knots than higher moments (for example, mean has more knots than variance), therefore delete those exceptions to give (knots.tp, knots.cp).
best.cSFM |
cSFM object with the minimal AIC value; see |
knots.mat |
matrix for knots to be considerred; each row is a vector with length 6: first three are knots for time direction, while the last three are knots for covariate direction |
AIC |
AIC vector for all sets of knots |
This function is the parallel version of cSFM.est. The major difference is that this function allows for a pool of knots combination and apply the parallel computing to save time. Most of the arguments are the same between the two functions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
data(data.simulation)
# Example 1: use the convinient default to generate knots
ret <- cSFM.est.parallel(DST$obs, DST$tp, DST$cp, max.knots = 4)
# AIC vector
ret$AIC
# best number of knots
ret$knots.mat[which.min(ret$AIC), ]
# Example 2: assign combinations of knots subjectively
nknots.tp = rbind(c(3,2,1), c(6,5,4))
nknots.cp = nknots.tp
ret2 <- cSFM.est.parallel(DST$obs, DST$tp, DST$cp,
nknots.tp = nknots.tp, nknots.cp = nknots.cp)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.