Package: survey 4.5

"Thomas Lumley"

survey: Analysis of Complex Survey Samples

Summary statistics, two-sample tests, rank tests, generalised linear models, cumulative link models, Cox models, loglinear models, and general maximum pseudolikelihood estimation for multistage stratified, cluster-sampled, unequally weighted survey samples. Variances by Taylor series linearisation or replicate weights. Post-stratification, calibration, and raking. Two-phase and multiphase subsampling designs. Graphics. PPS sampling without replacement. Small-area estimation. Dual-frame designs.

Authors:Thomas Lumley, Peter Gao, Ben Schneider

survey_4.5.tar.gz
survey_4.5.zip(r-4.5)survey_4.5.zip(r-4.4)survey_4.5.zip(r-4.3)
survey_4.5.tgz(r-4.4-x86_64)survey_4.5.tgz(r-4.4-arm64)survey_4.5.tgz(r-4.3-x86_64)survey_4.5.tgz(r-4.3-arm64)
survey_4.5.tar.gz(r-4.5-noble)survey_4.5.tar.gz(r-4.4-noble)
survey_4.5.tgz(r-4.4-emscripten)survey_4.5.tgz(r-4.3-emscripten)
survey.pdf |survey.html
survey/json (API)
NEWS

# Install 'survey' in R:
install.packages('survey', repos = c('https://r-forge.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://r-forge.r-project.org/projects/r-survey

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:
  • DatA - Database of household expenses for two sampling frames
  • DatB - Database of household expenses for two sampling frames
  • PiklA - Database of household expenses for two sampling frames
  • PiklB - Database of household expenses for two sampling frames
  • apiclus1 - Student performance in California schools
  • apiclus2 - Student performance in California schools
  • apipop - Student performance in California schools
  • apisrs - Student performance in California schools
  • apistrat - Student performance in California schools
  • crowd - Household crowding
  • election - US 2004 presidential election data at state or county level
  • election_insample - US 2004 presidential election data at state or county level
  • election_jointHR - US 2004 presidential election data at state or county level
  • election_jointprob - US 2004 presidential election data at state or county level
  • election_pps - US 2004 presidential election data at state or county level
  • fpc - Small survey example
  • hospital - Sample of obstetric hospitals
  • mu284 - Two-stage sample from MU284
  • myco - Association between leprosy and BCG vaccination
  • nhanes - Cholesterol data from a US survey
  • salamander - Salamander mating data set from McCullagh and Nelder
  • scd - Survival in cardiac arrest
  • yrbs - One variable from the Youth Risk Behaviors Survey, 2015.

On CRAN:

102 exports 9.06 score 9 dependencies 219 dependents 95 mentions 12.2k scripts 50.7k downloads

Last updated 9 days agofrom:cb376f6cc4. Checks:OK: 1 WARNING: 8. Indexed: yes.

TargetResultDate
Doc / VignettesOKAug 30 2024
R-4.5-win-x86_64WARNINGAug 29 2024
R-4.5-linux-x86_64WARNINGAug 29 2024
R-4.4-win-x86_64WARNINGAug 29 2024
R-4.4-mac-x86_64WARNINGAug 29 2024
R-4.4-mac-aarch64WARNINGAug 29 2024
R-4.3-win-x86_64WARNINGAug 29 2024
R-4.3-mac-x86_64WARNINGAug 29 2024
R-4.3-mac-aarch64WARNINGAug 29 2024

Exports:as.svrepdesignas.svydesign2bootweightsbrrweightscal_namescal.linearcal.logitcal.rakingcal.sinhcalibratecompressWeightscvdeffdegfdotchartestWeightsgrakehadamardHRis.hadamardjk1weightsjknweightsjoinCellsmake.calfunmake.formulamake.panel.svysmoothmarginpredmrbweightsmultiframemultiphaseneighboursnonresponseoldsvyquantilepaleypchisqsumpFsumpoisson_samplingpostStratifyppscovppsmatpsrsqrakeregTermTestreweightSEsparseCellsstratsamplesubbootweightssvrepdesignsvrVarsvyboxplotsvybysvybyssvycdfsvychisqsvycipropsvycontrastsvycoplotsvycoxphsvyCprodsvycralphasvydesignsvyfactanalsvyglmsvygofchisqsvyhistsvyivregsvykappasvykmsvyloglinsvylogranksvymeansvymlesvynlssvyolrsvyplotsvyprcompsvypredmeanssvyqqmathsvyqqplotsvyquantilesvyranktestsvyratiosvyrecvarsvyscoretestsvysmoothsvysmoothAreasvysmoothUnitsvystandardizesvysurvregsvytablesvytotalsvyttestsvyvartrimWeightstwophasetwophase2vartwophasevarunwtd.countwithCrossvalwithReplicatesxdesign

Dependencies:DBIlatticeMatrixminqamitoolsnumDerivRcppRcppArmadillosurvival

A survey analysis example

Rendered fromsurvey.Rnwusingutils::Sweaveon Aug 30 2024.

Last update: 2014-08-11
Started: 2014-08-11

Analysing PPS designs

Rendered frompps.Rnwusingutils::Sweaveon Aug 30 2024.

Last update: 2014-08-11
Started: 2014-08-11

Estimates in subpopulations

Rendered fromdomain.Rnwusingutils::Sweaveon Aug 30 2024.

Last update: 2014-08-11
Started: 2014-08-11

Computations for multiphase sampling

Rendered frommultiphase.Rmdusingknitr::rmarkdownon Aug 30 2024.

Last update: 2024-06-07
Started: 2024-06-07

Pre-calibrated weights

Rendered fromprecalibrated.Rnwusingutils::Sweaveon Aug 30 2024.

Last update: 2022-04-29
Started: 2022-04-29

Quantile rules

Rendered fromqrule.Rnwusingutils::Sweaveon Aug 30 2024.

Last update: 2021-07-15
Started: 2020-07-26

Small area estimation

Rendered fromsurvey-sae.html.asisusingR.rsp::asison Aug 30 2024.

Last update: 2024-03-07
Started: 2024-03-07

Two-phase designs in epidemiology

Rendered fromepi.Rnwusingutils::Sweaveon Aug 30 2024.

Last update: 2014-08-11
Started: 2014-08-11

Readme and manuals

Help Manual

Help pageTopics
Model comparison for glms.AIC.svyglm anova.svycoxph anova.svyglm BIC.svyglm extractAIC.svrepglm extractAIC.svyglm
Student performance in California schoolsapi apiclus1 apiclus2 apipop apisrs apistrat
Package sample and population size dataas.fpc
Convert a survey design to use replicate weightsas.svrepdesign as.svrepdesign.default as.svrepdesign.svyimputationList
Update to the new survey design format.svycheck as.svydesign2
Barplots and Dotplotsbarplot.svrepstat barplot.svyby barplot.svystat dotchart dotchart.svrepstat dotchart.svyby dotchart.svystat
Compute survey bootstrap weightsbootstratum bootweights mrbweights subbootweights
Compute replicate weightsbrrweights jk1weights jknweights
Calibration (GREG) estimatorscalibrate calibrate.survey.design2 calibrate.svyrep.design calibrate.twophase cal_names grake
Compress replicate weight matrixas.matrix.repweights as.matrix.repweights_compressed as.vector.repweights_compressed compressWeights compressWeights.default compressWeights.repweights_compressed compressWeights.svyrep.design dim.repweights_compressed dimnames.repweights_compressed [.repweights_compressed
Confidence intervals for regression parametersconfint.svyglm
Household crowdingcrowd
Dimensions of survey designsdim.DBIsvydesign dim.survey.design dim.svyimputationList dim.svyrep.design dim.twophase dimnames.DBIsvydesign dimnames.survey.design dimnames.svyimputationList dimnames.svyrep.design dimnames.twophase
US 2004 presidential election data at state or county levelelection election_insample election_jointHR election_jointprob election_pps
Estimated weights for missing dataestWeights estWeights.data.frame estWeights.twophase
Small survey examplefpc
Lay out tables of survey statisticsftable.svrepstat ftable.svyby ftable.svystat
Hadamard matriceshadamard
Sample of obstetric hospitalshospital
Wrappers for specifying PPS designsHR ppscov ppsmat
Calibration metricscal.linear cal.logit cal.raking cal.sinh make.calfun
Standardised predictions (predictive margins) for regression models.marginpred marginpred.svycoxph marginpred.svyglm marginpred.svykmlist
Two-stage sample from MU284mu284
Dual-frame and multi-frame surveysmultiframe
Multiphase sampling designsmultiphase
Association between leprosy and BCG vaccinationmyco
Quantiles under complex sampling.svyquantile svyquantile.survey.design svyquantile.svyrep.design
Cholesterol data from a US surveynhanes
Experimental: Construct non-response weightsjoinCells neighbours nonresponse print.nonresponse print.nonresponseSubset sparseCells weights.nonresponse [.nonresponse
Deprecated implementation of quantilesoldsvyquantile oldsvyquantile.survey.design oldsvyquantile.svyrep.design print.svyquantile
Open and close DBI connectionsclose.DBIsvydesign open.DBIsvydesign
Paley-type Hadamard matricesis.hadamard paley
Distribution of quadratic formspchisqsum pFsum
Database of household expenses for two sampling framesDatA DatB phoneframes PiklA PiklB
Specify Poisson sampling designpoisson_sampling
Post-stratify a surveypostStratify postStratify.survey.design postStratify.svyrep.design postStratify.twophase
Pseudo-Rsquaredspsrsq
Raking of replicate weight designrake
Wald test for a term in a regression modelprint.regTermTest regTermTest
Reweight (optimise) the weights on framesplot.dualframe_with_rewt reweight reweight.dualframe
Salamander mating data set from McCullagh and Nelder (1989)salamander
Survival in cardiac arrestscd
Extract standard errorsSE SE.default SE.svrepstat
Small area estimation via basic area level modelsvysmoothArea
Smooth via basic unit level modelsvysmoothUnit
Take a stratified samplestratsample
Subset of surveysubset.survey.design subset.svyrep.design [.survey.design
Options for the survey packagesurvey.adjust.domain.lonely survey.drop.replicates survey.lonely.psu survey.multicore survey.replicates.mse survey.ultimate.cluster survey.use_rcpp survey.want.obsolete surveyoptions
Summary statistics for sample surveyscoef.svrepstat coef.svystat confint.svrepstat confint.svystat cv cv.default cv.svrepratio cv.svrepstat cv.svyratio cv.svystat deff deff.default make.formula svrepstat svymean svymean.survey.design svymean.survey.design2 svymean.svyrep.design svymean.twophase svystat svytotal svytotal.survey.design svytotal.survey.design2 svytotal.svyrep.design svytotal.twophase svyvar svyvar.survey.design svyvar.svyrep.design vcov.svrepstat vcov.svystat
Specify survey design with replicate weightsimage.svyrep.design model.frame.svyrep.design print.summary.svyrep.design print.svyrep.design summary.svyrep.design svrepdesign svrepdesign.character svrepdesign.default svrepdesign.imputationList [.svyrep.design
Compute variance from replicatessvrVar
Sandwich variance estimator for glmssvy.varcoef
Survey statistics on subsetscoef.svyby confint.svyby deff.svyby SE.svyby svyby svyby.default svyby.survey.design2 svybys unwtd.count
Cumulative Distribution Functionplot.svycdf print.svycdf svycdf
Confidence intervals for proportionssvyciprop
Linear and nonlinearconstrasts of survey statisticssvycontrast
Conditioning plots of survey datasvycoplot
Survey-weighted Cox models.AIC.svycoxph extractAIC.svycoxph predict.svycoxph svycoxph svycoxph.survey.design svycoxph.survey.design2 svycoxph.svyrep.design
Computations for survey variancesonestage onestrat svyCprod
Cronbach's alphasvycralpha
Survey sample analysis.na.exclude.survey.design na.fail.survey.design na.omit.survey.design svydesign svydesign.character svydesign.default svydesign.imputationList
Factor analysis in complex surveys (experimental).svyfactanal
Survey-weighted generalised linear models.coef.svyglm predict.svrepglm predict.svyglm residuals.svrepglm residuals.svyglm summary.svrepglm summary.svyglm svyglm svyglm.survey.design svyglm.svyrep.design vcov.svyglm
Test of fit to known probabilitiessvygofchisq
Histograms and boxplotssvyboxplot svyhist
Two-stage least-squares for instrumental variable regressionsvyivreg
Cohen's kappa for agreementsvykappa
Estimate survival function.confint.svykm lines.svykm plot.svykm plot.svykmlist quantile.svykm svykm
Loglinear modelsanova.svyloglin coef.svyloglin print.anova.svyloglin svyloglin update.svyloglin
Compare survival distributionssvylogrank
Maximum pseudolikelihood estimation in complex surveyscoef.svymle print.svymle summary.svymle svymle vcov.svymle
Probability-weighted nonlinear least squaressvynls
Proportional odds and related modelspredict.svyolr svyolr svyolr.survey.design2 svyolr.svyrep.design
Plots for survey datasvyplot svyplot.default
Sampling-weighted principal component analysisbiplot.svyprcomp svyprcomp
Predictive marginal meanssvypredmeans
Quantile-quantile plots for survey datasvyqqmath svyqqplot
Design-based rank testssvyranktest
Ratio estimationcoef.svyratio confint.svyratio predict.svyratio predict.svyratio_separate print.svyratio print.svyratio_separate SE.svyratio svyratio svyratio.survey.design svyratio.survey.design2 svyratio.svyrep.design svyratio.twophase
Variance estimation for multistage surveysmultistage multistage_rcpp svyrecvar
Score tests in survey regression modelssvyscoretest svyscoretest.svyglm
Scatterplot smoothing and density estimationlines.svysmooth make.panel.svysmooth plot.svysmooth print.svysmooth svysmooth svysmooth.default
Direct standardization within domainssvystandardize
Fit accelerated failure models to survey datasvysurvreg svysurvreg.survey.design
Contingency tables for survey datadegf degf.survey.design2 degf.svyrep.design degf.twophase print.summary.svytable summary.svreptable summary.svytable svreptable svychisq svychisq.survey.design svychisq.svyrep.design svytable svytable.survey.design svytable.svyrep.design
Design-based t-testconfint.svyttest svyttest
Trim sampling weightstrimWeights trimWeights.survey.design2 trimWeights.svyrep.design
Two-phase designsmodel.frame.twophase multistage.phase1 na.exclude.twophase na.fail.twophase na.omit.twophase onestage.phase1 onestrat.phase1 print.summary.twophase print.twophase subset.twophase summary.twophase svyrecvar.phase1 twophase twophase2var twophasevar [.twophase
Add variables to a survey designupdate.DBIsvydesign update.survey.design update.svyrep.design update.twophase
Survey design weightsweights.survey.design weights.survey_fpc weights.svyrep.design
Analyse multiple imputationssubset.svyimputationList with.svyimputationList
Crossvalidation using replicate weightswithCrossval
Analyse plausible values in surveyswithPV.survey.design
Compute variances by replicate weightingvcov.svyrep.design withReplicates withReplicates.svrepstat withReplicates.svrepvar withReplicates.svyimputationList withReplicates.svyrep.design
Crossed effects and other sparse correlationsxdesign
One variable from the Youth Risk Behaviors Survey, 2015.yrbs