RDocumentation: snp.logistic
  • AI Chat
  • Code
  • Report
  • Beta
    Spinner

    Note that this notebook was automatically generated from an RDocumentation page. It depends on the package and the example code whether this code will run without errors. You may need to edit the code to make things work.

    if(!require('CGEN')) {
        install.packages('CGEN')
        library('CGEN')
    }
     # Use the ovarian cancer data
     data(Xdata, package="CGEN")
    
     # Fit using a stratification (categorical) variable
     ret <- snp.logistic(Xdata, "case.control", "BRCA.status",
                         main.vars=c("oral.years", "n.children"), 
                         int.vars=c("oral.years", "n.children"), 
                         strata.var=~factor(ethnic.group))
    
     # Compute a summary table for the models
     getSummary(ret)
    
     # Compute a Wald test for the main effect of the SNP and interaction
     getWaldTest(ret, c("BRCA.status", "BRCA.status:oral.years", "BRCA.status:n.children"))
    
     # Fit the same model as above using formulas
     ret2 <- snp.logistic(Xdata, "case.control", "BRCA.status",
                         main.vars=~oral.years + n.children, 
                         int.vars=~oral.years + n.children, 
                         strata.var=~factor(ethnic.group))