my.t.test: My Student's t-Test

Description Usage Arguments Details Value Examples

Description

Performs one and two sample t-tests on vectors of data. Then draws corresponding image.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
my.t.test(
  x,
  y = NULL,
  alternative = c("two.sided", "less", "greater"),
  mu = 0,
  paired = FALSE,
  var.equal = FALSE,
  conf.level = 0.95,
  normal.te = FALSE,
  ...
)

Arguments

x

a (non-empty) numeric vector of data values.

y

an optional (non-empty) numeric vector of data values.

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).

paired

a logical indicating whether you want a paired t-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.

normal.te

a logical indicating whether you want a normality test.

Details

The formula interface is only applicable for the 2-sample tests.

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 following components:

<statistic> the value of the t-statistic.

<parameter> the degrees of freedom for the t-statistic.

<p.value> the p-value for the test.

<conf.int> a confidence interval for the mean appropriate to the specified alternative hypothesis.

<estimate> the estimated mean or difference in means depending on whether it was a one-sample test or a two-sample test.

<null.value> the specified hypothesized value of the mean or mean difference depending on whether it was a one-sample test or a two-sample test.

<stderr> the standard error of the mean (difference), used as denominator in the t-statistic formula.

<alternative> a character string describing the alternative hypothesis.

<method> a character string indicating what type of t-test was performed.

<data.name> a character string giving the name(s) of the data.

Examples

1
2
my.t.test(x, y, alternative = "le", paired = TRUE, var.equal = TRUE, conf.level = 0.99)
my.t.test(x, mu = 0.5, normal.te = TRUE)

xiangkun1999/xiangkun1999 documentation built on Dec. 23, 2019, 6:39 p.m.