\HeaderA{haplo.score.slide.w}{Wrapper for haplo.score.slide in haplo.stats package, which is used to identify sub-haplotypes from a group of loci}{haplo.score.slide.w}
\keyword{misc}{haplo.score.slide.w}
\begin{Description}\relax
Wrapper for \code{\LinkA{haplo.score.slide}{haplo.score.slide}}, which is used to identify sub-haplotypes from a group of loci.  Run
haplo.score on all contiguous subsets of size n.slide from the
loci in a genotype matrix (geno).  From each call to haplo.score,
report the global score statistic p-value. Can also report global
and maximum score statistics simulated p-values.
\end{Description}
\begin{Usage}
\begin{verbatim}
haplo.score.slide.w(geneSetObj, 
                    trait.type = "gaussian", 
                    n.slide = 2, 
                    offset = NA, 
                    x.adj = NA, 
                    skip.haplo = 5/(2 * nrow(geno)), 
                    locus.label = NA, 
                    miss.val = c(0, NA), 
                    simulate = FALSE, 
                    sim.control = score.sim.control(), 
                    em.control = haplo.em.control())
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{geneSetObj}] A geneSet object
\item[\code{trait.type}] Character string defining type of trait, with values of
\dQuote{gaussian}, \dQuote{binomial}, \dQuote{poisson}, \dQuote{ordinal}.
\item[\code{n.slide}] Number of loci in each contiguous subset.  The first subset
is the ordered loci numbered 1 to n.slide, the second subset
is 2 through \code{n.slide}+1 and so on.  If the total number of
loci in geno is \code{n.loci}, then there are \code{n.loci} - \code{n.slide} + 1 total subsets.

\item[\code{offset}] Vector of offset when trait.type = \dQuote{poisson}
\item[\code{x.adj}] Matrix of non-genetic covariates used to adjust the score
statistics.  Note that intercept should not be included,  as
it will be added in this function.

\item[\code{skip.haplo}] Skip score statistics for haplotypes with frequencies <
\code{skip.haplo}. The default is for an expected count of 5 out of
the 2*N haplotype  occurrences.
\item[\code{locus.label}] Vector of labels for loci.
\item[\code{miss.val}] Vector of values that represent missing alleles in geno.
\item[\code{simulate}] Logical:  if [F]alse, no empirical p-values are computed; if
[T]rue, simulations are performed. Specific simulation
parameters can be controlled in the sim.control parameter
list.

\item[\code{sim.control}] list of control parameters to determine how simulations
are performed for simulated p-values. The list is created by
the function \code{\LinkA{score.sim.control}{score.sim.control}} and the default values of this
function can be changed as desired. See \code{\LinkA{score.sim.control}{score.sim.control}} for
details.
\item[\code{em.control}] A list of control parameters to determine how to perform
the EM algorithm for estimating haplotype frequencies when
phase is   unknown. The list is created by the function
\code{\LinkA{haplo.em.control}{haplo.em.control}} - see this function for more details
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Please refer to \code{\LinkA{haplo.score.slide}{haplo.score.slide}} for more details.
\end{Details}
\begin{Value}
List with the following components:

\begin{ldescription}
\item[\code{df}] Data frame with start locus, global p-value, simulated global p-value,
and simulated maximum-score p-value.

\item[\code{n.loci}] Number of loci given in the genotype matrix.

\item[\code{simulate}] Same as parameter description above.

\item[\code{n.slide}] Same as parameter description above.

\item[\code{locus.label}] Same as parameter description above.

\item[\code{n.val.haplo}] Vector containing the number of valid simulations used in the
maximum-score statistic p-value simulation.  The number of valid simulations
can be less than the number of simulations requested (by sim.control)
if simulated data sets produce unstable variables of the score
statistics. 

\item[\code{n.val.global}] Vector containing the number of valid simulations used in the
global score statistic p-value simulation.  

\end{ldescription}
\end{Value}
\begin{Note}\relax
~~further notes~~
\end{Note}
\begin{Author}\relax
Weiliang Qiu \email{stwxq@channing.harvard.edu}, Ross Lazarus \email{ross.lazarus@channing.harvard.edu}
\end{Author}
\begin{References}\relax
~put references to the literature/web site here ~
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{haplo.em.w}{haplo.em.w}}, \code{\LinkA{haplo.scan.w}{haplo.scan.w}}, \code{\LinkA{haplo.score.w}{haplo.score.w}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

## The function is currently defined as
"haplo.score.slide.w"
\end{ExampleCode}
\end{Examples}

