% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/huge.R
\name{huge}
\alias{huge}
\title{High-dimensional undirected graph estimation}
\usage{
huge(
  x,
  lambda = NULL,
  nlambda = NULL,
  lambda.min.ratio = NULL,
  method = "mb",
  scr = NULL,
  scr.num = NULL,
  cov.output = FALSE,
  sym = "or",
  verbose = TRUE,
  input.type = "auto"
)
}
\arguments{
\item{x}{There are 2 options: (1) \code{x} is an \code{n} by \code{d} data matrix (2) a \code{d} by \code{d} sample covariance matrix. The program automatically identifies the input matrix by checking the symmetry. (\code{n} is the sample size and \code{d} is the dimension).}

\item{lambda}{An optional numeric scalar or non-empty one-dimensional
numeric path. For \code{method = "mb"}, \code{"glasso"}, or
\code{"tiger"}, values must be finite, strictly
positive, and non-increasing; ties are allowed. For \code{method = "ct"},
values must be finite and non-negative, zero is allowed, and thresholds
are applied in the supplied order. Leave \code{lambda = NULL} to generate
a path from \code{nlambda} and \code{lambda.min.ratio}.}

\item{nlambda}{The number of regularization/thresholding parameters. The default value is \code{20} for \code{method = "ct"} and \code{10} for \code{method = "mb"}, \code{"glasso"} or \code{"tiger"}.}

\item{lambda.min.ratio}{If \code{method = "mb"}, \code{"glasso"} or \code{"tiger"}, it is the smallest value for \code{lambda}, as a fraction of the upperbound (\code{MAX}) of the regularization/thresholding parameter which makes all estimates equal to \code{0}. The program can automatically generate \code{lambda} as a sequence of length = \code{nlambda} starting from \code{MAX} to \code{lambda.min.ratio*MAX} in log scale. If \code{method = "ct"}, it is the largest sparsity level for estimated graphs. The program can automatically generate \code{lambda} as a sequence of length = \code{nlambda}, which makes the sparsity level of the graph path increases from \code{0} to \code{lambda.min.ratio} evenly.The default value is \code{0.1} when \code{method = "mb"}, \code{"glasso"} or \code{"tiger"}, and 0.05 when \code{method = "ct"}.}

\item{method}{Graph estimation methods with 4 options: \code{"mb"}, \code{"ct"}, \code{"glasso"} and \code{"tiger"}. The default value is \code{"mb"}.}

\item{scr}{If \code{scr = TRUE}, the lossy screening rule is applied to preselect the neighborhood before the graph estimation. The default value is  \code{FALSE}. NOT applicable when \code{method = "ct"} or \code{"tiger"}.}

\item{scr.num}{The neighborhood size after the lossy screening rule (the number of remaining neighbors per node). ONLY applicable when \code{scr = TRUE}. The default value is \code{n-1}. An alternative value is \code{n/log(n)}. ONLY applicable when \code{scr = TRUE} and \code{method = "mb"}.}

\item{cov.output}{If \code{cov.output = TRUE}, the output will include a path of estimated covariance matrices. ONLY applicable when \code{method = "glasso"}. Since the estimated covariance matrices are generally not sparse, please use it with care, or it may take much memory under high-dimensional setting. The default value is \code{FALSE}.}

\item{sym}{Symmetrize the output graphs. If \code{sym = "and"}, the edge between node \code{i} and node \code{j} is selected ONLY when both node \code{i} and node \code{j} are selected as neighbors for each other. If \code{sym = "or"}, the edge is selected when either node \code{i} or node \code{j} is selected as the neighbor for each other. The default value is \code{"or"}. ONLY applicable when \code{method = "mb"} or \code{"tiger"}.}

\item{verbose}{If \code{verbose = FALSE}, tracing information printing is disabled. The default value is \code{TRUE}.}

\item{input.type}{How to interpret \code{x}: \code{"auto"} preserves
symmetry-based detection, \code{"data"} forces an observation matrix,
and \code{"covariance"} requires a square covariance or correlation
matrix. Use \code{"data"} for square symmetric observation matrices.
For glasso covariance input, \code{"auto"} retains the historical
diagonal-sensitive default lambda scale; use \code{"covariance"} for a
scale based only on off-diagonal entries. Glasso may accept an indefinite
pairwise covariance estimate when regularization produces a certified
positive-definite result; CT, MB, and TIGER require positive
semidefiniteness.}
}
\value{
An object with S3 class \code{"huge"} is returned:
\item{data}{
  The \code{n} by \code{d} data matrix or \code{d} by \code{d} sample covariance matrix from the input
}
\item{cov.input}{
  An indicator of the sample covariance.
}
\item{ind.mat}{
  The \code{scr.num} by \code{d} matrix with each column containing the indices of the remaining neighbors of the corresponding variable after the lossy screening. ONLY applicable when \code{scr = TRUE}.
}
\item{lambda}{
  The sequence of regularization parameters used in mb or thresholding parameters in ct.
}
\item{sym}{
  The \code{sym} from the input. ONLY applicable when \code{method = "mb"} or \code{"tiger"}.
}
\item{scr}{
  The \code{scr} from the input. ONLY applicable when \code{method = "mb"} or \code{"glasso"}.
}
\item{path}{
  A list of \code{d} by \code{d} adjacency matrices of estimated graphs as a graph path corresponding to \code{lambda}.
}
\item{sparsity}{
  The sparsity levels of the graph path.
}
\item{icov}{
  A list of \code{d} by \code{d} precision matrices as an alternative graph path (numerical path) corresponding to \code{lambda}. ONLY applicable when \code{method = "glasso"} or \code{"tiger"}.
}
\item{cov}{
  A list of \code{d} by \code{d} estimated covariance matrices corresponding to \code{lambda}. ONLY applicable when \code{cov.output = TRUE} and \code{method = "glasso"}
}
\item{method}{
  The method used in the graph estimation stage.
}
\item{df}{
  If \code{method = "mb"} or \code{"tiger"}, it is a \code{d} by \code{nlambda} matrix. Each row contains the number of nonzero coefficients along the lasso solution path. If \code{method = "glasso"}, it is a \code{nlambda} dimensional vector containing the number of nonzero coefficients along the graph path \code{icov}.
}
\item{loglik}{
  A \code{nlambda} dimensional vector containing the likelihood scores along the graph path (\code{icov}). ONLY applicable when \code{method = "glasso"}. For an estimated inverse covariance Z, the program only calculates log(det(Z)) - trace(SZ) where S is the empirical covariance matrix. For the likelihood for n observations, please multiply by n/2.
}
}
\description{
The main function for high-dimensional undirected graph estimation. Four graph estimation methods, including (1) Meinshausen-Buhlmann graph estimation (\code{mb}) (2) graphical lasso (\code{glasso}) (3) correlation thresholding graph estimation (\code{ct}) and (4) tuning-insensitive graph estimation (\code{tiger}), are available for data analysis.
}
\details{
The graph structure is estimated by Meinshausen-Buhlmann graph estimation or the graphical lasso, and both methods can be further accelerated via the lossy screening rule by preselecting the neighborhood of each variable by correlation thresholding. We target on high-dimensional data analysis usually d >> n, and the computation is memory-optimized using the sparse matrix output. We also provide a highly computationally efficient approaches correlation thresholding graph estimation.
}
\note{
This function ONLY estimates the graph path. For more information about the optimal graph selection, please refer to \code{\link{huge.select}}.\cr
}
\examples{
#generate data
L = huge.generator(n = 50, d = 12, graph = "hub", g = 4)

#graph path estimation using mb
out1 = huge(L$data)
out1
plot(out1)         #Not aligned
plot(out1, align = TRUE) #Aligned
huge.plot(out1$path[[3]])
}
\seealso{
\code{\link{huge.generator}}, \code{\link{huge.select}}, \code{\link{huge.plot}}, \code{\link{huge.roc}}, and \code{\link{huge-package}}.
}
