S-PLUS/R Functions

Extensions to the S Language

All files below contain source code only, bundled and compressed to a "tar.gz" format. Some packages contain C code (for example, armitage, haplo.stats, ibdreg, kinship, multic, rpart, trex and survival) and require a compiler. All of these packages, except armitage, are available on the Contributed R Archives Network (CRAN), which provides precompiled binaries. You can find package distributions below, along with a brief description, and where indicated, a readme, user manual and note regarding where it is publicly available.



Armitage trend chi-square statistics to evaluate the association of a trait with SNP genotype predictors given a dose vector of length 3. Distributed for R and S-PLUS with install steps given in the README. Dan Schaid, Shannon McDonnell, and Jason Sinnwell. [05/2010]


A suite of S-PLUS routines for preforming bilinear regression fits to 16O/18O isotope labeling of experiments. Jeanette Eckel Passow, Douglas Mahoney. [11/2010]


This software offers a suite of R routines for the analysis of indirectly measured haplotypes.

The statistical methods assume that all subjects are unrelated and that haplotypes are ambiguous (because of unknown linkage phase of the genetic markers). The genetic markers are assumed to be codominant (that is, 1-to-1 correspondence between their genotypes and their phenotypes). [updated December 2013]


Test the fit of genotype frequencies to Hardy-Weinberg Equilibrium proportions for autosomes and the X chromosome. Different statistical tests are provided, as well as an option to evaluate statistical significance by either exact methods or simulations. README and package sources are provided for S-PLUS and R. [02/2011]


A package in S-PLUS and R to test genetic linkage with covariates by regression methods with response IBD sharing for relative pairs. Account for correlations of IBD statistics and covariates for relative pairs within the same pedigree. README and package sources are provided. [12/2006]


This is a suite of interrelated routines, of which the primary ones are coxme (general mixed-effects Cox models), kinship (routines to create and manipulate n by n matrices that describe the genetic relationships between n persons), and pedigree (create and plot pedigrees). Terry Therneau & Beth Atkinson. [04/2005]

Ported to R, can be found on CRAN.


This software offers routines to handle family data with a pedigree object.

The initial purpose was to create correlation structures that describe family relationships, such as kinship and identity-by-descent, which can be used to model family data in mixed effects models, such as in the coxme function. This also includes a tool for pedigree drawing, which is focused on producing compact layouts without intervention.

Recent additions include utilities to trim the pedigree object with various criteria. Terry Therneau, Beth Atkinson, Dan Schaid, Jason Sinnwell, Shannon McDonnell and Martha Matsumoto. [updated December 2013]


Check Pedigrees for Mendelian Errors and, when errors are found, systematically jackknifes every typed pedigree member to determine if eliminating this member will remove all Mendelian Errors from the pedigree. Dan Schaid and Daniel Folie. [02/2011]


S-PLUS/R routines for quantitative linkage analysis using variance components approach, based on the multic routines found in the package ACT. This release allows for univariate, multivariate and longitudinal endpoints and includes model diagnostic tools and easy-to-read result summaries. Mariza de Andrade, Patrick Votruba, and Beth Atkinson. [02/2007]

Distributions for R can also be found on CRAN.


This software offers an R package that performs gene-level kernel and burden association tests for genetic variants with disease status and continuous traits for pedigree data and unrelated subjects.

See: Schaid DJ, et al. Multiple genetic variant association testing by collapsing and kernel methods with pedigree or population structured data. Genetic Epidemiology. 2013;37:409.


These functions create a variety of plots associated with sensitivity and specificity, along with pairwise comparisons of the area under the curve. Beth Atkinson and Doug Mahoney. [06/2004]


Recursive partitioning, an alternative to tree, allows users to create their own splitting rules using code written in Splus. Terry Therneau & Beth Atkinson. [04/2002]


Package that calculates a truncated exact test for two-stage case-control studies for rare genetic variants. The first stage is for screening rare variants in only cases. If the number of case-carriers of any rare variants exceeds a user-specified threshold, then additional cases and controls are genotyped for the detected variants and carrier status of these variants are compared for all cases and controls in the second stage. Distributed as an R package and as a stand-alone program in C. The R package contains an additional function to calculate an optimal 2-stage design. [04/2010]


Spatial normalization of Affymetrix SNP 6.0 cel file, which adjusts for spatial bias based on wavelet decomposition. High Seng Chai. [07/2010]


Calculates normalization Stress and dfArray quality for a set of arrays. Doug Mahoney, Jeannette Eckel-Passow [03/2012]


These functions for survival analysis have been posted to Statlib at irregular intervals as survival (5/90), survival2 (6/91), survival3 (4/93), survival4 (10/94), and survival5 (2/99). The functions are also incorporated directly into S-Plus. The S-Plus versions are normally more up-to-date than the statlib code. Terry Therneau (therneau@mayo.edu). [11/2004]

Distributions for R can also be found on R-Forge. It is currently part of the standard distribution of R.

Useful Functions

Computes power and sample size of chi-squared tests of independence. Ross Dierkhising. [09/1999]
cibinom Computes exact binomial confidence limits (options include exact, arcsin, normal, or anscombe). Terry Therneau. [09/1997]
cipoisson Computes exact Poisson confidence limits (options include exact or anscombe). Terry Therneau. [09/1997]
fastlo Normalizes either a matrix of values or perfect match and mismatch data from a microarray 'Plob' object. Karla Ballman, Terry Therneau, & Diane Grill. [06/2003]
gamterms Returns the individual terms of a 'gam' object, along with the standard errors, in a way that is useful for plotting. Dirk Larson & Terry Therneau. [08/2006]
jitplot Jitters y-values systematically and plots them against x-values (categorical). Beth Atkinson & Terry Therneau. [11/2003]
mlowess The same as lowess except that it allows for missing values. Terry Therneau. [03/2001]
multci Computes simulaneous confidence intervals for multinomial distributions. Ross Dierkhising. [07/2003]
multpower Computes power and sample size of chi-squared test for multinomial distributions. Ross Dierkhising. [07/2001]
plotby Plots x vs. y by z using different colors/symbols for each unique z value, with the option of a lowess or linear line for each group. Beth Atkinson. [11/2003]
plotterm Uses the output of gamterms and produces a plot of the selected term. Terry Therneau. [03/2000]
umbrella Calculates the Peter O'Brien umbrella test for comparing samples with multiple endpoints. Beth Atkinson, Susan Kunselman & Paul Novotny. [06/1999]
waldtest Calculates the Wald test for a contrast matrix C for coefficients from a Cox model. Terry Therneau. [03/2001]

This software is free. You can redistribute and/or modify it under the terms of the GNU General Public License, as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed with helpful intent, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Please give credit where credit is due. If you use functions from Mayo Clinic, please acknowledge the original contributor of the material.