ttest: Student's t-test to compare two means of objects of class...

ttestR 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 intRvals, usually a result of a call to estinterval

y

an (optional) object of class intRvals, usually a result of a call to estinterval

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter.

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)


adokter/intRval documentation built on May 6, 2022, 2:44 a.m.