Learn R Programming

ScottKnott (version 1.2-7)

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 default
SK.nest(x,
        y=NULL,
        model,
        which,
        id.trim=3,
        error,
        fl1,
        fl2=0,
        sig.level=.05,
        dispersion=c('mm', 's', 'se'), …)
  # S3 method for aov
SK.nest(x,
        which,
        id.trim=3,
        fl1,
        fl2=0,
        sig.level=.05,
        dispersion=c('mm', 's', 'se'), …)
  # S3 method for aovlist
SK.nest(x,
        which,
        id.trim=3,
        error,
        fl1,
        fl2=0,
        sig.level=.05,
        dispersion=c('mm', 's', 'se'), …)

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.

dispersion

The dispersion to be considered to the means. The possible vaues are: 'mm' = minimum and maximum, 's' = standart deviation, 'se' = standart deviation of the mean.

Potential further arguments (require by generic).

Value

The function SK.nest returns a list of the class SK.nest with the slots:

av

A list storing the result of aov.

groups

A vector of length equal the number of factor levels marking the groups generated.

nms

A vector of the labels of the factor levels.

ord

A vector which keeps the position of the means of the factor levels in decreasing order.

m.inf

A matrix which keeps the means and the dispersion of the factor levels in decreasing order.

sig.level

A vector of length 1 giving the level of significance of the test.

r

A vector of length 1 giving the number of replicates.

which

The name of the factor whose levels were tested.

tab

An array keeping the names of the factors and factor levels and also the mean value of the repetitions for every combination of factor levels.

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.

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. Experimenta<e7><e3>o em Gen<e9>tica 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
# NOT RUN {
  ##
  ## 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',
                 dispersion='s'))
  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',
                 dispersion='se'))
  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