tpaired.randtest: Permutational paired t-test

View source: R/tpaired.randtest.R

tpaired.randtestR Documentation

Permutational paired t-test

Description

This function computes a permutation test of comparison of the means of two paired vectors (related samples). For each object, permutations are restricted to the two related observations.

Usage

tpaired.randtest(
  vec1,
  vec2,
  nperm = 99,
  alternative = "two.sided",
  silent = FALSE
)

Arguments

vec1, vec2

The two data vectors to be compared.

nperm

Number of permutations. Use 999, 9999, or more.

alternative

c("two.sided", "less", "greater"). Default value: "two.sided".

silent

If FALSE, calculation results are printed to the R console. If TRUE calculation results are not printed to R console (for simulations).

Value

A list containing the following results:

  • estim: mean of the differences

  • t.ref: reference value of the t-statistic

  • p.param: parametric p-value

  • p.perm: permutational p-value

  • nperm: number of permutations

Author(s)

- Pierre Legendre pierre.legendre@umontreal.ca Permutation code improved by Guillaume Blanchet.

References

Zar, J. H. 1999. Biostatistical analysis. 4th edition. Prentice Hall, New Jersey.

See Also

t.test

Examples


## Deer leg length, data from Zar (1999, p. 162).

deer <- matrix(c(142,140,144,144,142,146,149,150,142,148,138,136,147,139,143,141,143,
145,136,146),10,2)

rownames(deer) <- paste("Deer",1:10,sep=".")

colnames(deer) <- c('Hind.leg', 'Fore.leg')

res <- tpaired.randtest(deer[,1], deer[,2])   # Two-tailed test by default

## Compare the results to:  res2 = t.test(deer[,1], deer[,2], paired=TRUE)


adespatial documentation built on Oct. 19, 2023, 1:06 a.m.