\HeaderA{haplo.score.w}{Wrapper for computing score statistics to evaluate the association of a trait with haplotypes, when linkage phase is unknown and diploid marker phenotypes are observed among unrelated subjects}{haplo.score.w}
\keyword{misc}{haplo.score.w}
\begin{Description}\relax
wrapper for computing score statistics to evaluate the association of a trait with haplotypes, when linkage phase is unknown and diploid marker phenotypes are observed among unrelated subjects. For now, only autosomal loci are considered.
\end{Description}
\begin{Usage}
\begin{verbatim}
haplo.score.w(geneSetObj, 
              trait.type = "gaussian", 
              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{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}{haplo.score}} for more details.
\end{Details}
\begin{Value}
List with the following components:

\begin{ldescription}
\item[\code{score.global}] Global statistic to test association of trait with 
haplotypes that have frequencies >= skip.haplo.

\item[\code{df}] Degrees of freedom for score.global.

\item[\code{score.global.p}] P-value of score.global based on chi-square distribution, 
with degrees of freedom equal to df.

\item[\code{score.global.p.sim}] P-value of score.global based on simulations
(set equal to NA when simulate=F).

\item[\code{score.haplo}] Vector of score statistics for individual
haplotypes that have frequencies >= skip.haplo.

\item[\code{score.haplo.p}] Vector of p-values for score.haplo, based on a
chi-square distribution with 1 df.

\item[\code{score.haplo.p.sim}] Vector of p-values for score.haplo, based on
simulations (set equal to NA when simulate=F).

\item[\code{score.max.p.sim}] Simulated p-value indicating for simulations the number of times a 
maximum score.haplo value exceeds the maximum score.haplo from the
original data (equal to NA when simulate=F).

\item[\code{haplotype}] Matrix of hapoltypes  analyzed.  The ith row of
haplotype corresponds to the ith item of score.haplo,
score.haplo.p, and score.haplo.p.sim.

\item[\code{hap.prob}] Vector of haplotype probabilies, corresponding to the
haplotypes in the matrix haplotype.

\item[\code{locus.label}] Vector of labels for loci, of length  K  (same  as
input argument).

\item[\code{simulate}] Same as function input parameter.  If [T]rue, simulation results are
included in the haplo.score object.

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

\item[\code{n.val.haplo}] Vector containing the number of valid simulations used in the p-value
simulations for maximum-score statistic and scores for the individual
haplotypes.

\end{ldescription}
\end{Value}
\begin{Note}\relax
~~further notes~~
\end{Note}
\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.slide.w}{haplo.score.slide.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.w"
\end{ExampleCode}
\end{Examples}

