Supplemental Code Examples
This section provides key updates to software for analysis of survey data. We will add new items as they emerge. These paper or presentations are older and refer to ASDA first and second editions.
Slides and R/STAN code from Presentation “Pseudo-Bayesian Inference for Complex Survey Data”, April 2020, Matt Williams and Terrance Savitsky. Link to Slides Link to R/STAN Code
Information and Link to R svydiags package for Survey Regression Diagnostics by Dr. Valliant. This work contains functions for computing diagnostics for fixed effects linear regression models fitted with survey data. Many extensions of standard diagnostics to complex survey data are included: standardized residuals, leverages, Cook’s D, dfbetas, dffits, condition indexes, and variance inflation factors.
Link to CRAN
Working Version of R Code for Archer and Lemeshow GOF test, Developed by Yajuan Si and Kevin Pritchard with assistance from Brady West, University of Michigan, July 16 2022. Link to R Code
Weight Calibration across Packages, Presentation by Stas Kolenikov, 9/23/2019. Link to Presentation
R Package pwlmm: PWIGLS for Two-Level Multivariate and Multilevel Linear Models, Author: Alinne Veiga, Published 2022-06-13. Link to R Package
Discussion of R Packages for Survey Data Analysis “srvyr compared to the survey package” by Greg Freedman, 2022-02-20. Link to Discussion, Examples and Code
R Package “svrep”, Tools for Creating, Updating, and Analyzing Survey Replicate Weights, Author: Benjamin Schneider, February 7, 2023. Link to PDF
Stata Example of Mediation analysis with survey data and subpopulation indicator: Stata sgmediation example
R-Example of Quantile Regression with Bootstrap Method: R Quantile Regression Example
SAS-Example of how to use replicate weights using NHANES data: SAS Replicate Weights Example
SAS-Example of use of NOMCAR option with PROC SURVEYMEANS: SAS NOMCAR Example
Example of How to Create a Delimited Text File in SAS and Read Text File in R: Text File SAS to R Example
An Example of Fullers (1984) Method for Testing the Bias of Unweighted Estimates of Regression Parameters in a Linear Regression Model: Fuller’s Method
SAS Paper with Examples of ODS Graphics and SG Procedures with Examples of Weighted Frequency Plots: SAS Paper with ODS Graphics and SG Procedures Examples
Link to Stata command for calculation of Population Attributable Risk proportions (user written “punaf” command):
https://www.imperial.ac.uk/nhli/r.newson/usergp/uk2012/newson_ohp1.pdf
Multiple Imputation Using the Fully Conditional Specification Method: A Comparison of SAS, Stata, IVEware, and R:Link to Presentation
Analysis of Survey Data Using the SAS SURVEY Procedures: A Primer: Link to Presentation
Link to Web Site with Information about Free Tools for Survey Data Analysis and Map Production:https://www.asdfree.com/2014/12/maps-and-art-of-survey-weighted.htm Link to full code for Map Examples: https://github.com/davidbrae/swmap
SAS Repeated Replication Macro to do Design-Based Poisson Regression (with a comparison to Stata svy: poisson command): Link to Code and Results
R package for fractional hot deck imputation (FHDI) is now available from CRAN (Primary Author, Dr. Jae Kim). Link to Code and Information
Example of using PROC EXPORT to convert SAS data set to Stata (.dta) and SPSS (.sav): SAS PROC EXPORT Example
Example of SAS 9.4 PROC SURVEYMEANS with DOMAIN Statement and DIFF Option for Difference of Means Test. Link to File
Example of Use of R “Convey” Package for Svy GINI Coefficient. Link to File