Learn R Programming

survey (version 3.36)

svysurvreg: Fit accelerated failure models to survey data

Description

This function calls survreg from the 'survival' package to fit accelerated failure (accelerated life) models to complex survey data, and then computes correct standard errors by linearisation. It has the same arguments as survreg, except that the second argument is design rather than data.

Usage

# S3 method for survey.design
svysurvreg(formula, design, weights=NULL, subset=NULL, ...)

Arguments

formula

Model formula

design

Survey design object, including two-phase designs

weights

Additional weights to multiply by the sampling weights. No, I don't know why you'd want to do that.

subset

subset to use in fitting (if needed)

Other arguments of survreg

Value

Object of class svysurvreg, with the same structure as a survreg object but with NA for the loglikelihood.

Examples

Run this code
# NOT RUN {
 data(pbc, package="survival")
 pbc$randomized <- with(pbc, !is.na(trt) & trt>0)
 biasmodel<-glm(randomized~age*edema,data=pbc)
 pbc$randprob<-fitted(biasmodel)
 dpbc<-svydesign(id=~1, prob=~randprob, strata=~edema,
    data=subset(pbc,randomized))

 model <- svysurvreg(Surv(time, status>0)~bili+protime+albumin, design=dpbc, dist="weibull")
summary(model)

# }

Run the code above in your browser using DataLab