View source: R/predict.CopulaCenR.R
| predict.CopulaCenR | R Documentation |
Predictions for new observations based on ic_spTran_copula, rc_spCox_copula,
ic_par_copula and rc_par_copula.
## S3 method for class 'CopulaCenR'
predict(object, newdata, type = "lp", ...)
object |
a |
newdata |
a data frame (see details) |
type |
|
... |
further arguments |
For the newdata, when type = "survival", it must be a data frame with columns
id (subject id), ind (1,2 for two margins),
time (to be evaluted) and covariates;
when type = "lp", the newdata needs to have id,
ind and covariates, but time is not needed.
When the argument type = "lp", it gives a linear predictor for
each margin (i.e., log hazards ratio in the proportional hazards model,
log proportional odds in the proportional odds model).
When the argument type = "survival", the marginal and joint survival values
will be evaluated at the given time points in the newdata.
If type = "lp", it returns a data frame with id,
lp1 (linear predictor for margin 1), lp2.
If type = "survival", it returns a data frame with id,
t1 (evaluated times for the margin 1), t2,
S1 (predicted marginal survival probabilities for margin 1),
S2 and
S12 (the predicted joint survival probabilities at t1, t2)
data(AREDS)
# fit a Copula2-Sieve model
copula2_sp <- ic_spTran_copula(data = AREDS, copula = "Copula2",
l = 0, u = 15, m = 3, r = 3,
var_list = c("ENROLLAGE","rs2284665","SevScaleBL"))
# Predicted probabilities for newdata
newdata = data.frame(id = rep(1:3, each=2), ind = rep(c(1,2),3),
time = c(2,3,5,6,7,8),
SevScaleBL = rep(3,6),
ENROLLAGE = rep(60,6),
rs2284665 = c(0,0,1,1,2,2))
output <- predict(object = copula2_sp, newdata = newdata)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.