University of Minnesota, Twin Cities
School of Statistics
Stat 5601
Rweb
Stat 5601 (Geyer) Examples
(One-Way Layout)
Contents
To do each example, just click the "Submit" button.
You do not have to type in any R instructions or specify a dataset.
That's already done for you.
Example 6.1 in Hollander and Wolfe.
Comments
The second analysis done by the aov
function is the
usual parametric procedure: one-way ANOVA. It produces
P = 0.5866 for comparison with the Kruskal-Wallis P -value.
Unfortunately, R doesn't have this procedure. So we'll have to do it
by hand (in R).
Example 6.2 in Hollander and Wolfe.
dat <- number
grp <- as.ordered(information)
jkstat <- function(x, g) {
foo <- (sign(outer(x, x, "-")) + 1) / 2
sum(foo[g[row(foo)] > g[col(foo)]])
}
print(jstat <- jkstat(dat, grp))
nsim <- 1e4 - 1
jsim <- double(nsim)
for (i in 1:nsim) {
datsim <- sample(dat, length(dat))
jsim[i] <- jkstat(datsim, grp)
}
phat <- mean(jsim >= jstat)
(nsim * phat + 1) / (nsim + 1)
nsim / (nsim + 1) * sqrt(phat * (1 - phat) / nsim)
External Data Entry
Enter a dataset URL :