| msm.predict {qgcomp} | R Documentation |
Secondary prediction method for the (non-survival) qgcomp MSM.
Description
this is an internal function called by
qgcomp.glm.boot,
but is documented here for clarity. Generally, users will not need to call
this function directly.
Get predicted values from a qgcompfit object from
qgcomp.glm.boot.
Usage
msm.predict(object, newdata = NULL)
Arguments
object |
"qgcompfit" object from |
newdata |
(optional) new set of data (data frame) with a variable
called |
Details
(Not usually called by user) Makes predictions from the MSM
(rather than the conditional g-computation
fit) from a "qgcompfit" object. Generally, this should not be used in
favor of the default predict.qgcompfit function. This
function can only be used following the qgcomp.glm.boot function. For the
qgcomp.glm.noboot function, predict.qgcompfit gives
identical inference to predicting from an MSM.
Examples
set.seed(50)
dat <- data.frame(y=runif(50), x1=runif(50), x2=runif(50), z=runif(50))
obj <- qgcomp.glm.boot(y ~ z + x1 + x2 + I(z*x1), expnms = c('x1', 'x2'),
data=dat, q=4, B=10, seed=125)
dat2 <- data.frame(psi=seq(1,4, by=0.1))
summary(msm.predict(obj))
summary(msm.predict(obj, newdata=dat2))