Hi everyone,
I am trying to estimate rho, sigma and lambda using ML command. I have two timeseries data LN and TMP, and want to fit LN to a random walk process and TMP to an AR(1) process.
LN_{t} = LN_{t-1} +\sigma*sqrt(1-\lambda)*u_{t} where u_{t}~N(0,1), and
TMP{t} =\rho*TMP{t-1} +\sigma*sqrt(\lambda)*\eta_{t} where eta_{t}~N(0,1)
I constructed the following code, but it results in the message "could not find feasible values r(491);". Is there something wrong with my code, or is it simply that it cannot find the optimal values for rho, sigma, and lambda? Thank you for any comments.
I am trying to estimate rho, sigma and lambda using ML command. I have two timeseries data LN and TMP, and want to fit LN to a random walk process and TMP to an AR(1) process.
LN_{t} = LN_{t-1} +\sigma*sqrt(1-\lambda)*u_{t} where u_{t}~N(0,1), and
TMP{t} =\rho*TMP{t-1} +\sigma*sqrt(\lambda)*\eta_{t} where eta_{t}~N(0,1)
I constructed the following code, but it results in the message "could not find feasible values r(491);". Is there something wrong with my code, or is it simply that it cannot find the optimal values for rho, sigma, and lambda? Thank you for any comments.
Code:
program define loglik_combined args lnf rho sigma lambda // RW process tempvar dmu gen double `dmu' = LN -L.LN quietly replace `lnf' = ln(normalden(`dmu'/(`sigma'*sqrt(1-`lambda')), 0, 1)) - ln(`sigma'*sqrt(1-`lambda')) // AR(1) process tempvar dx gen double `dx' = TMP - `rho' * L.TMP quietly replace `lnf' = `lnf' + ln(normalden(`dx'/(`sigma'*sqrt(`lambda')), 0, 1)) - ln(`sigma'*sqrt(`lambda')) end constraint define 1 `rho' < 1 ml model lf loglik_combined (rho: ) (sigma: ) (lambda: ) ml search, repeat(500) ml init 0.5 2 0.4, copy ml maximize, difficult tolerance(1e-6) ltolerance(1e-7) constraints(1)
Comment