File: ttest.tstat.Rd

package info (click to toggle)
r-cran-bayesfactor 0.9.12-4.7%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,492 kB
  • sloc: cpp: 1,555; sh: 16; makefile: 7
file content (90 lines) | stat: -rw-r--r-- 3,292 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ttest_tstat.R
\name{ttest.tstat}
\alias{ttest.tstat}
\title{Use t statistic to compute Bayes factor for one- and two- sample designs}
\usage{
ttest.tstat(
  t,
  n1,
  n2 = 0,
  nullInterval = NULL,
  rscale = "medium",
  complement = FALSE,
  simple = FALSE
)
}
\arguments{
\item{t}{classical t statistic}

\item{n1}{size of first group (or only group, for one-sample tests)}

\item{n2}{size of second group, for independent-groups tests}

\item{nullInterval}{optional vector of length 2 containing lower and upper bounds of an interval hypothesis to test, in standardized units}

\item{rscale}{numeric prior scale}

\item{complement}{if \code{TRUE}, compute the Bayes factor against the complement of the interval}

\item{simple}{if \code{TRUE}, return only the Bayes factor}
}
\value{
If \code{simple} is \code{TRUE}, returns the Bayes factor (against the
null). If \code{FALSE}, the function returns a
vector of length 3 containing the computed log(e) Bayes factor,
along with a proportional error estimate on the Bayes factor and the method used to compute it.
}
\description{
Using the classical t test statistic for a one- or two-sample design, this
function computes the corresponding Bayes factor test.
}
\details{
This function can be used to compute the Bayes factor corresponding to a
one-sample, a paired-sample, or an independent-groups t test, using the
classical t statistic.  It can be used when you don't have access to the
full data set for analysis by \code{\link{ttestBF}}, but you do have the
test statistic.

For details about the model, see the help for \code{\link{ttestBF}}, and the
references therein.

The Bayes factor is computed via Gaussian quadrature.
}
\note{
In version 0.9.9, the behaviour of this function has changed in order to produce more uniform results. In
version 0.9.8 and before, this function returned two Bayes factors when \code{nullInterval} was
non-\code{NULL}: the Bayes factor for the interval versus the null, and the Bayes factor for the complement of
the interval versus the null. Starting in version 0.9.9, in order to get the Bayes factor for the complement, it is required to
set the \code{complement} argument to \code{TRUE}, and the function only returns one Bayes factor.
}
\examples{
## Classical example: Student's sleep data
data(sleep)
plot(extra ~ group, data = sleep)

## t.test() gives a t value of -4.0621
t.test(sleep$extra[1:10], sleep$extra[11:20], paired=TRUE)
## Gives a Bayes factor of about 15
## in favor of the alternative hypothesis
result <- ttest.tstat(t = -4.0621, n1 = 10)
exp(result[['bf']])
}
\references{
Morey, R. D. & Rouder, J. N. (2011). Bayes Factor Approaches for
  Testing Interval Null Hypotheses. Psychological Methods, 16, 406-419

  Rouder, J. N., Speckman, P. L., Sun, D., Morey, R. D., & Iverson, G.
  (2009). Bayesian t-tests for accepting and rejecting the null hypothesis.
  Psychonomic Bulletin & Review, 16, 225-237
}
\seealso{
\code{\link{integrate}}, \code{\link{t.test}}; see
  \code{\link{ttestBF}} for the intended interface to this function, using
  the full data set.
}
\author{
Richard D. Morey (\email{richarddmorey@gmail.com}) and Jeffrey N.
  Rouder (\email{rouderj@missouri.edu})
}
\keyword{htest}