Learn R Programming

CGEN (version 3.8.0)

snp.effects: Joint and Stratified Effects

Description

Computes joint and stratified effects of the SNP and another variable based on a fitted model.

Usage

snp.effects(fit, var, var.levels=c(0, 1), method=NULL)

Arguments

fit
Return object from snp.logistic or snp.matched. If fit is the return object from snp.matched, then the snp.vars argument in snp.matched must consist of a single SNP. No default.
var
Name of the second variable to compute the effects for. This variable can be a dummy variable, continuous variable, or a factor. Note that if this variable enters the model as both a main effect and interaction, then it must enter the model the same way as a main effect and interaction for the effects to be computed correctly. For example, if var is a factor as a main effect, then it also must be a factor as an interaction. No default.
var.levels
(For continuous var) Vector of levels. First level is assumed to be the baseline level. The default is c(0, 1).
method
Vector of values from "UML", "CML", "EB" or "CCL", "HCL", "CLR". The default is NULL.

Value

If fit is of class snp.logistic, then the return object is a list of with names "UML", "CML", and "EB". If fit is of class snp.matched, then the return object is a list of with names "CLR", "CCL", and "HCL". Each sublist contains joint effects, stratified effects, standard errors and confidence intervals. The sub-group effect of the SNP stratified by var is in the list "StratEffects", and the sub-group effect of var stratified by the SNP is in the list "StratEffects.2".

Details

The joint and stratified effects are computed for each method in fit. The stratified effects are the sub-group effect of the SNP stratified by var and the sub-group effect of var stratified by the SNP. Definition of joint and stratified effects: Consider the model: $$logit(P(y=1)) = \alpha + \beta SNP + \gamma X + \delta SNP X.$$ Let 0 be the baseline for SNP and $x_0$ the baseline for X. Then the joint effect for SNP = s and X = x relative to SNP = 0 and X = $x_0$ is $$ \frac{\exp(\alpha + \beta s + \gamma x + \delta s x)}{\exp(\alpha + \gamma x_0)}$$ The stratified effect of the SNP relative to SNP = 0 given X = x is $$ \frac{\exp(\alpha + \beta s + \gamma x + \delta s x)}{\exp(\alpha + \gamma x)}$$ The stratified effect of var relative to X = x given SNP = s is $$ \frac{\exp(\alpha + \beta s + \gamma x + \delta s x)}{\exp(\alpha + \beta s)}$$ A convenient way to print the returned object to view the effects tables is with the function printEffects.

See Also

printEffects snp.effects.plot

Examples

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

 # Fit using a stratification variable
 fit <- snp.logistic(Xdata, "case.control", "BRCA.status",
                     main.vars=c("oral.years", "n.children"), 
                     int.vars=c("oral.years", "n.children"), 
                     strata.var="ethnic.group")

 # Compute the effects
 effects <- snp.effects(fit, "oral.years", var.levels=0:5) 

Run the code above in your browser using DataLab