\name{haplo.score.w}
\alias{haplo.score.w}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{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}
\description{
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.
}
\usage{
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())
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{geneSetObj}{ A geneSet object}
  \item{trait.type}{ Character string defining type of trait, with values of
   \dQuote{gaussian}, \dQuote{binomial}, \dQuote{poisson}, \dQuote{ordinal}.}
  \item{offset}{ Vector of offset when trait.type = \dQuote{poisson} }
  \item{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{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{locus.label}{ Vector of labels for loci. }
  \item{miss.val}{ vector of values that represent missing alleles in geno.}
  \item{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{sim.control}{ List of control parameters to determine how simulations
   are performed for simulated p-values. The list is created by
   the function \code{\link[haplo.stats]{score.sim.control}} and the default values of this
   function can be changed as desired. See \code{\link[haplo.stats]{score.sim.control}} for
   details.}
  \item{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{\link[haplo.stats]{haplo.em.control}} - see this function for more details}
}
\details{
Please refer to \code{\link[haplo.stats]{haplo.score}} for more details.
}
\value{
List with the following components:

\item{score.global}{
Global statistic to test association of trait with 
haplotypes that have frequencies >= skip.haplo.
}
\item{df}{
Degrees of freedom for score.global.
}
\item{score.global.p}{
P-value of score.global based on chi-square distribution, 
with degrees of freedom equal to df.
}
\item{score.global.p.sim}{
P-value of score.global based on simulations
(set equal to NA when simulate=F).
}
\item{score.haplo}{
Vector of score statistics for individual
haplotypes that have frequencies >= skip.haplo.
}
\item{score.haplo.p}{
Vector of p-values for score.haplo, based on a
chi-square distribution with 1 df.
}
\item{score.haplo.p.sim}{
Vector of p-values for score.haplo, based on
simulations (set equal to NA when simulate=F).
}
\item{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{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{hap.prob}{
Vector of haplotype probabilies, corresponding to the
haplotypes in the matrix haplotype.
}
\item{locus.label}{
Vector of labels for loci, of length  K  (same  as
input argument).
}
\item{simulate}{
Same as function input parameter.  If [T]rue, simulation results are
included in the haplo.score object.
}
\item{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{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.
}
}
\references{ ~put references to the literature/web site here ~ }
\author{ }
\note{ ~~further notes~~ 
}
\seealso{ \code{\link{haplo.em.w}}, \code{\link{haplo.scan.w}}, \code{\link{haplo.score.slide.w}}}
\examples{
##---- 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"
}
\keyword{ misc }% at least one, from doc/KEYWORDS