compareMean: Compare means between 2 groups

Description Usage Arguments Value Note See Also Examples

View source: R/compareMean.R

Description

A function to calculate the difference between the means of a continuous variable for two groups.

Usage

1

Arguments

formula

a formula

data

a data frame in which 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 environment as if it were a data frame. But this may not be appropriate for programming uses. When programming, it is best to use an explicit data argument – ideally supplying a data frame that contains the variables mentioned

...

other arguments

Value

the difference in means between the second and first group

Note

This function is now defunct. Use diffmean() instead.

See Also

do(), compareProportion() and shuffle()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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")
}

ProjectMOSAIC/mosaic documentation built on Aug. 19, 2018, 9:14 a.m.