Description Usage Arguments Details Value Author(s) References See Also Examples
This function makes prediction based on a cv.FuncompCGL
object, using the stored "FuncompCGL.fit"
object and the optimal values of the
regularization parameter lam
and the degrees of freedom k
.
1 2 3 |
object |
fitted |
Znew |
data frame or matrix |
Zcnew |
matrix |
s |
value(s) of the penalty parameter
|
k |
value(s) of the degrees of freedom of the basis function at which coefficents are requested.
|
trim |
logical; whether to use the trimmed result. Default is |
... |
Other arguments passed to |
s
is the vector at which predictions are requested. If s
is not in the lam
sequence used for fitting the model, the predict
function uses linear interpolation.
If the data frame X
is provided in FuncompCGL
mode, the integral
for new data newx
is taken the same as that in the fitted
FuncompCGL
model. This means that the parameters degree
,
basis_fun
, insert
, method
, inteval
,
Trange
, and K
are exactly the same as these in the provided
object
. If insert="X"
or "basis"
, sseq
is the
sorted sequence of all the observed time points in fitting FuncompCGL
model and
all the observed time points in newx
. Then interpolation is
conducted on sseq
. If matrix X
after integral is provided in
the FuncompCGL
object, these parameters are required.
The prediction values at the requested value(s) for s
and k
.
If k
is a vector, a list of prediction matrix is returned,
otherwise a prediction matrix is returned.
Zhe Sun and Kun Chen
Sun, Z., Xu, W., Cong, X., Li G. and Chen K. (2020) Log-contrast regression with functional compositional predictors: linking preterm infant's gut microbiome trajectories to neurobehavioral outcome, https://arxiv.org/abs/1808.02403 Annals of Applied Statistics
cv.FuncompCGL
and FuncompCGL
, and
coef
and
plot
methods for "cv.FuncompCGL"
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | df_beta = 5
p = 30
beta_C_true = matrix(0, nrow = p, ncol = df_beta)
beta_C_true[1, ] <- c(-0.5, -0.5, -0.5 , -1, -1)
beta_C_true[2, ] <- c(0.8, 0.8, 0.7, 0.6, 0.6)
beta_C_true[3, ] <- c(-0.8, -0.8 , 0.4 , 1 , 1)
beta_C_true[4, ] <- c(0.5, 0.5, -0.6 ,-0.6, -0.6)
n_train = 50
n_test = 30
Data <- Fcomp_Model(n = n_train, p = p, m = 0, intercept = TRUE,
SNR = 4, sigma = 3, rho_X = 0, rho_T = 0.6, df_beta = df_beta,
n_T = 20, obs_spar = 1, theta.add = FALSE,
beta_C = as.vector(t(beta_C_true)))
arg_list <- as.list(Data$call)[-1]
arg_list$n <- n_test
Test <- do.call(Fcomp_Model, arg_list)
k_list = c(4,5)
cv_m1 <- cv.FuncompCGL(y = Data$data$y, X = Data$data$Comp,
Zc = Data$data$Zc, intercept = Data$data$intercept,
k = k_list, nfolds = 5)
y_hat = predict(cv_m1, Znew = Test$data$Comp, Zcnew = Test$data$Zc)
predict(cv_m1, Znew = Test$data$Comp, Zcnew = Test$data$Zc, s = "lam.1se")
predict(cv_m1, Znew = Test$data$Comp, Zcnew = Test$data$Zc, s = c(0.5, 0.1, 0.05), k = k_list)
plot(Test$data$y, y_hat, xlab = "Observed Response", ylab = "Predicted Response")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.