Description Usage Arguments Value Author(s) Examples
This function will compute the mean/confidence interval of a single variable, or compute the mean/CIs of levels within a factor based on an outcome variable
1 |
y |
The variable we wish to compute the mean of |
x |
The grouping variable (optional). If no grouping variable is specified, the function will estimate the mean of y only. |
levels |
The user can specify which levels of the factor they want to compute the means of. See examples. |
interval |
What interval is requested (expressed as a proportion). Defaults to .95. |
either a list containing the mean and CI, or a table containing the means/CIs for each level of x
Dustin Fife
1 2 3 4 5 6 7 8 9 10 | iq = rnorm(100, 100, 15)
group = sample(c("iq.booster.pill", "control", "iq.training"), size=100, replace=T)
### compute the mean of just iq
ci.mean(iq)
### compute mean for all levels of x
ci.mean(iq, group)
### compute mean for only the iq.booster.pill group
ci.mean(iq, group, levels="iq.booster.pill")
### change to a 99% CI
ci.mean(iq, group, levels=c("control","iq.booster.pill"), interval=.99)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.