This repository provides a demonstration on how to use the R
package camp
The source code has been tested on Microsoft's Windows 10 operating system and Linux (Ubuntu 18.04). The source code should be compatible with Windows, Mac, and Linux operating systems.
Before using R
package, users should have R
version 4.3.0 or higher, and several packages installed.
First, we need to install camp
:
install.packages("camp_1.1.tar.gz", repos = NULL)
Then, we need to install survival
:
install.packages("survival")
which should install within a couple of minutes on a standard machine.
To run the simulated data example, you will also need to install MCMCpack
:
install.packages("MCMCpack")
We first load all the dependencies required by the package:
library(camp)
library(survival)
library(MCMCpack)
The data can be generated by running the following code:
seed <- 1
n1 <- 100
n2 <- 100
p <- 1000
signal.prop <- 0.8
sum.const <- signal.prop
a <- 353
camp.dat <- GenData(seed, n1, n2, p, signal.prop, sum.const, a)
camp.dat
is a list which contains a (n x p
) OTU table and a length n
vector of group labels.
Then, in order to run camp, we simply need to input the OTU table and corresponding group labels.
camp.res <- camp(camp.dat$OTU, camp.dat$Group)
head(camp.res)
Depending the number of covariates included, the output is either a length p
vector of p-values or a (p x q
) data frame of p-values. In this case, since the covariate cov
only involves the group label (length n
vector), the output of camp
is a length n
vector of p-values.
> head(camp.res)
[1] 4.381610e-03 1.110223e-16 1.297482e-08 3.955734e-03 1.526363e-07
[6] 1.177519e-05