% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/TestNet.R
\name{TestNet}
\alias{TestNet}
\title{A testing method for inferring microbial networks}
\usage{
TestNet(
  otu.tab,
  clustered.data = FALSE,
  cluster.id = NULL,
  fdr.nominal = 0.1,
  n.perm.max = NULL,
  seed = NULL,
  verbose = TRUE
)
}
\arguments{
\item{otu.tab}{An \code{n.sam} by \code{n.otu} matrix of read counts.}

\item{clustered.data}{A logical variable indicating whether the samples are clustered. The default is FALSE.}

\item{cluster.id}{An array of \code{n.sam} cluster identifiers, used in the permutation procedure to shuffle the samples as a whole across clusters and simultaneously shuffle the samples within clusters when \code{clustered.data=TRUE}. The default is NULL.}

\item{fdr.nominal}{The nominal FDR level. The default is 0.1.}

\item{n.perm.max}{The maximum number of permutation replicates. The default is NULL, in which case a maximum of \code{n.otu} * \code{n.rej.stop} * (1/\code{fdr.nominal}) are used, where \code{n.rej.stop} is set to 20.}

\item{seed}{A single-value integer seed for the random process of drawing permutation replicates. The default is NULL.}

\item{verbose}{A logical variable indicating whether to write information messages to the console. The default is TRUE.}
}
\value{
a list consisting of 
  \item{p.linear}{An \code{n.otu} by \code{n.otu} matrix of p-values for the linear tests}
  \item{q.linear}{An \code{n.otu} by \code{n.otu} matrix of q-values for the linear tests}
  \item{p.nonlinear}{An \code{n.otu} by \code{n.otu} matrix of p-values for the nonlinear tests}
  \item{q.nonlinear}{An \code{n.otu} by \code{n.otu} matrix of q-values for the nonlinear tests}
  \item{p.omni}{An \code{n.otu} by \code{n.otu} matrix of p-values for the omnibus tests}
  \item{q.omni}{An \code{n.otu} by \code{n.otu} matrix of q-values for the omnibus tests}
  \item{which.pmin}{An \code{n.otu} by \code{n.otu} matrix of 0, 1, and 2 values, where 0 and 1 indicate that the nonlinear and linear tests, 
respectively, achieved the minimum p-value between the two, and 2 indicates that both tests yielded similar p-values.}
  \item{seed}{the seed used to generate the permutation replicates}
}
\description{
This function generates a p-value and a q-value for each (linear, nonlinear, or omnibus) test of a pair of taxa.
}
\examples{
data(sim.otu.tab)
TestNet.res <- TestNet(otu.tab = sim.otu.tab, n.perm.max = 100) # recommend to use n.perm.max = NULL
}
\references{
Su C, Mao Y, He M, Van Doren VE, Kelley CF, Hu YJ (2026). TestNet: a method for inferring microbial networks with false discovery rate control for clustered and unclustered samples. Genome Biology, in press.
}
\author{
Yi-Juan Hu <yijuanhu@bicmr.pku.edu.cn>
}
\keyword{microbiome}
\keyword{network}
