ttest {intRvals} | R Documentation |
Student's t-test to compare two means of objects of class intRvals
Description
Performs one and two sample t-tests on objects of class intRvals
Usage
ttest(
x,
y = NULL,
alternative = c("two.sided", "less", "greater"),
mu = 0,
var.equal = FALSE,
conf.level = 0.95
)
Arguments
x |
an object of class |
y |
an (optional) object of class |
alternative |
a character string specifying the alternative hypothesis, must be one of " |
mu |
a number indicating the true value of the mean (or difference in means if you are performing a two sample test). |
var.equal |
a logical variable indicating whether to treat the two variances as being equal. If TRUE then the pooled variance is used to estimate the variance otherwise the Welch (or Satterthwaite) approximation to the degrees of freedom is used. |
conf.level |
confidence level of the interval |
Details
alternative = "greater"
is the alternative that x
has a larger mean than y
.
If the input data are effectively constant (compared to the larger of the two means) an error is generated.
Value
A list with class "htest
" containing the same components as in t.test
Examples
data(goosedrop)
dr=estinterval(goosedrop$interval)
# perform a one-sample t-test
ttest(dr,mu=200) #> FALSE, true mean not equal to 200
# two sample t-test
data.beforeMay=goosedrop[goosedrop$date<as.POSIXct('2013-05-01'),]
data.afterMay=goosedrop[goosedrop$date>as.POSIXct('2013-05-01'),]
dr.beforeMay=estinterval(data.beforeMay$interval)
dr.afterMay=estinterval(data.afterMay$interval)
ttest(dr.beforeMay,dr.afterMay)