Calculates residuals for a joint frailty scale-change model fitted by reReg. Under the recurrent event model, at each observation time, $$t$$, the residual is calculated as $$\mbox{observed number of recurrent events at } t- \mbox{expected number of recurrent events at} t.$$ The expected number of recurrent events at $$t$$ is calculated by the cumulative rate function at $$t$$. Under the failure time model, the residual is calculated as $$\Delta - H(t),$$ where $$\Delta$$ is the terminal event indicator and $$H(t)$$ is the cumulative hazard function at $$t$$.

# S3 method for reReg
residuals(object, model = c("recurrent", "failure"), ...)

## Arguments

object an object of class reReg returned by the reReg() function. a character string specifying whether the residuals will be calculated under the recurrent event model or the failure time model. additional parameters for future development.