## bayestestimation basis

The bayestestimation module uses a hierachical Bayesian model to estimate the posterior distributions of two samples, the parameters of these samples can be approximated by simulation, as can the difference in the paramters.

#### Sections

- Specifying the hierachial model
- Estimating the posterior distribution
- Estimating the Bayes Factor

#### Specifying the hierachial model

The module largely follows the Bayesian-estimation-supercedes-the-t-test (BEST) implementation as specified by Kruschke ([link](https://pdfs.semanticscholar.org/dea6/0927efbd1f284b4132eae3461ea7ce0fb62a.pdf)).

Let $Y_A$ and $Y_B$ represent samples of continuous data from populations $A$ and $B$.  The distributions of $Y_A$ and $Y_B$ can be specified using the following hierachial model:

\begin{equation}
\begin{aligned}
Y_A &\sim \textrm{T}(\nu, \mu_A, \sigma_A)
\\
Y_B &\sim \textrm{T}(\nu, \mu_B, \sigma_B)
\\
\mu_A, \mu_B &\sim \textrm{N}(\mu, 2s)
\\
\sigma_A, \sigma_B &\sim \textrm{Inv-Gamma}(\alpha, \beta)
\\
\nu &\sim \textrm{Exp(+1)}(\phi) 
\end{aligned}
\end{equation}


Where $\mu$, $s$, $\alpha$, $\beta$ and $\phi$ are constants. $\textrm{Exp(+1)}$ represents an exponential distribution shifted by +1.  

Following Krusckhe, the default value for $\phi$ is 1/30.  Also following Kruschke, the default values for $\mu$ and $s$ are the sample mean of the combined samples of $Y_A$ and $Y_B$ ($\bar{Y}$), and the combined sample standard deviation of $Y_A$ and $Y_B$, respectively.

Deviating from Kruscke, the prior distributions of $\sigma_A$ and $\sigma_B$ are modelled using an inverse-gamma distribution.  The weakly-informative default values $\alpha$ and $\beta$ are set to 0.001.


#### Estimating the posterior distribution 

Estimation of the posterior distributions of $\mu_A$, $\mu_B$, $\sigma_A$, $\sigma_B$ is carried out using [pystan's](https://pystan.readthedocs.io/en/latest/index.html) MCMC sampling.

The parameter $\mu_B - \mu_A$ can easily be estimated using the draws from the posteriors of $\mu_A$ and $\mu_B$.

#### Estimating the Bayes Factor

(watch this space)



```python

```

85ea9aee95acae26b4e3ff748ac959ce50dff91e
ipynb
Jupyter Notebook
docs/bayestestimation_basis.ipynb
oli-chipperfield/bayestestimation
aace7949fff01af2b574334a1a1fd2ce93fe10f4
MIT
2021-01-29T01:33:52.000Z
2021-01-29T01:33:52.000Z
docs/bayestestimation_basis.ipynb
oli-chipperfield/bayestestimation
aace7949fff01af2b574334a1a1fd2ce93fe10f4
MIT
docs/bayestestimation_basis.ipynb
oli-chipperfield/bayestestimation
aace7949fff01af2b574334a1a1fd2ce93fe10f4
MIT
Qwen/Qwen-72B
1. YES
2. YES