svysurvreg.RdThis 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.
# S3 method for class 'survey.design'
svysurvreg(formula, design, weights=NULL, subset=NULL, ...)Object of class svysurvreg, with the same structure as a survreg object but with NA for the loglikelihood.
The residuals method is identical to that for survreg objects except the weighted option defaults to TRUE
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)
#>
#> Call:
#> svysurvreg(formula = Surv(time, status > 0) ~ bili + protime +
#> albumin, design = dpbc, dist = "weibull")
#> Value Std. Error z p
#> (Intercept) 7.33162 0.77621 9.45 < 2e-16
#> bili -0.07817 0.00879 -8.90 < 2e-16
#> protime -0.17644 0.05971 -2.96 0.0031
#> albumin 0.85167 0.14232 5.98 2.2e-09
#> Log(scale) -0.42104 0.06142 -6.86 7.1e-12
#>
#> Scale= 0.656
#>
#> Weibull distribution
#> Loglik(model)= NA Loglik(intercept only)= NA
#> Chisq= on 3 degrees of freedom, p=
#> Number of Newton-Raphson Iterations: 6
#> n= 312
#>