2
$\begingroup$

Given $R = \{r_1,r_2,....\}$ and $T = \{t_1,t_2,....\}$ where $R < X < R+T$.

If $X$'s distribution function $F(x,\alpha, \beta)$ is known.

To estimate parameters $\alpha$ and $\beta$, I want to use following equation.

$p(\alpha, \beta|r<X<t) = p(\alpha, \beta)p(r<X<t|\alpha, \beta)$ where the parameter's can be assume to be Uniformly distributed as prior. And the posterior probability is updated by likelihood function with sample $r_n$ and $t_n$.

Is this correct application of bayesian inference?

$\endgroup$

1 Answer 1

1
$\begingroup$

Yes, that should be fine. As a detail, note that the relation should be of proportionality, not equality. That is, \begin{equation*} p(\alpha, \beta \, | \, r < X < r + t) \propto p(\alpha, \beta) p(r < X < r + t \, | \, \alpha, \beta). \end{equation*}

You can use $F(x, \alpha, \beta)$ to calculate $p(r < X < r + t \, | \, \alpha, \beta)$ by way of $F(r + t, \alpha, \beta) - F(r, \alpha, \beta)$ - assuming $F$ is the cumulative distribution function as per the standard notation.

To help see that this is valid you can think of a Bernoulli random variable $Y_{r, t}$, where $Y_{r, t} = 1$ if $X$ is in the interval $(r, r+t)$ and is 0 otherwise. The standard Bernoulli probability is then described via $p(r < X < r + t)$, so you could rewrite your problem as \begin{equation*} p(\alpha, \beta \, | \, y_{r, t}) \propto p(\alpha, \beta) p(y_{r, t} \, | \, \alpha, \beta). \end{equation*}

As an example you can consider a simple model like this:

\begin{align*} \alpha, \beta & \sim \text{uniform(1, 10)} \\ X \, | \, \alpha, \beta & \sim \text{beta}(\alpha, \beta). \end{align*}

Here's some corresponding code (pardon the Haskell); note in particular that I've defined the likelihood in terms of boundary values:

logPrior l u a b
  | u < l = log 0
  | a < l || b < l || a > u || b > u = log 0
  | otherwise = log (density uniform a) + log (density uniform b) where
      uniform = uniformDistr l u

logLikelihood ps a b = foldl' (+) 0 (fmap (log . prob) ps) where
  beta = betaDistr a b
  prob (r, t)
    | r + t > 1 = 0
    | r < 0     = 0
    | otherwise = cumulative beta (r + t) - cumulative beta r

Here's the posterior, conditional on the observations

\begin{equation*} \{(r, t)\} = \{(0.1, 0.2), (0.08, 0.21), (0.1, 0.25), (0.09, 0.18)\} \end{equation*}

logPosterior [a, b]
  | a <= 0 || b <= 0 = log 0
  | otherwise        = logPrior 1 10 a b + logLikelihood obs a b where
      obs = [(0.1, 0.2), (0.08, 0.21), (0.1, 0.25), (0.09, 0.18)]

and we can collect some samples over the posterior parameter space via whatever method you have available (I've used a simple Metropolis sampler below):

For a different set of observations, say

\begin{equation*} \{(r, t)\} = \{(0.5, 0.2), (0.48, 0.21), (0.5, 0.25), (0.49, 0.18)\} \end{equation*}

you of course get a different posterior:

$\endgroup$
3
  • $\begingroup$ sorry, would you please give out the likelihood function in math, i know little about haskell. can only guess what you describe. thank you. $\endgroup$ Commented Dec 2, 2015 at 22:33
  • $\begingroup$ @ReadonShaw It's the product of the individual $F(r_{i} + t_{i}, \alpha, \beta) - F(r_{i}, \alpha, \beta)$ terms, for all $(r_{i}, t_{i})$. The relevant code there is cumulative beta (r + t) - cumulative beta r - the rest is just details. $\endgroup$
    – jtobin
    Commented Dec 2, 2015 at 23:45
  • $\begingroup$ That is the same as I expected. In some case, $t_i$ would be $0$. it can be interpret as if $r_i$ is a sample of $X$. I wonder that if I can use corresponding value of $X$'s pdf at $r_i$ to estimate that? of cause, as $X$ is a continuous random variable. one point of that pdf might be meaningless. $\endgroup$ Commented Dec 3, 2015 at 4:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.