Bayesian methods are widely used, but not many academic statisticians buy-in to the philosophy. Although throughout this course, we will argue that it is a natural way of handling problems, there are many opponents.
Expect all of my material to be biased.
Dose response modelling
Dose response modelling
Dose response modelling
Dose response modelling
Dose response modelling
Dose response modelling
Dose response modelling
The model
Mathematically, the model between response and dose, \(d\), can be written simply as
\[
r(d) = \begin{cases}
0, & d \leq \theta,\\
100\frac{d-\theta}{\kappa-\theta} & \theta < d < \kappa,\\
100, & d \geq \kappa.
\end{cases}
\]
And we have two unknown parameters \(\theta\) and \(\kappa\).
The model (2nd form)
Mathematically, the model between response and dose, \(d\), can be written simply as
\[
r(d) = \begin{cases}
0, & d \leq \theta,\\
100\frac{d-\theta}{\delta} & \theta < d < \theta + \delta,\\
100, & d \geq \theta + \delta.
\end{cases}
\]
And we have two unknown parameters \(\theta\) and \(\delta\).
Reality
Unfortunately, real world observations are unlikely to be this well behaved. Therefore, we also need to consider errors.
We believe that the test has a form of measurement error associated with it. We assume that the error is normally distributed:
Being proper Bayesians, we must consider our prior beliefs about each of the unknown parameters.
We have three parameters to consider: \(\theta\), \(\delta\) and \(\sigma_M\).
Prior for \(\theta\)
This parameter is the threshold dose in Molar for which the chemical becomes harmful.
Questions:
What does experience about other chemicals lead me to believe about this value?
What range of values are possible?
What circumstances would lead this to be a relatively high or low number?
Prior for \(\theta\)
This parameter is the threshold dose in Molar for which the chemical becomes harmful.
Questions:
What does experience about other chemicals lead me to believe about this value?
What range of values are possible?
What circumstances would lead this to be a relatively high or low number?
What evidence do you have to back all of this up?
Prior for \(\theta\)
Can you give a value for \(\theta\) for which you believe there is an equal chance of the true value being above or below?
Prior for \(\theta\)
Can you give a value for \(\theta\) for which you believe there is an equal chance of the true value being above or below?
Prior for \(\theta\)
Can you give a value for \(\theta\) for which you believe there is an equal chance of the true value being above or below?
Prior for \(\theta\)
Suppose \(\theta\) is definitely greater than 50, can you give a value for \(\theta\) for which you believe there is an equal chance of the true value being above or below?
Prior for \(\theta\)
Suppose \(\theta\) is definitely below 50, can you give a value for \(\theta\) for which you believe there is an equal chance of the true value being above or below?
Prior for \(\theta\)
We have the following histogram representation of our beliefs about \(\theta\):
Prior for \(\theta\)
We can fit a distribution that represents our beliefs about \(\theta\):
Prior for \(\theta\)
We can fit a distribution that represents our beliefs about \(\theta\):
Prior for \(\delta\)
The upper limit \(\kappa\) of the dose response (after which complete damage is guaranteed) is also uncertain. Recall that \(\delta\) is the gap between the lower limit \(\theta\) and \(\kappa\).
# extract the posterior samplestheta_samples <-extract(fit, pars ='theta')$thetadelta_samples <-extract(fit, pars ='delta')$deltasigma_M_samples <-extract(fit, pars ='sigma_M')$sigma_M
Comparison with priors
Comparison with priors
Study in healthy adults
Comparison with priors
Comparison with priors
Comparison with priors
Modal relationships
Modal relationships
Modal relationships
Modal relationships
Comparison with priors
Predictive distribution
Predictive distribution
Predictive distribution
Resolution
We can consider the amount of uncertainty that has been resolved by observing the data through: \[
\text{R}(\theta) = 1 - \frac{\text{Var}(\theta|\text{Data})}{\text{Var}(\theta)}.
\] We get \[
\text{R}(\theta) = 0.96,~\text{R}(\delta) = 0.32~\text{and R}(\sigma_M) = 0.64.
\]
An alternative model
As noted, there have been a few dodgy elements in the proposed model. Also, there is a theory that there is no real threshold for harm. We can consider an alternative formulation:
\[
r(d) = 100~\Phi\left(\frac{d-\mu}{\nu} \right),
\] with parameters \(\mu\) and \(\nu\).
summary(fit2, pars =c('mu','nu','sigma'), probs =c(0.05,0.5,0.95))
$summary
mean se_mean sd 5% 50% 95% n_eff
mu 93.133184 0.155396233 16.6173437 73.0107639 89.920636 124.431135 11435.16
nu 37.017227 0.111375878 11.7295596 23.7531219 34.350136 59.541693 11091.27
sigma 1.081619 0.002930401 0.3623079 0.6399465 1.010335 1.765676 15286.27
Rhat
mu 1.000429
nu 1.000251
sigma 1.000111
$c_summary
, , chains = chain:1
stats
parameter mean sd 5% 50% 95%
mu 93.133184 16.6173437 73.0107639 89.920636 124.431135
nu 37.017227 11.7295596 23.7531219 34.350136 59.541693
sigma 1.081619 0.3623079 0.6399465 1.010335 1.765676
# extract the posterior samplesmu_samples <-extract(fit2, pars ='mu')$munu_samples <-extract(fit2, pars ='nu')$nusigma_samples <-extract(fit2, pars ='sigma')$sigma
Comparison with priors
Comparison with priors
Comparison with priors
Predictive distribution
Predictive distribution
Predictive distribution
Model selection
We have proposed two fundamentally different models. How do we choose which is best?
personal choice,
Bayes factors,
Bayesian model averaging,
predictive performance,
(cross validation).
Model selection
Bayes factors use the model evidence to show which model is best supported by the data.
Bayesian model averaging produces weights to be used in a weighted-average for predictive distributions, which are closely related to the model evidence.
The model evidence is essentially the normalisation factor in the Bayesian update…
Model selection
We estimate expected log pointwise predictive density from leave-one out (loo) calculations.
This can be related to model evidence and a psuedo model weighting can then be derived.
Model selection
library(loo)# LOO for model 1loo1 <-loo(fit)loo1
Computed from 50000 by 7 log-likelihood matrix
Estimate SE
elpd_loo -24.5 2.0
p_loo 3.3 1.1
looic 49.0 4.0
------
Monte Carlo SE of elpd_loo is NA.
Pareto k diagnostic values:
Count Pct. Min. n_eff
(-Inf, 0.5] (good) 4 57.1% 4220
(0.5, 0.7] (ok) 1 14.3% 477
(0.7, 1] (bad) 2 28.6% 202
(1, Inf) (very bad) 0 0.0% <NA>
See help('pareto-k-diagnostic') for details.
Model selection
# LOO for model 2loo2 <-loo(fit2)loo2
Computed from 50000 by 7 log-likelihood matrix
Estimate SE
elpd_loo -10.8 1.4
p_loo 1.8 0.6
looic 21.6 2.8
------
Monte Carlo SE of elpd_loo is 0.0.
Pareto k diagnostic values:
Count Pct. Min. n_eff
(-Inf, 0.5] (good) 5 71.4% 12788
(0.5, 0.7] (ok) 2 28.6% 1542
(0.7, 1] (bad) 0 0.0% <NA>
(1, Inf) (very bad) 0 0.0% <NA>
All Pareto k estimates are ok (k < 0.7).
See help('pareto-k-diagnostic') for details.
Model selection
# Get pseudo-BMA weightsloo_list <-list(loo1, loo2)loo_model_weights(loo_list, method ="pseudobma", BB =FALSE)