I’m having difficulties dealing with a time series of relations between two numbers.
I have two time series, essentially a count of "successes" and "trials". What I'm interested in, though, is the relation between these two numbers: I want to extrapolate this success rate to the whole population.
Another complication is that I'm sure (as in, 99% sure) that earlier periods are heavily biased and don't represent the population well.
Now, I'm not sure how I could model this. I tried modelling the series as a random walk for the log of the ratio. Something like (following this example: ):
with pm.Model() as model: smth_parm = pm.Uniform("smth_parm", lower=0, upper=1) tau2 = pm.Exponential("tau", 1.0/(50.0**2.0)) z2 = pm.GaussianRandomWalk("z2", tau=tau2 / (1.0 - smth_parm), shape=len(rates_df)) obs = pm.Normal("obs", mu=z2*np.log(rate_df.rate_lag), tau=tau2 / smth_parm, observed=np.log(rates_df.rate))
And got this result (sampling from Posterior Predictive Checks):
I'm PRETTY sure the initial period should have a mean closer to the later ones, even at the cost of an even higher variance. But I can't see how to force that into the model.
So, I need help to:
1- Model this ratio
2- "Force" the model to admit the earlier periods as biased
And I know this whole "Series of Ratios of Successes" stinks like a Beta(Binomial) should be involved, but I'm not sure how. And yes, the number of successes and trials do increase over time, but even considering this, the beginning is biased "up".
Most guides and tutorials are about forecasting, but that’s not what i need. I simply wish to create a model that better describes my data. Specifically, the future better informing past entries