Skip to main content
added 3 characters in body
Source Link
User1865345
  • 9.4k
  • 11
  • 23
  • 38

The obvious solution when you have prior information is to take a Bayesian approach. Perhaps your prior knowledge can be represented via a beta-distribution, in which case things are super-simple from a $\text{Beta}(a, b)$ prior you get a $\text{Beta}(a+y, b+n-y)$ posterior distribution after observing $y$ successes out of $n$ (I'm assuming here that the population is very, very large like e.g. millions of people and your sample $n$ in the study is relatively small relative to the population size - otherwise (survey) sampling considerations for finite population would also start to matter).

Even if that doesn't fit your prior knowledge a mixture of several Beta-distribution can decently approximate anything you might believe (you could e.g. define one using the mixbeta function in the RBesT R package and then use the postmix function to update your prior with what you observed). You can also use a mixture to express greater uncertainty than you might have from prior studies to go more down a weakly informative route in order to only weakly influence what you see.

Example R code:

library(RBesT)
library(patchwork)

my_prior <- mixbeta(c(0.5, 1, 99), c(0.5, 0.1, 99.9), param="ab")
p1 <- plot(my_prior) + coord_cartesian(ylim=c(0, 100), xlim=c(0, 0.05)) + ylab("Prior density")

my_posterior <- postmix(priormix=my_prior, r=0, n=500)
p2 <- plot(my_posterior) + coord_cartesian(ylim=c(0, 100), xlim=c(0, 0.05))  + ylab("Posterior density")

p1 / p2

summary(my_posterior)
library(RBesT)
library(patchwork)

my_prior <- mixbeta(c(0.5, 1, 99), c(0.5, 0.1, 99.9), param="ab")
p1 <- plot(my_prior) + coord_cartesian(ylim=c(0, 100), xlim=c(0, 0.05)) + ylab("Prior density")

my_posterior <- postmix(priormix=my_prior, r=0, n=500)
p2 <- plot(my_posterior) + coord_cartesian(ylim=c(0, 100), xlim=c(0, 0.05))  + ylab("Posterior density")

p1 / p2

summary(my_posterior)

enter image description here

        mean           sd         2.5%        50.0%        97.5% 
4.143692e-04 9.994307e-04 9.435260e-23 1.143779e-04 3.464005e-03 

The obvious solution when you have prior information is to take a Bayesian approach. Perhaps your prior knowledge can be represented via a beta-distribution, in which case things are super-simple from a $\text{Beta}(a, b)$ prior you get a $\text{Beta}(a+y, b+n-y)$ posterior distribution after observing $y$ successes out of $n$ (I'm assuming here that the population is very, very large like e.g. millions of people and your sample $n$ in the study is relatively small relative to the population size - otherwise (survey) sampling considerations for finite population would also start to matter).

Even if that doesn't fit your prior knowledge a mixture of several Beta-distribution can decently approximate anything you might believe (you could e.g. define one using the mixbeta function in the RBesT R package and then use the postmix function to update your prior with what you observed). You can also use a mixture to express greater uncertainty than you might have from prior studies to go more down a weakly informative route in order to only weakly influence what you see.

Example R code:

library(RBesT)
library(patchwork)

my_prior <- mixbeta(c(0.5, 1, 99), c(0.5, 0.1, 99.9), param="ab")
p1 <- plot(my_prior) + coord_cartesian(ylim=c(0, 100), xlim=c(0, 0.05)) + ylab("Prior density")

my_posterior <- postmix(priormix=my_prior, r=0, n=500)
p2 <- plot(my_posterior) + coord_cartesian(ylim=c(0, 100), xlim=c(0, 0.05))  + ylab("Posterior density")

p1 / p2

summary(my_posterior)

enter image description here

        mean           sd         2.5%        50.0%        97.5% 
4.143692e-04 9.994307e-04 9.435260e-23 1.143779e-04 3.464005e-03 

The obvious solution when you have prior information is to take a Bayesian approach. Perhaps your prior knowledge can be represented via a beta-distribution, in which case things are super-simple from a $\text{Beta}(a, b)$ prior you get a $\text{Beta}(a+y, b+n-y)$ posterior distribution after observing $y$ successes out of $n$ (I'm assuming here that the population is very, very large like e.g. millions of people and your sample $n$ in the study is relatively small relative to the population size - otherwise (survey) sampling considerations for finite population would also start to matter).

Even if that doesn't fit your prior knowledge a mixture of several Beta-distribution can decently approximate anything you might believe (you could e.g. define one using the mixbeta function in the RBesT R package and then use the postmix function to update your prior with what you observed). You can also use a mixture to express greater uncertainty than you might have from prior studies to go more down a weakly informative route in order to only weakly influence what you see.

Example R code:

library(RBesT)
library(patchwork)

my_prior <- mixbeta(c(0.5, 1, 99), c(0.5, 0.1, 99.9), param="ab")
p1 <- plot(my_prior) + coord_cartesian(ylim=c(0, 100), xlim=c(0, 0.05)) + ylab("Prior density")

my_posterior <- postmix(priormix=my_prior, r=0, n=500)
p2 <- plot(my_posterior) + coord_cartesian(ylim=c(0, 100), xlim=c(0, 0.05))  + ylab("Posterior density")

p1 / p2

summary(my_posterior)

enter image description here

        mean           sd         2.5%        50.0%        97.5% 
4.143692e-04 9.994307e-04 9.435260e-23 1.143779e-04 3.464005e-03 
Source Link
Björn
  • 33.5k
  • 3
  • 41
  • 99

The obvious solution when you have prior information is to take a Bayesian approach. Perhaps your prior knowledge can be represented via a beta-distribution, in which case things are super-simple from a $\text{Beta}(a, b)$ prior you get a $\text{Beta}(a+y, b+n-y)$ posterior distribution after observing $y$ successes out of $n$ (I'm assuming here that the population is very, very large like e.g. millions of people and your sample $n$ in the study is relatively small relative to the population size - otherwise (survey) sampling considerations for finite population would also start to matter).

Even if that doesn't fit your prior knowledge a mixture of several Beta-distribution can decently approximate anything you might believe (you could e.g. define one using the mixbeta function in the RBesT R package and then use the postmix function to update your prior with what you observed). You can also use a mixture to express greater uncertainty than you might have from prior studies to go more down a weakly informative route in order to only weakly influence what you see.

Example R code:

library(RBesT)
library(patchwork)

my_prior <- mixbeta(c(0.5, 1, 99), c(0.5, 0.1, 99.9), param="ab")
p1 <- plot(my_prior) + coord_cartesian(ylim=c(0, 100), xlim=c(0, 0.05)) + ylab("Prior density")

my_posterior <- postmix(priormix=my_prior, r=0, n=500)
p2 <- plot(my_posterior) + coord_cartesian(ylim=c(0, 100), xlim=c(0, 0.05))  + ylab("Posterior density")

p1 / p2

summary(my_posterior)

enter image description here

        mean           sd         2.5%        50.0%        97.5% 
4.143692e-04 9.994307e-04 9.435260e-23 1.143779e-04 3.464005e-03