Unconditional Maximum Likelihood of an AR(10) model.

Is it possible to estimate the Unconditional Maximum Likelihood of an AR(10) model (see Hamilton pp.123 [5.3.6]) with maxlik library and loglik proc? If yes can you explain how to write the retp(  ???  ) part of the procedute?. If not what do you suggest doing?

Thank you very much.

T

3 Answers



0



accepted

For Maxlikmt you are required to write a procedure that returns the log-likelihood of your model.

From your description I'm assuming you have a univariate time series and you want to estimate an AR(10) model. The log-likelihood procedure takes two arguments, a PV structure containing the parameters of the model, in your case a vector of 10 autoregression parameters. The second argument is a DS structure containing the time series. To us the varmaml() function in the Run-Time Library you must remove the means from the data, i.e., there'll be no interecept. You can compute an intercept after you have the estimates.

So in your command file you'll have initialized a PV structure and a DS structure:

struct PV par;
par = pvPack(pvCreate,.01*ones(10,1),"AR");

load y[500,1] = "mydata.txt"; // assumes a vector of time series data
                              // in a text file called mydata.txt
struct DS ts;
ts.dataMatrix = y;

// your procedure looks like this
proc ll(struct PV p, struct DS d);

// res = varmares(w,phi,theta);
// we'll compute the residuals and compute
// the log-likelihood from that.  
// This procedure assumes a univariate time series.
// It will have to be modified for multivariate series

   local e,ar,ma,oldt,sse;
   ar = pvUnpack(p,"AR");
   ma = error(0);
   oldt = trapchk(2);
   e = varmares(d.dataMatrix,ar,ma);
   trap oldt,2;
   // we trapped the call to varmares because if it fails it'll
   // return a missing value and MaxlikMT might be able to
   // recover and try some different ar parameters

   if not scalmiss(e);
       retp(lnpdfn(e));
   else;
       retp(error(0));
   endif;
endp;


0



The varmal() function in the Run-Time Library computes an unconditional VARMA log-likelihood. Call that procedure in your log-likelihood proc.



0



Could you please give me a simple example how to combine these to procedures (varmall and loglik) or/and give me some reference?

Thanks,

T

Your Answer

3 Answers

0
accepted

For Maxlikmt you are required to write a procedure that returns the log-likelihood of your model.

From your description I'm assuming you have a univariate time series and you want to estimate an AR(10) model. The log-likelihood procedure takes two arguments, a PV structure containing the parameters of the model, in your case a vector of 10 autoregression parameters. The second argument is a DS structure containing the time series. To us the varmaml() function in the Run-Time Library you must remove the means from the data, i.e., there'll be no interecept. You can compute an intercept after you have the estimates.

So in your command file you'll have initialized a PV structure and a DS structure:

struct PV par;
par = pvPack(pvCreate,.01*ones(10,1),"AR");

load y[500,1] = "mydata.txt"; // assumes a vector of time series data
                              // in a text file called mydata.txt
struct DS ts;
ts.dataMatrix = y;

// your procedure looks like this
proc ll(struct PV p, struct DS d);

// res = varmares(w,phi,theta);
// we'll compute the residuals and compute
// the log-likelihood from that.  
// This procedure assumes a univariate time series.
// It will have to be modified for multivariate series

   local e,ar,ma,oldt,sse;
   ar = pvUnpack(p,"AR");
   ma = error(0);
   oldt = trapchk(2);
   e = varmares(d.dataMatrix,ar,ma);
   trap oldt,2;
   // we trapped the call to varmares because if it fails it'll
   // return a missing value and MaxlikMT might be able to
   // recover and try some different ar parameters

   if not scalmiss(e);
       retp(lnpdfn(e));
   else;
       retp(error(0));
   endif;
endp;
0

The varmal() function in the Run-Time Library computes an unconditional VARMA log-likelihood. Call that procedure in your log-likelihood proc.

0

Could you please give me a simple example how to combine these to procedures (varmall and loglik) or/and give me some reference?

Thanks,

T


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy