##########################
## pbat.m(...) examples ##
##########################
# Note that none of these can be run as they are verbatim.
# They are just meant to be examples.
# load in the data
# Here we assume that:
# data.phe contains 'preds1', 'preds2', 'preds3', 'time',
# 'censor', 'phenos1', ... 'phenos4'
# data.ped contains 'snp1', 'snp2', 'snp3',
# 'block1snp1','block1snp2',
# 'block2snp1','block2snp2'
data.phe <- read.phe( "data" )
data.ped <- read.ped( "data" )
# empty model, does all phenotypes, no predictor covariates, and all
# snps for a snps analysis.
# The ALL and NONE are special phrases that should only be used here,
# although they are case sensative.
res <- pbat.m( ALL ~ NONE, phe, ped, fbat="pc", ... )
summary( res )
res # equivalent to print(res)
# basic model with one phenotype, does all snps (if none specified)
pbat.m( phenos1 ~ preds1, phe, ped, fbat="gee" )
# same model, but with more phenotypes
pbat.m( phenos1 + phenos2 + phenos3 ~ preds1, phe, ped, fbat="gee" )
# does all snps, the mi() tells it should be a marker interaction
pbat.m( phenos1 ~ mi(preds1), phe, ped, fbat="gee" )
# logrank analysis - fbat need not be set
# uses more than one predictor variable
res <- pbat.m( time & censor ~ preds1 + preds2 + preds3, phe, ped )
plot( res )
# single snp analysis (because each snp is seperated by a vertical bar
# '|'), and stratified by group (presence of censor auto-indicates
# log-rank analysis). Note that the group is at the end of the
# expression, and _must_ be at the end of the expression
res <- pbat.m( time & censor ~ preds1^3 + preds2 | snp1 | snp2 |
snp3 / group, temp )
plot( res )
# haplotype analysis, stratified by group
pbat.m( time & censor ~ mi(preds1^2) + mi(preds2^3) | block1snp1
+ block1snp2 | block2snp1 + block2snp2 / group, temp )
# set any of the various options
pbat.m( phenos ~ preds, phe, ped, fbat="pc",
null="linkage, no association", alpha=0.1 )
############################
## pbat.obj(...) examples ##
############################
# These will not function; they only serve as examples.
# ... just indicates there are various options to be put here!
res <- pbat.obj("pedfile", snps=c("snp1,snp2"), preds="pred1", ... )
summary(res)
res
# plot is only available for "logrank"
res <- pbat.obj(..., fbat="logrank")
plot( res )
##############################
## pbat.files(...) examples ##
##############################
# These will not function, but only serve as examples.
# Note in the following example, both "pedfile.ped" and "pedfile.phe"
# must exist. If the names differed, then you must specify the
# option 'phe="phefile.phe"', for example.
res <- pbat.files( "pedfile", phenos=c("phenos1","phenos2"),
screening="conditional power" )
summary(res)
res
Run the code above in your browser using DataLab