Learn R Programming

TH (version 1.0.0)

tt2p: Paired t Test

Description

Performs a t test for two dependent or paired measurements.

Usage

tt2p(
  dadosX1 = NULL,
  dadosX2 = NULL,
  mpD = 0,
  alfa = 0.05,
  Ha = 1,
  unidade = NULL,
  mD = NULL,
  s2D = NULL,
  nD = NULL,
  plot = TRUE
)

Value

Invisibly returns an object of classes th_test and htest containing the test statistic, degrees of freedom when applicable, p-value, estimates, critical values, significance level, and decision. When plot = TRUE, the educational graph is produced as a side effect.

Arguments

dadosX1

Numeric vector for the first condition.

dadosX2

Numeric vector for the second condition, in the corresponding paired order.

mpD

Population mean of the differences specified under the null hypothesis; the default is zero.

alfa

Significance level.

Ha

Alternative hypothesis. Use 1 or "two.sided", 2 or "greater", and 3 or "less".

unidade

Measurement unit displayed in the graph.

mD

Mean of the differences when the vectors are not supplied.

s2D

Variance of the differences when the vectors are not supplied.

nD

Number of pairs when the vectors are not supplied.

plot

Logical. If TRUE (default), draw the educational graph; if FALSE, return the result without plotting.

Author

Willian Silva Barros

Details

Raw paired data and summary statistics for the differences are mutually exclusive. In raw-data mode, the difference is calculated as dadosX2 - dadosX1.

Main assumptions:

  • correct pairing of the observations;

  • independence among pairs;

  • approximately normal distribution of the paired differences;

Examples

Run this code
before <- c(70, 72, 68, 75, 74, 71, 69, 73)
after <- c(66, 69, 65, 71, 70, 68, 66, 69)
tt2p(before, after, mpD = 0, alfa = 0.05, Ha = 3, unidade = " units", plot = FALSE)

Run the code above in your browser using DataLab