Semi-parametric estimation of interval duration distributions - #273
Semi-parametric estimation of interval duration distributions#273JoKra1 wants to merge 2 commits into
Conversation
|
Hey Joshua, Looks very cool! Let's discuss that soon indeed. |
|
Done! I updated tutorials 1-3 and tried to set all models to Two possible explanations:
I also fit eliminative models to the accuracy data and both the original/semi-parametric find essentially an identical 4 intervals + probable duplicate solutions for 5 and 6 intervals. Generally, the likelihood is consistently higher for the estimates proposed here. But also, the likelihood just increases with events, so I was really hoping to do some cross-validation - but I realised that is not actually implemented at the moment. We should really add that. Neither the cumulative nor the eliminative method provide an estimate of the expected loss/how well the estimated number of events generalises - so across experiments/simulations we are guaranteed to overfit eventually. I personally would thus only ever trust event number estimates based on an estimate of the expected loss rather than the empirical loss. Anyway, that is a different problem. Generally the proposal here works really well. On the real data we see the benefit of not specifying a parametric family - the estimated durations are really quite different between intervals and also not necessarily close to a Gamma. Especially for the last interval we also see the bias introduced by the Gamma with a minimum duration of 1: the semi-parametric estimate attributes a significant mass to zero durations for that interval. The Gamma cannot. The approach might just require cross-validation even more than the current implementation because of the increased number of parameters/risk of over-fitting. |
|
I really like the principle, it's also elegant! Shouldn't we think of reducing |
|
Hmm, I am not so sure about that. The point of the smoothing (bias) is to ensure better generalisation of the estimated distributions: the un-smoothed estimate can really result in pmfs that we would immediately consider an over-fitted estimate. So it can easily miss the true distributions. See the plot below for the example from tutorial 1:
To be clear: the estimate is not bad! It's actually much better for the data at hand (llk ~ -138 vs. llk ~ -170 for the smoothed one). It achieves this by really clinging to the most plausible interval durations for this data. But with little data, we cannot really be sure that these interval durations are really reflective of what we would find in a different/larger dataset (this should improve with more data). The smoothed estimate does not suffer that problem (as much), and that is precisely the point: if we get That said, there is definitely a point in trying to estimate The more stable route would be REML, which requires some model of the proportions The resulting smooth functions (most importantly their
|


Hey @GWeindel ,
This PR outlines how to perform semi-parametric estimation of the probability mass functions for the peak-2-peak interval durations.
Motivation:
Proposed Solution:$p(\tau_j=d)$ instead, where $\tau_j$ is the duration of interval $j$ . The downside is that we have to estimate up to
So, if parametric distributions don't do it for us, we let the estimation routine figure out the appropriate distribution itself. That is, rather than estimating the scale (or shape and scale) for a given parametric distribution, we estimate the probabilities
max_durparameters per interval/group combination, but we can apply regularization to still make this work.Comparisons to existing approaches:
This is essentially the most complex/flexible approach that we can take. So far, we have the most restrictive implemented (just fit scale). #267 allows to estimate both scale and shape. This PR estimates the entire distribution. Funny: while this is the most complex approach, the math is actually simpler and borrows from the M step in #267.
Current issues:
estim_d_probs.Math:$p(\tau_{s,j} = d | \mathbf{C}, \boldsymbol{\theta})$ again denote the posterior probabilities over the latent variables; the duration $\tau$ of peak-2-peak interval $j$ on trial $s$ given data $\mathbf{C}$ and current parameters $\boldsymbol{\theta}$ . I outline how to compute them in #267 (as mentioned, the notation incorrectly works with stages but the math stays the same). Now, we are interested in some estimate of $p(\tau_j=d | \mathbf{C}, \boldsymbol{\theta}^k)$ , the probability of the duration $\tau$ of peak-2-peak interval on any given trial given the data and current ($k$ is the iteration of the EM algorithm) parameter estimates. We can then use $p(\tau_j=d | \mathbf{C}, \boldsymbol{\theta}^{k-1})$ as the pmf for interval durations in the E step of the EM algorithm to estimate $p(\tau_j=d | \mathbf{C}, \boldsymbol{\theta}^k)$ ; so the probabilities themselves - from the previous iteration - are part of $\boldsymbol{\theta}$ .
Like I said, the following borrows a lot from the M step discussed in #267. Let
where $S$ is the total number of series. First note, that the denominator simplifies to$S$ , since $\sum_{d'=1}^Dp(\tau_{s,j}=d'|\mathbf{C},\boldsymbol{\theta}^{k-1})=1\ \forall\ s$ . Then note, that the numerator is essentially an estimate of the expected number of trials on which $\tau_j=d$ so that the ratio becomes a valid estimate of the proportion. Note also, that because trials are assumed to be mutually independent, the numerator converges to the expected number of trials on which $\tau_j=d$ as $S$ increases (theoreticlally to infinity). This estimate is also essentially the same one used for more general HSMMs (see for example section 2.3.1 of Yu, 2011).
max_dur(followed by re-normalizing).Current implementation
model.semi_parametric=Trueafterinittriggers semi-parametric estimation of the pmfs. I propose to implement it in a way that the scale (and optionally shape) parameters are still estimated alongside the probabilities. They will not be MLE estimates, but together with the specifieddistributionwe can think of them as the best parametric description of the semi-parametric distribtution estimates.model.smooth_spmfs = Trueandmodel.smooth_spmfs_lam = 100control the optional smoothing step, which is enabled and quite strong by default. These parameters can also be changed afterinit.model.spmfsholds the semi-parametric estimates of the distributions after callingfit. See the updated tutorial for a plot - if you like this addition I will clean that up.Here an image of the true (solid) vs. recovered (dashed) distributions from the tutorial 1 example (for$\lambda=200$ ):

Happy to discuss this in the meeting with @jelmerborst and @lvmaanen as well!
Cheers,
Josh