Open rpruim opened 6 years ago
Do we want to show cnorm()
?
cnorm(.95)
## lower upper
## [1,] -1.959964 1.959964
If we use cnorm()
, then creating an interval looks like this:
zstar <- cnorm(.95)
se <- sd(~ area, data = sample60) / sqrt(60)
sample_mean + zstar * se
## lower upper
## [1,] 1249.123 1482.044
Not sure I'm a fan of this style:
with(samp_ci, plot_ci(lower, upper, m = mean(~ area, data = ames)))
Possible solutions:
ggformula
. Except for calculating coverage, it is dead simple. But not sure I like the part about computing which intervals cover.# This can also be done in native ggformula -- just need to do some work to
# to calculate which ones cover.
pop.mean <- mean(~ area, data = ames)
samp_ci <- samp_ci %>%
mutate(covers = pop.mean >= lower & pop.mean <= upper)
gf_pointrange(mean + lower + upper ~ .index, data = samp_ci, color = ~covers)
mosaic::sample()
handles a multi-column data frame just fine. No need to select just one variable.