msm.predict: Secondary prediction method for the (non-survival) qgcomp...

Description Usage Arguments Details Examples

View source: R/base.R

Description

this is an internal function called by qgcomp.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.boot.

Usage

1
msm.predict(object, newdata = NULL)

Arguments

object

"qgcompfit" object from qgcomp.boot function

newdata

(optional) new set of data (data frame) with a variable called psi representing the joint exposure level of all exposures under consideration

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.boot function. For the qgcomp.noboot function, predict.qgcompfit gives identical inference to predicting from an MSM.

Examples

1
2
3
4
5
6
set.seed(50)
dat <- data.frame(y=runif(50), x1=runif(50), x2=runif(50), z=runif(50))
obj <- qgcomp.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))

Example output

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.4248  0.4360  0.4471  0.4471  0.4583  0.4694 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.4100  0.4211  0.4323  0.4323  0.4434  0.4546 

qgcomp documentation built on Jan. 24, 2022, 5:08 p.m.