Learn R Programming

CGEN (version 3.8.0)

snp.effects.plot: Effects plot

Description

Creates a plot of the effects returned from snp.effects

Usage

snp.effects.plot(obj.list, op=NULL)

Arguments

obj.list
Return object or list of return objects from snp.effects. No default.
op
List of options (see details). The default is NULL.

Details

Plots the effects returned from snp.effects. By default, the effects in StratEffects for each method will be plotted. The side of the effect will have a sawtooth edge if the effect goes beyond the limits of the plot.

Options list op: Below are the names for the options list op. All names have default values if they are not specified.

  • method Character vector of the values "UML", "CML", "EB", "HCL", "CCL", "CLR". The default is all methods will be plotted.
  • type One of "JointEffects", "StratEffects", "StratEffects.2". The default is StratEffects.
  • ylim NULL or a 2-element numeric vector specifying the y-axis limits for all plots. If not specified, different plots will be on different scales. The default is NULL.
  • legend See legend. Set to NA for no legend to appear. The default is NULL.
  • split.screen NULL or a 2-element vector for partitioning the plot window. This option is only valid for inputing a list of objects. The default is NULL.
  • colors Character vector of colors to use in the plot. See colors for all possible colors. The default is NULL.
  • levels1 Vector of levels for the SNP variable to plot. When plotting more than one method, levels1 has the default value of 1. Otherwise, the default is NULL.
  • levels2 Vector of levels to plot for the variable var (in snp.effects). The default is NULL.
  • addCI 0 or 1 to add 95% confidence intervals to the plot. The confidence intervals appear as un-filled boxes around each odds-ratio. The default is 0.

See Also

snp.effects

Examples

Run this code
 # Use the ovarian cancer data
 data(Xdata, package="CGEN")

 # Add some fake SNPs
 set.seed(636)
 Xdata[, "rs123"] <- rbinom(nrow(Xdata), 1, 0.4)
 Xdata[, "rs456"] <- rbinom(nrow(Xdata), 1, 0.4)
 Xdata[, "rs789"] <- rbinom(nrow(Xdata), 1, 0.4)

 snpVars <- c("BRCA.status", "rs123", "rs456", "rs789")
 objects <- list()
 for (i in 1:length(snpVars)) {
   fit <- snp.logistic(Xdata, "case.control", snpVars[i],
                     main.vars=c("oral.years", "n.children"), 
                     int.vars=c("oral.years", "n.children"), 
                     strata.var="ethnic.group")

   # Compute the effects
   objects[[i]] <- snp.effects(fit, "oral.years", var.levels=0:4)
 } 

 # Plot
 snp.effects.plot(objects)

 # Plot all on the same scale
 #snp.effects.plot(objects, op=list(ylim=c(0.9, 1.4), legend=list(x="bottom")))

 # Plot all the joint effects of rs789 for the CML method and add confidence intervals
 #snp.effects.plot(objects[[4]], op=list(method="CML", type="JointEffects",
 #        legend=list(x="bottomleft", inset=0), ylim=c(0.45, 1.3),
 #        colors=c("blue", "aquamarine", "skyblue"), addCI=1))

Run the code above in your browser using DataLab