Hi guys,
I am trying to estimate the parameters of a nonhomogeneous Poisson process (a Poisson function with a time-varying rate parameter) by using Indirect Inference (a specific version of simulated method of moments). This Poisson process is used to simulate the number of breakdowns. The time-varying Poisson rate parameter mu_t is given by
mu_t = omega_mu + alpha_mu * windspeed_t
where omega_mu and alpha_mu are the parameters that have to be estimated and windspeed_t is the windspeed at time t. After simulating a path for mu, I use the poissrnd function to draw from a Poisson distribution, while fixing the seed for each simulation.
Given that I am using a version of the simulated method of moments I need to evaluate the simulated breakdowns and make sure it is as close as possible to the observed number of breakdowns. For this I use a set of statistics from the observed data:
sample_m = [mean(breakdowns), corr(breakdowns, windspeed)];
where I calculate the average number of breakdowns per day and calculate the correlation between the number of breakdowns and the windspeed based on ACTUAL data. These statistics will also be calculated for the simulated breakdowns and the distance between the set of statistics is measured using the MSE. The goal is obviously to minimize this distance by finding the optimal parameters. Now that I have explained the idea behind the estimation, here is my implementation:
theta_windspeed_struct = load('ii-windspeed.mat'); theta_windspeed = theta_windspeed_struct.theta_hat; simmed_windspeed = sim_windspeed(theta_windspeed, T); omega_mu_ini = 0.5; alpha_mu_ini = 0.2; theta_ini = [omega_mu_ini, alpha_mu_ini]; [theta_hat] = fminunc(@(theta) mean((sim_m_breakdowns(theta, T, simmed_windspeed) - sample_m).^2), theta_ini); simulated_mus = sim_breakdowns(theta_hat, T, simmed_windspeed); simulated_m = sim_m_breakdowns(theta_hat, T, simmed_windspeed);
where T is the size of the simulation and sim_m_breakdowns is given by
function output = sim_m_breakdowns(theta, T, simmed_windspeed) mus = sim_breakdowns(theta, T, simmed_windspeed); rng(1) breakdowns = poissrnd(mus); output = [mean(breakdowns), corr(breakdowns, simmed_windspeed)]; end
and sim_breakdowns is given by
function output = sim_breakdowns(theta, T, simmed_windspeed) omega_mu = theta(1); alpha_mu = theta(2); mus = zeros(T, 1); for t=1:T mus(t) = omega_mu + (alpha_mu * simmed_windspeed(t)); end output = mus; end
The problem is that fminunc stops after just one run, claiming that the objective function cannot be decreased along the current search direction (even though the MSE > 0.0001). I used a similar method to estimate the parameters for the windspeed equation and that worked perfectly, with the MSE < 0.0001 after a few hundred iterations. My guess is that this "error" is due to my draw from the poissrnd but I don't know why this doesn't work. I feel like everything I did in my code is valid. Do you guys have any idea?
UPDATE: apparently fminsearch does work and yields me relatively good estimates, however I am still interested in why the choice of minimizer matters in this case.
[link] [comments]