Bayesian Deming regression - About the sampling method
The basic concept in rstanbdp is to sample a single error term instead of two. The idea comes from the Weighted Deming procedure proposed by Linnet in multiple articles, for example K. Linnet, Clinical Chemistry 44:5, 1024-1031 (1998)
Given a set of \(N\) pairs of \(X_{i}\) and \(Y_{i}\) in \(\mathbb{R^{2}}\) and for a fixed error ratio \(\lambda = \frac{\sigma^{2}_{X}}{\sigma^{2}_{Y}}\) the estimated \(\hat{X}_{i}\) and \(\hat{Y}_{i}\) are calculated as follow, given \(\alpha\) the intercept and \(\beta\) the slope that are sampled from the priors (see further below for priors).
\[P_{i} = X_{i} \cdot \beta + \alpha\] \[\delta_{i} = Y_{i} - P_{i}\] \[\hat{X}_{i} = X_{i} + \frac{\lambda \cdot \delta_{i} \cdot \beta}{1 + \lambda \cdot \beta^2}\] \[\hat{Y}_{i} = Y_{i} - \frac{\delta_{i}}{1 + \lambda \cdot \beta^2}\]Then the euclidean distances \(e_{i}\) of the estimated points from its real position are calculated with:
\[e_{i} = \sqrt{(X_{i} - \hat{X}_{i})^{2} + (Y_{i} - \hat{Y}_{i})^{2} }\]Thus in the Bayesian model, setting the following priors. Priors parameter are fully tweak able. Worth mentioning that the \(\beta\) prior is per default truncated at \(\beta = 0.3333\). This truncation prevents erratic behaviour of the sampling mechanism when \(\lambda\) is strongly different from 1.
\[\alpha \sim \mathcal{N}( 0 , \sigma^{2}_{\alpha})\] \[\beta \sim \mathcal{N}( 1 , \sigma^{2}_{\beta})\] \[\sigma \sim \mathcal{E}(\lambda_{sigma})\]The likelihood gets optimised as
\[e_{i} \sim \mathcal{T}(0,\sigma,df = N-2)\]Of course a normal distribution for the likelihood would also be a good option. Test
For the heteroscedastic linear model the \(\sigma\) prior is substituted by a pair of linear parameters \(\alpha_{var}\) and \(\beta_{var}\) with normal priors
\[\alpha_{var} \sim \mathcal{N}( 0 , \sigma^{2}_{\alpha_{var}})\] \[\beta_{var} \sim \mathcal{N}( 0 , \sigma^{2}_{\beta_{var}})\]and the likelihood function is defined as
\[e_{i} \sim \mathcal{T}(0,\alpha_{var} + \beta_{var} \cdot \frac{X_{i}+Y_{i}}{2},df = N-2)\]Models with additional error structure are planned.