Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confidence intervals lab updates #15

Open
rpruim opened this issue Jul 2, 2018 · 3 comments
Open

confidence intervals lab updates #15

rpruim opened this issue Jul 2, 2018 · 3 comments
Assignees

Comments

@rpruim
Copy link
Contributor

rpruim commented Jul 2, 2018

mosaic::sample() handles a multi-column data frame just fine. No need to select just one variable.

@rpruim
Copy link
Contributor Author

rpruim commented Jul 2, 2018

Do we want to show cnorm()?

cnorm(.95)
##          lower    upper
## [1,] -1.959964 1.959964

@rpruim
Copy link
Contributor Author

rpruim commented Jul 2, 2018

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

@rpruim
Copy link
Contributor Author

rpruim commented Jul 2, 2018

Not sure I'm a fan of this style:

with(samp_ci, plot_ci(lower, upper, m = mean(~ area, data = ames)))

Possible solutions:

  • leave as is
  • write a different wrapper that avoids using with and starts from the raw data
  • use native ggformula. Except for calculating coverage, it is dead simple. But not sure I like the part about computing which intervals cover.
  • use CIsim()
  • other ideas?
# 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants