Learn R Programming

rstpm2 (version 1.2.2)

predict-methods: Predicted values for an stpm2 or pstpm2 fit

Description

Given an stpm2 fit and an optional list of new data, return predictions

Usage

## S3 method for class 'stpm2':
predict(object, newdata=NULL,
               type=c("surv","cumhaz","hazard","density","hr","sdiff",
                      "hdiff","loghazard","link","meansurv", "meansurvdiff"),
               grid=FALSE,seqLength=300,
               se.fit=FALSE,link=NULL,exposed=incrVar(var),var,...)
    ## S3 method for class 'pstpm2':
predict(object, newdata=NULL,
               type=c("surv","cumhaz","hazard","density","hr","sdiff",
                      "hdiff","loghazard","link","meansurv", "meansurvdiff"),
               grid=FALSE,seqLength=300,
               se.fit=FALSE,link=NULL,exposed=incrVar(var),var,...)

Arguments

object
an stpm2 or pstpm2 object
newdata
optional list of new data (required if type in ("hr","sdiff","hdiff")). For type in ("hr","sdiff","hdiff"), this defines the unexposed newdata. This can be combined with grid to get a
type
specify the type of prediction:
  • "surv"
{survival probabilities} "cumhaz"{cumulative hazard} "hazard"{hazard} "density"{density} "hr"{hazard ratio}

Value

  • A data-frame with components Estimate, lower and upper, with an attribute "newdata" for the newdata data-frame.

item

  • grid
  • seqLength
  • se.fit
  • link
  • exposed
  • var
  • ...

code

grid=TRUE

Details

The confidence interval estimation is based on the delta method using numerical differentiation.

See Also

stpm2