compareMean(formula, data = parent.frame(), ...)
x
is evaluated if x
is a
formula.
Note that the default is data=parent.frame()
. This makes it convenient to
use this function interactively by treating the working envionment as if it were
a dado
, compareProportion
and shuffle
if (require(mosaicData)) {
data(HELPrct)
# calculate the observed difference
mean(age ~ sex, data=HELPrct)
obs <- diffmean(age ~ sex, data=HELPrct); obs
# calculate the permutation distribution
nulldist <- do(100) * diffmean(age ~ shuffle(sex),
data=HELPrct)
histogram(~ diffmean, groups=(diffmean >= obs), nulldist,
xlab="difference in means")
}
Run the code above in your browser using DataLab