The R Project SVN R

Rev

Rev 74265 | Rev 83699 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 74265 Rev 77281
Line 41... Line 41...
41
    correction in the normal approximation for the p-value.}
41
    correction in the normal approximation for the p-value.}
42
  \item{conf.int}{a logical indicating whether a confidence interval
42
  \item{conf.int}{a logical indicating whether a confidence interval
43
    should be computed.}
43
    should be computed.}
44
  \item{conf.level}{confidence level of the interval.}
44
  \item{conf.level}{confidence level of the interval.}
45
  \item{formula}{a formula of the form \code{lhs ~ rhs} where \code{lhs}
45
  \item{formula}{a formula of the form \code{lhs ~ rhs} where \code{lhs}
46
    is a numeric variable giving the data values and \code{rhs} a factor
46
    is a numeric variable giving the data values and \code{rhs} either 
-
 
47
    \code{1} for a one-sample or paired test or a factor
47
    with two levels giving the corresponding groups.}
48
    with two levels giving the corresponding groups. If \code{lhs} is of 
-
 
49
    class \code{"Pair"} and \code{rhs} is \code{1}, a paired test is done}
48
  \item{data}{an optional matrix or data frame (or similar: see
50
  \item{data}{an optional matrix or data frame (or similar: see
49
    \code{\link{model.frame}}) containing the variables in the
51
    \code{\link{model.frame}}) containing the variables in the
50
    formula \code{formula}.  By default the variables are taken from
52
    formula \code{formula}.  By default the variables are taken from
51
    \code{environment(formula)}.}
53
    \code{environment(formula)}.}
52
  \item{subset}{an optional vector specifying a subset of observations
54
  \item{subset}{an optional vector specifying a subset of observations
Line 184... Line 186...
184
wilcox.test(y - x, alternative = "less")    # The same.
186
wilcox.test(y - x, alternative = "less")    # The same.
185
wilcox.test(y - x, alternative = "less",
187
wilcox.test(y - x, alternative = "less",
186
            exact = FALSE, correct = FALSE) # H&W large sample
188
            exact = FALSE, correct = FALSE) # H&W large sample
187
                                            # approximation
189
                                            # approximation
188
 
190
 
-
 
191
## Formula interface to one-sample and paired tests
-
 
192
 
-
 
193
depression <- data.frame(first = x, second = y, change = y - x)
-
 
194
wilcox.test(change ~ 1, data = depression)
-
 
195
wilcox.test(Pair(first, second) ~ 1, data = depression)
-
 
196
 
189
## Two-sample test.
197
## Two-sample test.
190
## Hollander & Wolfe (1973), 69f.
198
## Hollander & Wolfe (1973), 69f.
191
## Permeability constants of the human chorioamnion (a placental
199
## Permeability constants of the human chorioamnion (a placental
192
##  membrane) at term (x) and between 12 to 26 weeks gestational
200
##  membrane) at term (x) and between 12 to 26 weeks gestational
193
##  age (y).  The alternative of interest is greater permeability
201
##  age (y).  The alternative of interest is greater permeability
Line 203... Line 211...
203
 
211
 
204
## Formula interface.
212
## Formula interface.
205
boxplot(Ozone ~ Month, data = airquality)
213
boxplot(Ozone ~ Month, data = airquality)
206
wilcox.test(Ozone ~ Month, data = airquality,
214
wilcox.test(Ozone ~ Month, data = airquality,
207
            subset = Month \%in\% c(5, 8))
215
            subset = Month \%in\% c(5, 8))
-
 
216
 
208
}
217
}
-
 
218
 
-
 
219
 
209
\keyword{htest}
220
\keyword{htest}