Lumley, T. (2010). Survey: analysis of complex survey samples. Version 3.22-4
Other documents for the same rulemaking (all, by stage)
References
Rao, JNK, Scott, AJ (1984) "On Chi-squared Tests For Multiway Contingency Tables with Proportions Estimated From Survey Data" Annals of Statistics 12:46-60.
Lumley, T., & Scott, A. (2014). "Tests for Regression Models Fitted to Survey Data". Australian and New Zealand Journal of Statistics, 56 (1), 1-14.
Lumley T, Scott AJ (2015) "AIC and BIC for modelling with complex survey data" J Surv Stat Methodol 3 (1): 1-18. See Also regTermTest, pchisqsum Examples data(api) dclus2<-svydesign(id=~dnum+snum, weights=~pw, data=apiclus2) model0<-svyglm(I(sch.wide=="Yes")~ell+meals+mobility, design=dclus2, family=quasibinomial()) model1<-svyglm(I(sch.wide=="Yes")~ell+meals+mobility+as.numeric(stype), design=dclus2, family=quasibinomial()) model2<-svyglm(I(sch.wide=="Yes")~ell+meals+mobility+stype, design=dclus2, family=quasibinomial()) anova(model2) anova(model0,model2) anova(model1, model2) anova(model1, model2, method="Wald")
Canty AJ, Davison AC. (1999) Resampling-based variance estimation for labour force surveys. The Statistician 48:379-391
Judkins, D. (1990), "Fay’s Method for Variance Estimation," Journal of Official Statistics, 6, 223239.
Preston J. (2009) Rescaled bootstrap for stratified multistage sampling. Survey Methodology 35(2) 227-234
Judkins, D. (1990), "Fay’s Method for Variance Estimation" Journal of Official Statistics, 6, 223239.
Methodology. 1993 (866–871) See Also as.svrepdesign brrweights Compute replicate weights Description Compute replicate weights from a survey design. These functions are usually called from as.svrepdesign rather than directly by the user. Usage brrweights(strata, psu, match = NULL, small = c("fail","split","merge"), large = c("split", "merge", "fail"), fay.rho=0, only.weights=FALSE, compress=TRUE, hadamard.matrix=NULL) jk1weights(psu,fpc=NULL, fpctype=c("population","fraction","correction"), compress=TRUE) jknweights(strata,psu, fpc=NULL, fpctype=c("population","fraction","correction"), compress=TRUE, lonely.psu=getOption("survey.lonely.psu")) brrweights Arguments strata Stratum identifiers
JASA 88:1013-1020 Kalton G, Flores-Cervantes I (2003) "Weighting methods" J Official Stat 19(2) 81-97
Lumley T, Shaw PA, Dai JY (2011) "Connections between survey calibration estimators and semiparametric models for incomplete data" International Statistical Review. 79:200-220. (with discussion 79:221-232) Sarndal C-E, Swensson B, Wretman J. "Model Assisted Survey Sampling". Springer. 1991.
Rao JNK, Yung W, Hidiroglou MA (2002) Estimating equations for the analysis of survey data using poststratification information. Sankhya 64 Series A Part 2, 364-378.
Breslow NE, Lumley T, Ballantyne CM, Chambless LE, Kulich M. (2009) Using the Whole Cohort in the Analysis of Case-Cohort Data. Am J Epidemiol. 2009 Jun 1;169(11):1398-405.
Robins JM, Rotnitzky A, Zhao LP. (1994) Estimation of regression coefficients when some regressors are not always observed. Journal of the American Statistical Association, 89, 846-866.
Kulich M, Lin DY (2004). Improving the Efficiency of Relative-Risk Estimation in Case-Cohort Studies. Journal of the American Statistical Association, Vol. 99, pp.832-844
HR(0.1) make.calfun Calibration metrics Description Create calibration metric for use in calibrate. The function F is the link function described in section 2 of Deville et al. To create a new calibration metric, specify F − 1 and its derivative. The package provides cal.linear, cal.raking, cal.logit, which are standard, and cal.sinh from the CALMAR2 macro, for which F is the derivative of the inverse hyperbolic sine. make.calfun Usage make.calfun(Fm1, dF, name) Arguments Function F − 1 taking a vector u and a vector of length 2, bounds. Derivative of Fm1 wrt u: arguments u and bounds name Character string to use as name Value An object of class "calfun" References Deville J-C, Sarndal C-E, Sautory O (1993) Generalized Raking Procedures in Survey Sampling.
Lumley T, Scott A (2012) "Partial likelihood ratio tests for the Cox model under complex sampling" Statistics in Medicine 17 JUL 2012. DOI: 10.1002/sim.5492
Lumley T, Scott A (2014) "Tests for Regression Models Fitted to Survey Data" Australian and New Zealand Journal of Statistics 56:1-14 DOI: 10.1111/anzs.12065 See Also anova, vcov, contrasts,pchisqsum Examples data(esoph) model1 <- glm(cbind(ncases, ncontrols) ~ agegp + tobgp * alcgp, data = esoph, family = binomial()) anova(model1) regTermTest(model1,"tobgp") regTermTest(model1,"tobgp:alcgp") regTermTest(model1, ~alcgp+tobgp:alcgp) data(api) dclus2<-svydesign(id=~dnum+snum, weights=~pw, data=apiclus2) model2<-svyglm(I(sch.wide=="Yes")~ell+meals+mobility, design=dclus2, family=quasibinomial()) regTermTest(model2, ~ell) regTermTest(model2, ~ell,df=NULL) regTermTest(model2, ~ell, method="LRT", df=Inf) regTermTest(model2, ~ell+meals, method="LRT", df=NULL) regTermTest(model2, ~ell+meals, method="WorkingWald", df=NULL) Survival in cardiac arrest Description These data are from Section 12.2 of Levy and Lemeshow. They describe (a possibly apocryphal) study of survival in out-of-hospital cardiac arrest. Two out of five ambulance stations were sampled from each of three emergency service areas. Usage data(scd) Format This data frame contains the following columns:
L. (1984). Confidence intervals for the survival function using Cox’s proportional hazards model with covariates. Biometrics 40, 601-610.
Williams RL (1995) "Product-Limit Survival Functions with Correlated Survival Times" Lifetime Data Analysis 1: 171–186 Woodruff RS (1952) Confidence intervals for medians and other position measures. JASA 57, 622627. See Also predict.svycoxph for survival curves from a Cox model Examples 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)) s1<-svykm(Surv(time,status>0)~1, design=dpbc) s2<-svykm(Surv(time,status>0)~I(bili>6), design=dpbc) plot(s1) plot(s2) plot(s2, lwd=2, pars=list(lty=c(1,2),col=c("purple","forestgreen"))) quantile(s1, probs=c(0.9,0.75,0.5,0.25,0.1)) svyloglin s3<-svykm(Surv(time,status>0)~I(bili>6), design=dpbc,se=TRUE) plot(s3[[2]],col="purple") confint(s3[[2]], parm=365*(1:5)) quantile(s3[[1]], ci=TRUE) svyloglin Loglinear models Description Fit and compare hierarchical loglinear models for complex survey data. Usage svyloglin(formula, design, ...) ## S3 method for class 'svyloglin' update(object,formula,...) ## S3 method for class 'svyloglin' anova(object,object1,...,integrate=FALSE) ## S3 method for class 'anova.svyloglin' print(x,pval=c("F","saddlepoint","lincom","chisq"),...) ## S3 method for class 'svyloglin' coef(object,...,intercept=FALSE)
Korn EL, Graubard BI (1998) "Scatterplots with Survey Data" The American Statistician 52: 58-69
Graubard B, Korn E (1999) "Predictive Margins with Survey Data" Biometrics 55:652-659
Bieler, Brown, Williams, & Brogan (2010) "Estimating Model-Adjusted Risks, Risk Differences, and Risk Ratios From Complex Survey Data" Am J Epi DOI: 10.1093/aje/kwp440 See Also svyglm Worked example using National Health Interview Survey data: https://gist.github.com/tslumley/ 2e74cd0ac12a671d2724 svyquantile Examples data(nhanes) nhanes_design <- svydesign(id=~SDMVPSU, strata=~SDMVSTRA, weights=~WTMEC2YR, nest=TRUE,data=nhanes) agesexmodel<-svyglm(HI_CHOL~agecat+RIAGENDR, design=nhanes_design,family=quasibinomial) ## high cholesterol by race/ethnicity, adjusted for demographic differences means<-svypredmeans(agesexmodel, ~race) means ## relative risks compared to non-Hispanic white svycontrast(means,quote(`1`/`2`)) svycontrast(means,quote(`3`/`2`)) svyquantile Quantiles for sample surveys Description Compute quantiles for data from complex surveys. Usage ## S3 method for class 'survey.design' svyquantile(x, design, quantiles, alpha=0.05, ci=FALSE, method = "linear", f = 1, interval.type=c("Wald","score","betaWald"), na.rm=FALSE,se=ci, ties=c("discrete","rounded"), df=Inf,...) ## S3 method for class 'svyrep.design' svyquantile(x, design, quantiles, method ="linear", interval.type=c("probability","quantile"), f = 1, return.replicates=FALSE, ties=c("discrete","rounded"),na.rm=FALSE,...) ## S3 method for class 'svyquantile'
Dorfman A, Valliant R (1993) Quantile variance estimators in complex surveys. Proceedings of the
ASA Survey Research Methods Section. 1993: 866-871
Korn EL, Graubard BI. (1998) Confidence Intervals For Proportions With Small Expected Number of Positive Counts Estimated From Survey Data. Survey Methodology 23:193-201.
Francisco CA, Fuller WA (1986) Estimation of the distribution function with a complex survey. Technical Report, Iowa State University.
Shao J, Tu D (1995) The Jackknife and Bootstrap. Springer.
Shah BV, Vaish AK (2006) Confidence Intervals for Quantile Estimation from Complex Survey Data. Proceedings of the Section on Survey Research Methods.
Woodruff RS (1952) Confidence intervals for medians and other position measures. JASA 57, 622627. See Also svykm for quantiles of survival curves svyciprop for confidence intervals on proportions. Examples data(api) ## population quantile(apipop$api00,c(.25,.5,.75)) ## one-stage cluster sample dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) svyquantile(~api00, dclus1, c(.25,.5,.75),ci=TRUE) svyquantile(~api00, dclus1, c(.25,.5,.75),ci=TRUE,interval.type="betaWald") svyquantile(~api00, dclus1, c(.25,.5,.75),ci=TRUE,df=NULL) dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) (qapi<-svyquantile(~api00, dclus1, c(.25,.5,.75),ci=TRUE, interval.type="score"))
J. (2013). Two-sample rank tests under complex sampling. BIOMETRIKA, 100 (4), 831-842. See Also svyttest, svylogrank svyratio Examples data(api) dclus1<-svydesign(id=~dnum, weights=~pw, fpc=~fpc, data=apiclus1) svyranktest(ell~comp.imp, dclus1) svyranktest(ell~comp.imp, dclus1, test="median") svyranktest(ell~stype, dclus1) svyranktest(ell~stype, dclus1, test="median") ## upper quartile svyranktest(ell~comp.imp, dclus1, test=function(r,N) as.numeric(r>0.75*N)) quantiletest<-function(p){ rval<-function(r,N) as.numeric(r>(N*p)) attr(rval,"name")<-paste(p,"quantile") rval svyranktest(ell~comp.imp, dclus1, test=quantiletest(0.5)) svyranktest(ell~comp.imp, dclus1, test=quantiletest(0.75)) svyratio Ratio estimation Description Ratio estimation and estimates of totals based on ratios for complex survey samples. Estimating domain (subpopulation) means can be done more easily with svymean. Usage ## S3 method for class 'survey.design2' svyratio(numerator=formula, denominator, design,separate=FALSE, na.rm=FALSE,formula, covmat=FALSE,deff=FALSE,...) ## S3 method for class 'svyrep.design' svyratio(numerator=formula, denominator, design, na.rm=FALSE,formula, covmat=FALSE,return.replicates=FALSE,deff=FALSE, ...) ## S3 method for class 'twophase' svyratio(numerator=formula, denominator, design, separate=FALSE, na.rm=FALSE,formula,...) ## S3 method for class 'svyratio' predict(object, total, se=TRUE,...) svyratio ## S3 method for class 'svyratio_separate' predict(object, total, se=TRUE,...)
Berger, Y.G. (2004), A Simple Variance Estimator for Unequal Probability Sampling Without Replacement. Journal of Applied Statistics, 31, 305-315.
Binder, David A. (1983). On the variances of asymptotically normal estimators from complex surveys. International Statistical Review, 51, 279-292.
Brewer KRW (2002) Combined Survey Sampling Inference (Weighing Basu’s Elephants) [Chapter
Koch, GG, Freeman, DH, Freeman, JL (1975) "Strategies in the multivariate analysis of data from complex surveys" International Statistical Review 43: 59-78
Rao, JNK, Scott, AJ (1984) "On Chi-squared Tests For Multiway Contigency Tables with Proportions Estimated From Survey Data" Annals of Statistics 12:46-60.
Sribney WM (1998) "Two-way contingency tables for survey or clustered data" Stata Technical Bulletin 45:33-49.
Thomas, DR, Rao, JNK (1990) "Small-sample comparison of level and power for simple goodnessof-fit statistics under cluster sampling" JASA 82:630-636 See Also svytotal and svymean report totals and proportions by category for factor variables. See svyby and ftable.svystat to construct more complex tables of summary statistics. See svyloglin for loglinear models. See regTermTest for Rao-Scott tests in regression models. Examples data(api) xtabs(~sch.wide+stype, data=apipop) dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) summary(dclus1) (tbl <- svytable(~sch.wide+stype, dclus1)) plot(tbl) fourfoldplot(svytable(~sch.wide+comp.imp+stype,design=dclus1,round=TRUE), conf.level=0) svychisq(~sch.wide+stype, dclus1) summary(tbl, statistic="Chisq") svychisq(~sch.wide+stype, dclus1, statistic="adjWald") rclus1 <- as.svrepdesign(dclus1) summary(svytable(~sch.wide+stype, rclus1)) svychisq(~sch.wide+stype, rclus1, statistic="adjWald") svyttest svyttest Design-based t-test Description One-sample or two-sample t-test. This function is a wrapper for svymean in the one-sample case and for svyglm in the two-sample case. Degrees of freedom are degf(design)-1 for the one-sample test and degf(design)-2 for the two-sample case. Usage svyttest(formula, design, ...) Arguments formula
Sarndal CE, Swensson B, Wretman J (1992) "Model Assisted Survey Sampling" Springer. Breslow NE and Chatterjee N, Design and analysis of two-phase studies with binary outcome applied to Wilms tumour prognosis. "Applied Statistics" 48:457-68, 1999
Breslow N, Lumley T, Ballantyne CM, Chambless LE, Kulick M. (2009) Improved Horvitz-Thompson estimation of model parameters from two-phase stratified samples: applications in epidemiology. Statistics in Biosciences. doi 10.1007/s12561-009-9001-6
Lumley T (2017) "Pseudo-R2 statistics under complex sampling" Australian and New Zealand Journal of Statistics DOI: 10.1111/anzs.12187