hello,
I have programmed this function to calculate the Neuman-Keuls test but I have a
problem the function return an empty list and I don't know why.
summary(fm1)
E <- sqrt((summary(fm1)[[1]]["Residuals","Mean Sq"])/length(LR))
lst <- list()
lst1 <- list()
lst2 <- list()
NK <- function (x) {
if (length(x) == 2) {
Tstudent <- t.test(subset(exple, groupe == names(x)[1])$vd,subset(exple,
groupe == names(x)[2])$vd)
t <- as.numeric(Tstudent$statistic)
if (t >= Tstudent$conf.int[1:2][1] & t <= Tstudent$conf.int[1:2][2]) {
lst1[[1]] <- x
lst <- c(lst,lst1)
} else {
lst1[[1]] <- x[1]
lst2[[1]] <- x[2]
lst <- c(lst,lst1)
lst <- c(lst,lst2)
}
} else {
test <- x[c(1,length(x))]
Q <- (as.numeric(test[2]) - as.numeric(test[1]))/E
qtt <- qtukey(0.95,length(x),df=41)
if (Q < qtt) {
lst1[[1]] <- range(x)
lst <- c(lst,lst1)
} else {
x1 <- x[-length(x)]
x2 <- x[-1]
NK(x1)
NK(x2)
}
}
return(lst)
}
with
> fm1
Call:
aov(formula = vd ~ groupe, data = exple)
Terms:
groupe Residuals
Sum of Squares 300.9871 27.0000
Deg. of Freedom 20 41
Residual standard error: 0.8115027
Estimated effects may be unbalanced
Can you help me please?
thanks.
_____________________________________________________________________________
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.