I am trying to control the volatility in a simulation, and though I finally thought of a solution after writing this complete question, I would prefer a simpler solution that does not generate too many numbers.
The situation
I have a vector of normally ($\mu,\sigma$) distributed values (demand height), then I use a poisson ($\lambda$) distribution to determine how much time there is between observations (days between demand points). I need the result in this much detail, but I also group the observations based on when they occur (weekly buckets) and plot this in a graph.
The goal
I am now trying to reduce the volatility that is shown in this weekly graph, whilst keeping the mean intact.
What have I tried
- Reduce the volatility in values: This helps a little bit but most volatility comes from the spread in when observations occur
- Spread out the observations: This helps, but especially when there are few observations the difference between weeks can still be huge just because there is 1 full observation more or less.
- Generating more observations, but with the same mean per week.
The latter did not work out the way I want because multiplying both $\lambda$ and the observations with a constant, introduced many differences of zero days leading to a bias.
Here is some sample code to illustrate the problem:
factor = 0.1; %Is 1 in the original code
lambda=10;
daily_result = zeros(36500,1);
observations=1000*factor*ones(36500,1);
time_between_observations=max(1,poissrnd(lambda*factor,36500,1));
time = cumsum(time_between_observations);
time = cumsum(time_between_observations);
time = time(time<36500);
daily_result(time) = observations(time);
weekly_result = sum(reshape(daily_result,5,[]));
mean(weekly_result)
I would like the mean weekly result to be around 500, regardless of the factor. But setting it to 0.1 puts the mean around 360 instead..
After writing out the question I came up with a workable solution, however I will still post it here as this method feels quite ugly, and though I can simply not come up with something more elegant, I hope someone else can.
One reason why the bias occurs is that the mean time between observations does not reduce with a factor 10, this is because of the requirement that the minimum is 1. A way to deal with the fact that the impact of the factor on the mean time between observations is unknown, would be to calculate both situations. Afterwards the mean would be known and with it the required correction factor of the observations.
Here is the solution that I came up with, but I believe it deserves an E for elegance.