test_two: Analysis: Test for two samples

View source: R/test_two_function.R

test_twoR Documentation

Analysis: Test for two samples

Description

Test for two samples (paired and unpaired t test, paired and unpaired Wilcoxon test)

Usage

test_two(
  trat,
  resp,
  paired = FALSE,
  correct = TRUE,
  test = "t",
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95,
  theme = theme_classic(),
  ylab = "Response",
  xlab = "",
  var.equal = FALSE,
  pointsize = 2,
  yposition.p = NA,
  xposition.p = NA,
  fill = "white"
)

Arguments

trat

Categorical vector with the two treatments

resp

Numeric vector with the response

paired

A logical indicating whether you want a paired t-test.

correct

A logical indicating whether to apply continuity correction in the normal approximation for the p-value.

test

Test used (t for test t or w for Wilcoxon test)

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.

conf.level

Confidence level of the interval.

theme

ggplot2 theme (default is theme_classic())

ylab

Variable response name (Accepts the expression() function)

xlab

Treatments name (Accepts the expression() function)

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.

pointsize

Point size

yposition.p

Position p-value in y

xposition.p

Position p-value in x

fill

fill box

Details

Alternative = "greater" is the alternative that x has a larger mean than y. For the one-sample case: that the mean is positive.

If paired is TRUE then both x and y must be specified and they must be the same length. Missing values are silently removed (in pairs if paired is TRUE). If var.equal is TRUE then the pooled estimate of the variance is used. By default, if var.equal is FALSE then the variance is estimated separately for both groups and the Welch modification to the degrees of freedom is used.

If the input data are effectively constant (compared to the larger of the two means) an error is generated.

Value

Returns the test for two samples (paired or unpaired t test, paired or unpaired Wilcoxon test)

Author(s)

Gabriel Danilo Shimizu, shimizu@uel.br

Leandro Simoes Azeredo Goncalves

Rodrigo Yudi Palhaci Marubayashi

Examples

resp=rnorm(100,100,5)
trat=rep(c("A","B"),e=50)
test_two(trat,resp)
test_two(trat,resp,paired = TRUE)

AgroR documentation built on May 29, 2024, 4:18 a.m.