\name{TestCDFs}
\alias{TestCDFs}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Test CDFs
}
\description{
Tests whether the CDFs of the observed methylation distributions for
each individual are associated with an outcome variable.%%  ~~ A concise (1-5 lines) description of what the function does. ~~
}
\usage{
TestCDFs(Z, y, X = NULL, outcomeType = "C", histBreaks = 1000, numBases = min(histBreaks/4, 35), lambdas = c(0, exp(-10:10)), kernel = "linear", hideProgress = FALSE, adjustmentDichot = FALSE)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{Z}{
    Matrix of methylation values for the individuals in the study.  Each
    row is a different CpG and each column corresponds to a different
    individual.  Missing values are allowed, but omitted for each individual.
}
  \item{y}{
    Vector of outcome variables for each individual in the study.  Each
    element of the vector should be numeric.  Note that for dichotomous
    outcomes y should be 0 or 1.
}
  \item{X}{
    Matrix of possible additional covariates for which adjustment is
    necessary.  Set to NULL of none.
}
  \item{outcomeType}{
    "C" for continuous  or "D" for dichotomous outcomes (y).
}
  \item{histBreaks}{
    Number of points to estimate the ECDF.  Assumed to be evenly spaced
    in [0,1].  Defaults to 1000.
}
  \item{numBases}{
    Number of knots in computing the basis.  Assumed to be evenly in
    [0,1].  Defaults to min(histBreaks/4, 35).
}
  \item{lambdas}{
    Grid of tuning parameters for the B-Spline smoothing over which we
    choose to search.  0 correspond to no smoothing while a larger value
    tends to smooth more.
}
  \item{kernel}{
    Kernel to be used in the testing stage.  In general, the linear
    kernel is reasonable, but alternative kernels are possible.  See
    SKAT package manual for details.
}
  \item{hideProgress}{
    Boolean describing whether the progress of the function should be
    output.  Defaults to FALSE.
}
  \item{adjustmentDichot}{
    For dichotomous outcomes, the  variance component test can
    **sometimes** be conservative.  In general, this is not a problem
    for our setting, but set this to TRUE if adjustments
    should be made for this possible conservatism. 
  }
    \item{knotLocs}{
   Points between 0 and 1 at which the knots should be placed for B-spline estimation.
  }
}
\details{
%%  ~~ If necessary, more details than the description above ~~
}
\value{
p-value for association.  
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
Michael C. Wu
}
\note{
This function is still under development and subject to change.
}

%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
\code{\link{TestDensities}}%% ~~objects to See Also as \code{\link{help}}, ~~~
}
\examples{


# Simulate data set under null
Z1 = matrix(rbeta(10000*20, 0.48, 0.50), ncol = 20) # simulate 20 cases
Z2 = matrix(rbeta(10000*20, 0.48, 0.50), ncol = 20) # simulate 20 controls
Z = cbind(Z1, Z2)
y = rep(c(1,0), each = 20) # simulate outcome
TestCDFs(Z,y,X = NULL)

# Simulate data set under alternative
Z1 = matrix(rbeta(10000*20, 0.48, 0.50), ncol = 20) # simulate 20 cases
Z2 = matrix(rbeta(10000*20, 0.50, 0.48), ncol = 20) # simulate 20 controls
Z = cbind(Z1, Z2)
y = rep(c(1,0), each = 20) # simulate outcome
TestCDFs(Z,y,X = NULL)
}

% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.

\keyword{ ~kwd1 }
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
