cpg.perm {CpGassoc} | R Documentation |
Perform a Permutation Test of the Association Between Methylation and a Phenotype of Interest
Description
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.
Usage
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)
Arguments
beta.values |
A vector, matrix, or data frame containing the beta values of interest (1 row per CpG site, 1 column per individual). |
indep |
A vector containing the main variable of interest. |
covariates |
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. |
nperm |
The number of permutations to be performed. |
data |
an optional data frame, list or environment (or object coercible by |
seed |
The required seed for random number generation. If not input, will use R's internal seed. |
logit.transform |
logical. If |
chip.id |
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. |
subset |
An optional logical vector specifying a subset of observations to be used in the fitting process. |
random |
logical. If |
fdr.cutoff |
The threshold at which to compare the FDR values. The default setting is .05. Any FDR values less than .05 will be considered significant. |
fdr.method |
Character. Method used to calculate False Discovery Rate. Can be any of the methods listed in |
large.data |
Logical. Enables analyses of large datasets. When |
return.data |
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). |
Value
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:
permutation.matrix |
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. |
gc.permutation.matrix |
Similar to the permutation.matrix only in relation to the genomic control adjusted p-values. |
perm.p.values |
A data frame consisting of the permutation P-values, and the number of permutations performed. |
perm.tstat |
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 |
perm.pval |
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 |
Author(s)
Barfield, R.; Conneely, K.; Kilaru,V.
Maintainer: R. Barfield: <barfieldrichard8@gmail.com>
See Also
cpg.assoc
cpg.work
plot.cpg
scatterplot
cpg.combine
manhattan
plot.cpg.perm
sort.cpg.perm
sort.cpg
cpg.qc
Examples
##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)