Learn R Programming

ScottKnott (version 1.2-0)

SK.nest: The ScottKnott Clustering Algoritm for Factorial, Split-plot and Split-SPlit plot Experiments

Description

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

Usage

## S3 method for class 'default':
SK.nest(x,
        y=NULL,
        model,
        which,
        id.trim=3,
        error,
        fl1,
        fl2=0,
        sig.level=.05, \dots)
  ## S3 method for class 'aov':
SK.nest(x,
        which,
        id.trim=3,
        fl1,
        fl2=0,
        sig.level=.05, \dots)
  ## S3 method for class 'aovlist':
SK.nest(x,
        which,
        id.trim=3,
        error,
        fl1,
        fl2=0,
        sig.level=.05, \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.
id.trim
The number of character to trim the id label.
fl1
A vector of length 1 giving the level of the first factor in nesting order tested.
fl2
A vector of length 1 giving the level of the second factor in nesting order tested.
error
The error to be considered, only in case of split-plots experiments.
sig.level
Level of Significance used in the SK algorithm to create the groups of means. The default value is 0.05.
...
Potential further arguments (require by generic).

Value

  • The function SK.nest returns a list of the class SK.nest 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.
  • rA vector of length 1 giving the number of replicates.
  • whichThe name of the factor whose levels were tested.
  • tabAn array keeping the names of the factors and factor levels and also the mean value of the repetitions for every combination of factor levels.
  • fl1A vector of length 1 giving the level of the first factor in nesting order tested.
  • fl2A vector of length 1 giving the level of the second factor in nesting order tested.

Details

The function SK.nest returns an object of class SK.nest 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

Ramalho M.A.P., Ferreira D.F., Oliveira A.C. 2000. Experimentacao em Genetica e Melhoramento de Plantas. Editora UFLA. Scott R.J., Knott M. 1974. A cluster analysis method for grouping mans in the analysis of variance. Biometrics, 30, 507-512.

Examples

Run this code
##
  ## Example: Split-split-plot Experiment (SSPE)
  ## More details: demo(package='ScottKnott')
  ##
  
  ## Note: The factors are in uppercase and its levels in lowercase!

  data(SSPE)
  ## From: design matrix (dm) and response variable (y)
  ## Main factor: P
  sk1 <- with(SSPE,
              SK(dm,
                 y,
                 model='y ~ blk + P*SP*SSP + Error(blk/P/SP)',
                 which='P',
                 error='blk:P'))
  summary(sk1)
  
  # Main factor: SP
  sk2 <- with(SSPE,
              SK(dm,
                 y,
                 model='y ~ blk + P*SP*SSP + Error(blk/P/SP)',
                 which='SP',
                 error='blk:P:SP'))
  summary(sk2)
  
  # Main factor: SSP
  sk3 <- with(SSPE,
              SK(dm,
                 y,
                 model='y ~ blk + P*SP*SSP + Error(blk/P/SP)',
                 which='SSP',
                 error='Within'))
  summary(sk3)
  
  ## Nested: p1/SP
  skn1 <- with(SSPE,
               SK.nest(dm,
                       y,
                       model='y ~ blk + P*SP*SSP + Error(blk/P/SP)',
                       which='P:SP',
                       error='blk:P:SP',
                       fl1=1))
  summary(skn1)

  ## From: aovlist
  av <- with(SSPE,
             aov(y ~  blk + P*SP*SSP + Error(blk/P/SP),
                 data=dfm))
  summary(av)   

  ## Nested: p/sp/SSP
  ## Studing SSP inside of level one of P and level one of SP
  skn2 <- SK.nest(av,
                  which='P:SP:SSP',
                  error='Within',
                  fl1=1,
                  fl2=1)
  summary(skn2)

  ## Studing SSP inside of level one of P and level two of SP
  skn3 <- SK.nest(av,
                  which='P:SP:SSP',
                  error='Within',
                  fl1=1,
                  fl2=2)
  summary(skn3)

Run the code above in your browser using DataLab