perm.test-methods: Two-sample permutation test for differences in the population...

perm.test.defaultR Documentation

Two-sample permutation test for differences in the population means

Description

Two-sample permutation test for differences in the population means

Two-sample permutation test for differences in the population means

Analysis of variance based on permutation tests

Usage

## Default S3 method:
perm.test(
  x,
  y,
  nsim = 1000,
  seed = NULL,
  alternative = c("two.sided", "less", "greater"),
  ...
)

## S3 method for class 'formula'
perm.test(
  formula,
  data,
  nsim = 1000,
  seed = NULL,
  alternative = c("two.sided", "less", "greater"),
  ...
)

## S3 method for class 'aov'
perm.test(object, nsim = 1000, seed = NULL, ...)

Arguments

x

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

y

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

nsim

number of permutations to be simulated

seed

seed passed to the random number generator; if NULL (default), then a random seed is used

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.

...

further arguments passed to or from other methods.

formula

a formula of the form lhs ~ rhs where lhs is a numeric variable giving the data values and rhs either 1 for a one-sample or paired test or a factor with two levels giving the corresponding groups.

data

an optional matrix or data frame containing the variables in the formula formula. By default the variables are taken from environment(formula).

object

an object of class aov

Details

The permutation test implemented here is based on the difference of the sample means.

The permutation test implemented here is based on the difference of the sample means.

Value

perm.test returns an object of class perm.test containing information regarding the permutation test carried out.

perm.test returns an object of class perm.test containing information regarding the permutation test carried out.

perm.test returns an object of class perm.test.aov containing information regarding the permutation test carried out

Examples


library(planex)
library(tidyr)
data(catalisadores2)
t.test  <- t.test(catalisadores2$C1, catalisadores2$C2)
t.test
#perm <- perm.test(catalisadores2$C1, catalisadores2$C2, nsim = 1000, seed = 123)
#perm$pvalor



library(planex)
library(tidyr)
data(catalisadores2)
#catalisadores2 <- catalisadores2 %*%
#  pivot_longer(
#     cols = 1:2,
#     names_to = "catalisador",
#     values_to = "rendimento"
#   )
# t.test  <- t.test(rendimento ~ catalisador, data=catalisadores2)
# t.test
# perm <- perm.test(rendimento ~ catalisador, data=catalisadores2, nsim = 1000, seed = 123)
# perm$pvalor



library(planex)
data(refrigerantes)
mod <- aov(desvio ~ carbonatacao*pressao*velocidade, data=refrigerantes)
summary(mod)
perm <- perm.test(mod)
summary(perm)



fndemarqui/planex documentation built on June 11, 2025, 9:56 a.m.