GAD (version 1.1.1)

snk.test: Student-Newman-Keuls (SNK) procedure

Description

This function perforns a SNK post-hoc test of means on the factors of a chosen term of the model, comparing among levels of one factor within each level of other factor or combination of factors.

Usage

snk.test(object, term, among = NULL, within = NULL)

Arguments

object
An object of class lm, containing the specified design.
term
Term of the model to be analysed. Use estimates to see the right form to inform it.
among
Specifies the factor which levels will be compared among. Need to be specified if the term to be analysed envolves more than one factor.
within
Specifies the factor or combination of factors that will be compared within level among.

Value

A list containing the standard error, the degree of freedom and pairwise comparisons among levels of one factor within each level of other(s) factor(s).

Details

SNK is a stepwise procedure for hypothesis testing. First the sample means are sorted, then the pairwise studentized range (q) is calculated by dividing the differences between means by the standard error, which is based upon the average variance of the two sample.

References

Underwood, A.J. 1997. Experiments in Ecology: Their Logical Design and Interpretation Using Analysis of Variance. Cambridge University Press, Cambridge.

See Also

gad, estimates

Examples

Run this code
library(GAD)
data(rohlf95)
CG <- as.fixed(rohlf95$cages)
MQ <- as.random(rohlf95$mosquito) 
model <- lm(wing ~ CG + CG%in%MQ, data = rohlf95)
gad(model)
##Check estimates to see model structure
estimates(model)
snk.test(model,term = 'CG:MQ', among = 'MQ', within = 'CG')
##
##
##Example using snails dataset
data(snails)
O <- as.random(snails$origin)
S <- as.random(snails$shore)
B <- as.random(snails$boulder)
C <- as.random(snails$cage)
model <- lm(growth ~ O + S + O*S + B%in%S + O*(B%in%S) + C%in%(O*(B%in%S)), 
            data = snails)
gad(model)
##Check estimates to see model structure
estimates(model)
snk.test(model, term = 'O')
snk.test(model,term = 'O:S', among = 'S', within = 'O')
#if term O:S:B were significant, we could try 
snk.test(model, term = 'O:S:B', among = 'B', within = 'O:S')

Run the code above in your browser using DataCamp Workspace