Description Usage Arguments Value Examples
View source: R/add_poisson_gest.R
adds an estimated shinkage value obtained by G-Modeling
1 2 3 4 5 6 7 8 9 | add_poisson_gest(
tbl,
value,
cred_level = 0.8,
theta_from = -4,
theta_to = 5,
theta_by = 0.1,
probs = c(0.005, 0.025, 0.165, 0.25, 0.5, 0.75, 0.835, 0.975, 0.995)
)
|
tbl |
a table which *requires* two columns. A column with the number of successes (x) and a column with totals (n). |
cred_level |
level of credible interval to compute. For example and interval of .80 will return a 20th percentile lower interval and a 80th percentile upper interval |
theta_from |
start of parameter space |
theta_to |
end of parameter space |
theta_by |
increment of parameter space |
x |
column with number of successes |
n |
column with totals |
The original table with the following columns
.gest_dist |
Full posterior distribution. Grain may be increased with the theta_* parameters |
.raw |
Estimate (success / total) |
.gest |
Posterior EB g-estimate |
.lo |
Lower bound of credible interval for EB estimate |
.hi |
Upper bound of credible interval for EB estimate |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | dontrun{
#Example 1 ##################################
library(tidyverse)
library(ZIM)
data(syph)
df <- syph %>%
pivot_longer(cols = starts_with("a"), names_to = "key", values_to = "value")
df %>%
add_poisson_gest(value)
}
#Example 2 ##################################
data("df")
df %>% add_poisson_gest() %>% tidyr::unnest(.probs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.