A function to calculate the difference between the means of a continuous variable for two groups.
compareMean(formula, data = parent.frame(), ...)
formula | a formula |
---|---|
data | a data frame in which |
… | other arguments |
the difference in means between the second and first group
This function is now defunct. Use diffmean()
instead.
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") }