Calls cpg.assoc
to get the observed P-values from the study and then performs a user-specified number of permutations to calculate an emperical p-value.
In addition to the same test statistics computed by cpg.assoc
, cpg.perm
will compute the permutation p-values for the observed p-value, the number of Holm significant sites, and the number of FDR significant sites.
cpg.perm(beta.values, indep, covariates = NULL, nperm, data = NULL, seed = NULL,
logit.transform = FALSE, chip.id = NULL, subset = NULL, random = FALSE,
fdr.cutoff = 0.05, fdr.method = "BH",large.data=FALSE,return.data=FALSE)
The item returned will be of class "cpg.perm"
. It will contain all of the values of class cpg (cpg.assoc
) and a few more:
A matrix consisting of the minimum observed P-value, the number of Holm significant CpG sites, and the number of FDR significant sites for each permutation.
Similar to the permutation.matrix only in relation to the genomic control adjusted p-values.
A data frame consisting of the permutation P-values, and the number of permutations performed.
If one hundred or more permutations were performed and indep is a continuous variable, consists of the quantile .025 and .975 of observed t-statistics for each permutation, ordered from smallest to largest.
perm.tstat is used by plot.cpg.perm
to compute the confidence intervals for the QQ plot of t-statistics. Otherwise NULL
.
If one hundred or more permutations were performed, consists of the observed p-values for each permutation, ordered from smallest to largest. perm.pval is usd by plot.cpg.perm
to compute
the confidence intervals for the QQ plot of the p-values. Otherwise NULL.
A vector, matrix, or data frame containing the beta values of interest (1 row per CpG site, 1 column per individual).
A vector containing the main variable of interest. cpg.assoc
will evaluate the association between indep and the beta values.
A data frame consisting of the covariates of interest. covariates can also be a matrix if it is a model matrix minus the intercept column.
It can also be a vector if there is only one covariate of interest. Can also be a formula(e.g. ~cov1+cov2
).
The number of permutations to be performed.
an optional data frame, list or environment (or object coercible by as.data.frame
to a data frame) containing the variables in the model. If not found in data, the variables are taken from the environment from which cpg.perm
is called.
The required seed for random number generation. If not input, will use R's internal seed.
logical. If TRUE
, the logit transform of the beta values log(beta.val/(1-beta.val)) will be used. Any values equal to zero or one will be set to the
next smallest or next largest value respectively; values <0 or >1 will be set to NA.
An optional vector containing chip, batch identities, or other categorical factor of interest to the researcher. If specified, chip id will be included as a factor in the model.
An optional logical vector specifying a subset of observations to be used in the fitting process.
logical. If TRUE
, the chip.id will be processed as a random effect, and a random intercept model will be fitted.
The threshold at which to compare the FDR values. The default setting is .05. Any FDR values less than .05 will be considered significant.
Character. Method used to calculate False Discovery Rate. Can be any of the methods listed in p.adjust
. The default method is "BH" for the Benjamini & Hochberg method.
Logical. Enables analyses of large datasets. When large.data=TRUE
, cpg.assoc
avoids memory problems by performing the analysis in chunks. Note: this option no longer works within windows systems. Based on reading max memory allowable by the system. Defaults to False.
Logical. cpg.assoc can return dataframes containing the the variable of interest, covariates, and the chip id (if present). Defaults to FALSE. Set to TRUE if plan on using the downstream scatterplot functions).
Barfield, R.; Conneely, K.; Kilaru,V.
Maintainer: R. Barfield: <barfieldrichard8@gmail.com>
cpg.assoc
cpg.work
plot.cpg
scatterplot
cpg.combine
manhattan
plot.cpg.perm
sort.cpg.perm
sort.cpg
cpg.qc
##Loading the data
data(samplecpg,samplepheno,package="CpGassoc")
#Performing a permutation 10 times
Testperm<-cpg.perm(samplecpg[1:200,],samplepheno$weight,seed=2314,nperm=10,large.data=FALSE)
Testperm
#All the contents of CpGassoc are included in the output from Testperm
#summary function works on objects of class cpg.perm
summary(Testperm)
Run the code above in your browser using DataLab