predict.FuncompCGL: Make prediction from a '"FuncompCGL"' object.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/tools.R

Description

Make prediction based on a fitted FuncompCGL object.

Usage

1
2
3
4
5
## S3 method for class 'FuncompCGL'
predict(object, Znew, Zcnew = NULL, s = NULL,
        T.name = "TIME", ID.name = "Subject_ID",
        Trange, interval, insert, basis_fun, degree, method, sseq,
        ...)

Arguments

object

fitted FuncompCGL object.

Znew

data frame or matrix X as in FuncompCGL with new functional compositional data at which prediction is to be made.

Zcnew

matrix Zc as in FuncompCGL with new values of time-invariate covariates at which prediction is to be made. Default is NULL.

s

value(s) of the penalty parameter lam at which predictions are requested. Default is the entire sequence used to fit the model.

T.name

a character string specifying names of the time variable and the Subject ID variable in X. This is only needed when X is a data frame or matrix of the functional compositional predictors. Default are "TIME" and "Subject_ID".

ID.name

a character string specifying names of the time variable and the Subject ID variable in X. This is only needed when X is a data frame or matrix of the functional compositional predictors. Default are "TIME" and "Subject_ID".

Trange, interval, insert, basis_fun, degree, method

the same as those in FuncompCGL.

sseq

full set of potential time points of observations; used for interpolation when insert = "X" or insert = "basis".

...

not used.

Details

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.

Value

predicted values at the requested value(s) for s.

Author(s)

Zhe Sun and Kun Chen

References

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

See Also

FuncompCGL, and coef, plot and print methods for "FuncompCGL" object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
p = 30
n_train = 50
n_test = 30
df_beta = 5
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)
Data <- Fcomp_Model(n = n_train, p = p, m = 0, intercept = TRUE,
                    SNR = 2, sigma = 2,
                    rho_X = 0, rho_T = 0.5, df_beta = df_beta,
                    n_T = 20, obs_spar = 1, theta.add = c(3,4,5),
                    beta_C = as.vector(t(beta_C_true)))
m1 <- FuncompCGL(y = Data$data$y, X = Data$data$Comp , Zc = Data$data$Zc,
                 intercept = Data$data$intercept, k = df_beta)
arg_list <- as.list(Data$call)[-1]
arg_list$n <- n_test
TEST <- do.call(Fcomp_Model, arg_list)
predmat <- predict(m1, Znew = TEST$data$Comp, Zcnew = TEST$data$Zc)
predmat <- predict(m1, Znew = TEST$data$Comp, Zcnew = TEST$data$Zc, s = c(0.5, 0.1, 0.05))

jiji6454/compReg documentation built on Feb. 5, 2021, 2:20 p.m.