Public-Health-Scotland / phsmethods

An R package to standardise methods used in Public Health Scotland (https://public-health-scotland.github.io/phsmethods/)
https://public-health-scotland.github.io/phsmethods/
54 stars 13 forks source link

Use/adapt existing package to calculate CIs for EASRs etc #24

Closed JonMinton closed 4 years ago

JonMinton commented 4 years ago

I wrote the following little code chunk for calculating 95% CIs for EASRs using Dobson's Method, which this paper suggests is preferable to alternatives.

get_dobson_point_ci <- function(data){ obj <- dsrTest::dsrTest(x = data$x_i, n = data$d_i, w = data$w_i, method = "dobson")

tibble(point = obj[["estimate"]], lower = obj[["conf.int"]][1], upper = obj[["conf.int"]][2] ) }

x_i is the denominator d_i is the number of events w_i is the weighting

The argument conf.level could also be changed from its default (0.95) for additional flexibility. Likewise other options could be selected.

Is this already included, and if not is there interested in adapting the above for EASR calculations?

jackhannah95 commented 4 years ago

Hi @JonMinton,

To be honest this is a bit outwith the scope of this package. We're really just trying to make PHS-specific data manipulation easier, rather than implementing any statistical methodology. This would likely be quite niche within PHS (I can't envisage much use for it within ISD at least) and we as maintainers don't really have the requisite expertise to review something like this.

This also seems quite non-specific to PHS and I think it'd possibly be better suited as a contribution to a more generic statistical methodology-oriented R package than one which is specific to a single organisation.

Hope this is okay, but please let me know if you have any questions.

Thanks,

Jack