Learn R Programming

TukeyC (version 1.0-6)

TukeyC: The TukeyC Test for Single Experiments

Description

These are methods for objects of class vector, matrix or data.frame joined as default, aov and aovlist for single experiments.

Usage

## S3 method for class 'default':
TukeyC(x,
       y=NULL, 
       model,
       which,
       error,
       sig.level=.05,
       round=2, \dots)

  ## S3 method for class 'aov':
TukeyC(x,
       which=NULL,
       sig.level=.05,
       round=2, \dots)

  ## S3 method for class 'aovlist':
TukeyC(x,
       which,
       error,
       sig.level=.05, 
       round=2, \dots)

Arguments

x
A design matrix, data.frame or an aov object.
y
A vector of response variable. It is necessary to inform this parameter only if x represent the design matrix.
which
The name of the treatment to be used in the comparison. The name must be inside quoting marks.
model
If x is a data.frame object, the model to be used in the aov must be specified.
error
The error to be considered.
sig.level
Level of Significance used in the TukeyC algorithm to create the groups of means. The default value is 0.05.
round
Integer indicating the number of decimal places.
...
Potential further arguments (required by generic).

Value

  • The function TukeyC returns a list of the class TukeyC with the slots:
  • avA list storing the result of aov.
  • groupsA vector of length equal the number of factor levels marking the groups generated.
  • nmsA vector of the labels of the factor levels.
  • ordA vector which keeps the position of the means of the factor levels in decreasing order.
  • m.infA matrix which keeps the means, minimum and maximum of the factor levels in decreasing order.
  • sig.levelA vector of length 1 giving the level of significance of the test.

Details

The function TukeyC returns an object of class TukeyC respectivally containing the groups of means plus other necessary variables for summary and plot. The generic functions summary and plot are used to obtain and print a summary and a plot of the results.

References

Miller, R.G. (1981) Simultaneous Statistical Inference. Springer. Ramalho M.A.P, Ferreira D.F, Oliveira A.C. (2000) Experimentacao em Genetica e Melhoramento de Plantas. Editora UFLA. Steel, Torry & Dickey. (1997) Principles and procedures of statistics a biometrical approach. Third Edition. Yandell, B.S. (1997) Practical Data Analysis for Designed Experiments. Chapman & Hall.

Examples

Run this code
##
  ## Examples: Completely Randomized Design (CRD)
  ## More details: demo(package='TukeyC')
  ##
  
  ## The parameters can be: vectors, design matrix and the response variable,
  ## data.frame or aov
  data(CRD2)
  
  ## From: design matrix (dm) and response variable (y)
  tk1 <- with(CRD2,
              TukeyC(x=dm,
                     y=y,
                     model='y ~ x',
                     which='x',
                     id.trim=5))
  summary(tk1)
  
  ## From: data.frame (dfm)
  tk2 <- with(CRD2,
              TukeyC(x=dfm,
              model='y ~ x',
              which='x',
              id.trim=5))
  summary(tk2)
  
  ## From: aov
  av <- with(CRD2,
             aov(y ~ x,
             data=dfm))
  summary(av)
  
  tk3 <- with(CRD2,
              TukeyC(x=av,
                     which='x',
                     id.trim=5))
  summary(tk3)

  ##
  ## Example: Randomized Complete Block Design (RCBD)
  ## More details: demo(package='TukeyC')
  ##
  
  ## The parameters can be: design matrix and the response variable,
  ## data.frame or aov
  
  data(RCBD)
  
  ## Design matrix (dm) and response variable (y)
  tk1 <- with(RCBD,
              TukeyC(x=dm,
                     y=y,
                     model='y ~ blk + tra',
                     which='tra'))
  summary(tk1)
  
  ## From: data.frame (dfm), which='tra'
  tk2 <- with(RCBD,
              TukeyC(x=dfm,
                     model='y ~ blk + tra',
                     which='tra'))
  summary(tk2)
  
  ##
  ## Example: Latin Squares Design (LSD)
  ## More details: demo(package='TukeyC')
  ##
  
  ## The parameters can be: design matrix and the response variable,
  ## data.frame or aov
  
  data(LSD)
  
  ## From: design matrix (dm) and response variable (y)
  tk1 <- with(LSD,
              TukeyC(x=dm,
                     y=y,
                     model='y ~ rows + cols + tra',
                     which='tra'))
  summary(tk1)
  
  ## From: data.frame
  tk2 <- with(LSD,
              TukeyC(x=dfm,
                     model='y ~ rows + cols + tra',
                     which='tra'))
  summary(tk2)
  
  ## From: aov
  av <- with(LSD,
             aov(y ~ rows + cols + tra,
             data=dfm))
  summary(av)
  
  tk3 <- TukeyC(av,
                which='tra')
  summary(tk3)

  ##
  ## Example: Factorial Experiment (FE)
  ## More details: demo(package='TukeyC')
  ##
  
  ## The parameters can be: design matrix and the response variable,
  ## data.frame or aov
  
  data(FE)
  ## From: design matrix (dm) and response variable (y)
  ## Main factor: N
  tk1 <- with(FE,
              TukeyC(x=dm,
                     y=y,
                     model='y ~ blk + N*P*K', 
                     which='N'))
  summary(tk1)

  ## Nested: p1/N
  ntk1 <- with(FE,
               TukeyC.nest(x=dm,
                           y=y,
                           model='y ~ blk + N*P*K',
                           which='N:P',
                           fl2=1))
  summary(ntk1)

Run the code above in your browser using DataLab