#########################################################################################
# The routine for calculating sample size required when planning a clinical proteomic
# profiling study is provided in the sampleSize function. First, this functions performs
# computations for sample size parameters, that include: the biological variance, the
# tecnical variance, the differences to be estimated, the intraclass correlation
# (if unknown). These computations are done ase follows:
#########################################################################################
#########################################################################################
# biological variation, difference to be estimated, and the p-values for differential-
# expression are computed using the generic function: betweensampleVariance
# It requires data of a aclinicalProteomicsData class, as input
########################################################################
###################################################
# Creating data of a aclinicalProteomicsData class
###################################################
data(liverdata)
data(liver_pheno)
OBJECT=new("aclinicalProteomicsData")
OBJECT@rawSELDIdata=as.matrix(liverdata)
OBJECT@covariates=c("tumor" , "sex")
OBJECT@phenotypicData=as.matrix(liver_pheno)
OBJECT@variableClass=c('numeric','factor','factor')
OBJECT@no.peaks=53
Data=OBJECT
#################################################################################
# Data manipulation carried out internally by the betweensampleVariance function
#################################################################################
rawData <- proteomicsExprsData(Data)
no.peaks <- Data@no.peaks
JUNK_DATA <- sampleClusteredData(rawData,no.peaks)
JUNK_DATA=negativeIntensitiesCorrection(JUNK_DATA)
# we use the log base 2 expression values
LOG_DATA <- log2(JUNK_DATA)
#######################################################################################
# compute biological variation, difference to be estimated, and the p-values
#######################################################################################
BiovarDiffSig <- betweensampleVariance(OBJECT)
BiovarDiffSig
#####################
# technical variance
#####################
sample_technicalVariance(Data)
#######################################################################################
# heterogeneity correction-factor is the second diagonal element of the output
# matrix from the fisherInformation function, i.e. from the expected Fisher Information
########################################################################################
Z <- as.vector(fisherInformation(Data)[2,2])/2
Z
###################################################################################
# The outputs of these functions are converted into statistics used in
# the sample size calculations using a wraper function sampleSizeParameters
# it gives the consensus parameter values. You must specify the p-value and the
# intraclass correation, cutoff. The description of how these parameters
# are chosen is given in Nyangoma, et al. (2009).
###################################################################################
intraclasscorr <- 0.60 #cut-off for intraclass correlation
signifcut <- 0.05 #significance cut-off
sampleparameters=sampleSizeParameters(Data,intraclasscorr,signifcut)
#######################################################################################
# SAMPLE SIZE CALCULATIONS
#The function sampleSize calculates the protein variance, difference to be estimated,
# the technical varaince. These parameters are computed from statistics of peaks with
# medium biological variation.
# It also gives sample sizes for beta=c(0.90,0.80,0.70) and alpha = c(0.001, 0.01,0.05)
#######################################################################################
samplesize <- sampleSize(OBJECT,intraclasscorr,signifcut)
samplesize
Run the code above in your browser using DataLab