Skip to content

epstein-software/BiasedUrn

Repository files navigation

BiasedUrn

Using the R package BiasedUrn to implement a permutation procedure to correct for confounders in case-control studies

Introduction

In our recent paper (Epstein, et al., 2012), we proposed to adjust case-control association tests (including tests of rare variation) for confounders using a permutation approach. The approach, which can adjust for an arbitrary number of continuous and categorical covariates, can be implemented using a modified version of an open source R package called BiasedUrn authored and maintained at CRAN by Agner Fog. This page describes how to modify and install this package and also provides sample code for implementing the approach.

The R base system

R is a widely-used, free and open source software environment for statistical computing and graphics. The most recent version of R can be downloaded from the Comprehensive R Archive Network (CRAN). CRAN provides precompiled binary versions of R for Windows, MacOS, and select Linux distributions that are likely sufficient for many users' needs. Users can also install R from source code; however this may require a significant amount of effort. For specific details on how to compile, install, and manage R and R-packages, refer to the manual R Installation and Administration, which is available from the CRAN documentation site.

Building the BiasedUrn package

While a precompiled version of the BiasedUrn library is available on CRAN, this precompiled version cannot be used for the sampling performed in our AJHG paper because it only allows for a maximum of 32 subjects (see our paper for more details). Consequently, to increase the sample size to values anticipated for case-control association studies, one must download the source code for BiasedUrn, make a minor change to the source code, and then recompile and install the modified executable for analysis. We describe how to perform these tasks for different operating systems below.

Step 1: Downloading the package source

To obtain the BiasedUrn package source code, go to the repository for the package on CRAN and download the source file BiasedUrn_1.04.tar.gz as highlighted in Figure 1.

alt text

Figure 1. The BiasedUrn package page at CRAN. The package source link is highlighted here.

Step 2: Modifying, compiling, and installing the BiasedUrn Package

Each operating system uses a different set of developer tools to build R packages from source code; however, the basic steps are the same for each operating system:

  • modify the MAXCOLORS constant in the Makevars file found within the package source code
  • run the R CMD check command to verify the modified package
  • run the R CMD build command to create an installable package
  • run the R CMD INSTALL command to install the modified package

We provide OS-specific instructions for modifying and installing the source code below:

Using modified BiasedUrn to create permuted datasets

Once the modified version of BiasedUrn is properly installed, the procedure can be used to generate permuted case-control datasets that are adjusted for confounders. Please see our sample R code for an example that uses the procedure.

Questions and technical support

For questions or concerns with the BiasedUrn package, please contact Richard Duncan and Michael Epstein.
We appreciate any feedback you have with our site and instructions. wordcloud-biased-urn-permutation-sampling_ajhg-2012

Epstein software | Human Genetics | School of Medicine | Emory University

About

This R package is a modified version of the 'BiasedUrn' package developed by Agner Fog; the original package can be found on the CRAN site. We created this modified package to facilitate permutation-based testing of disease-exposure association in case-control studies that accounts for potential confounders. In particular, such permutation-based…

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors