Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Matlab codes for likelihood

Subject: Matlab codes for likelihood

From: Renato Costa

Date: 2 Jan, 2009 02:33:01

Message: 1 of 6

Hi,

I wonder if any of you have done a maximization procedure to do the maximum likelihood with constraints to estimate an econometric model. If so, I would like to see them.
I have a raw code but i don't know how to organize it and how to use some commands properly. taking a look at some codes might help me.

Thank you


 

Subject: Matlab codes for likelihood

From: Renato Costa

Date: 5 Jan, 2009 04:21:02

Message: 2 of 6

Maybe I should do more specific questions...

1. In which point at fmincon does the data enter? I know how to read data but where should i include it to be used in the finding of parameters estimates?

2. Why do I get an error in the following sentence:

??? Subscripted assignment dimension mismatch.

Error in ==> main at 24
     RegAc(1,t) = ( alpha(1) + (beta(1))*h(t-1) + (lambda(1))*(mu(t-1)+ (h(t-1))*(e(t-1)^2 )));%Regime zero

if I declared:

RegAc=zeros(H+1,T); 3x100 but RegAc(1,t) is 1x100
h=zeros(1,T); 1x100

What am I missing?

Thanks



"Renato Costa" <noldo22@yahoo.com.br> wrote in message <gjjuct$8rt$1@fred.mathworks.com>...
> Hi,
>
> I wonder if any of you have done a maximization procedure to do the maximum likelihood with constraints to estimate an econometric model. If so, I would like to see them.
> I have a raw code but i don't know how to organize it and how to use some commands properly. taking a look at some codes might help me.
>
> Thank you
>
>
>

Subject: Matlab codes for likelihood

From: Peter Perkins

Date: 5 Jan, 2009 17:28:09

Message: 3 of 6

Renato Costa wrote:
> Maybe I should do more specific questions...
>
> 1. In which point at fmincon does the data enter? I know how to read data but where should i include it to be used in the finding of parameters estimates?

You would normally want to define a likelihood function in the form

   function nll = negLogLike(params,data)

and then give FMINCON an anonymous function like

   objFun = @(params) negLogLike(params,specificData)

where specificData is the actual variable in your workspace.


> 2. Why do I get an error in the following sentence:
>
> ??? Subscripted assignment dimension mismatch.
>
> Error in ==> main at 24
> RegAc(1,t) = ( alpha(1) + (beta(1))*h(t-1) + (lambda(1))*(mu(t-1)+ (h(t-1))*(e(t-1)^2 )));%Regime zero
>
> if I declared:
>
> RegAc=zeros(H+1,T); 3x100 but RegAc(1,t) is 1x100
> h=zeros(1,T); 1x100

Can't help you there, other than to point out that the error message is pretty specific as to what's wrong. Set a breakpoint (or use "dbstop if error") and use the debugger to find out what is the wrong size.

Hope this helps.

Subject: Matlab codes for likelihood

From: Renato Costa

Date: 6 Jan, 2009 01:40:20

Message: 4 of 6

hi Peter

Thanks for the message.
I corrected another error and the message in question no 2 just stopped appearing.
The dimensions were ok as I supposed. Don't know what happened.

About the fmincon I've seen in forums that people actually use fminsearch instead. But my doubt is even basicier: How my series will enter in the negloglike function?
The normal loglikelihood doesn't depend on data. Only h_t and e_t .
Should I put it as an input even not actually using then in my calculations?

Best Regards

Renato

Peter Perkins <Peter.PerkinsRemoveThis@mathworks.com> wrote in message <gjtfv9$e0g$1@fred.mathworks.com>...
> Renato Costa wrote:
> > Maybe I should do more specific questions...
> >
> > 1. In which point at fmincon does the data enter? I know how to read data but where should i include it to be used in the finding of parameters estimates?
>
> You would normally want to define a likelihood function in the form
>
> function nll = negLogLike(params,data)
>
> and then give FMINCON an anonymous function like
>
> objFun = @(params) negLogLike(params,specificData)
>
> where specificData is the actual variable in your workspace.
>
>
> > 2. Why do I get an error in the following sentence:
> >
> > ??? Subscripted assignment dimension mismatch.
> >
> > Error in ==> main at 24
> > RegAc(1,t) = ( alpha(1) + (beta(1))*h(t-1) + (lambda(1))*(mu(t-1)+ (h(t-1))*(e(t-1)^2 )));%Regime zero
> >
> > if I declared:
> >
> > RegAc=zeros(H+1,T); 3x100 but RegAc(1,t) is 1x100
> > h=zeros(1,T); 1x100
>
> Can't help you there, other than to point out that the error message is pretty specific as to what's wrong. Set a breakpoint (or use "dbstop if error") and use the debugger to find out what is the wrong size.
>
> Hope this helps.

Subject: Matlab codes for likelihood

From: NZTideMan

Date: 6 Jan, 2009 02:34:56

Message: 5 of 6

On Jan 6, 2:40=A0pm, "Renato Costa" <nold...@yahoo.com.br> wrote:
> hi Peter
>
> Thanks for the message.
> I corrected another error and the message in question no 2 just stopped a=
ppearing.
> The dimensions were ok as I supposed. Don't know what happened.
>
> About the fmincon I've seen in forums that people actually use fminsearch=
 instead. But my doubt is even basicier: How my series will enter in the ne=
gloglike function?
> The normal loglikelihood =A0doesn't =A0depend on data. Only h_t and e_t .
> Should I put it as an input even not actually using then in my calculatio=
ns?
>
> Best Regards
>
> Renato
>
> Peter Perkins <Peter.PerkinsRemoveT...@mathworks.com> wrote in message <g=
jtfv9$e0...@fred.mathworks.com>...
> > Renato Costa wrote:
> > > Maybe I should do more specific questions...
>
> > > 1. In which point at fmincon does the data enter? I know how to read =
data but where should i include it to be used in the finding of parameters =
estimates?
>
> > You would normally want to define a likelihood function in the form
>
> > =A0 =A0function nll =3D negLogLike(params,data)
>
> > and then give FMINCON an anonymous function like
>
> > =A0 =A0objFun =3D @(params) negLogLike(params,specificData)
>
> > where specificData is the actual variable in your workspace.
>
> > > 2. Why do I get an error in the following sentence:
>
> > > ??? Subscripted assignment dimension mismatch.
>
> > > Error in =3D=3D> main at 24
> > > =A0 =A0 =A0RegAc(1,t) =3D ( alpha(1) + (beta(1))*h(t-1) + (lambda(1))=
*(mu(t-1)+ (h(t-1))*(e(t-1)^2 )));%Regime zero
>
> > > if I declared:
>
> > > RegAc=3Dzeros(H+1,T); =A0 =A03x100 =A0but =A0 =A0 =A0RegAc(1,t) =A0is=
 1x100
> > > h=3Dzeros(1,T); =A0 =A0 =A0 =A0 =A0 =A0 =A0 1x100
>
> > Can't help you there, other than to point out that the error message is=
 pretty specific as to what's wrong. =A0Set a breakpoint (or use "dbstop if=
 error") and use the debugger to find out what is the wrong size.
>
> > Hope this helps.

There is a (free) Matlab toolbox that fits Generalised Extreme Value
(GEV) and Pareto distributions using maximum likelihood here:
http://www.bilkent.edu.tr/~faruk/evim.htm

Subject: Matlab codes for likelihood

From: Renato Costa

Date: 6 Jan, 2009 03:06:01

Message: 6 of 6

Thanks for the hint, but what I'm doing is fitting the FC-GARCH od veiga and medeiros (Econometric Theory 2008)

NZTideMan <mulgor@gmail.com> wrote in message <0aad4b3e-be3f-4a6e-a6c2-8cc6504a8291@p2g2000prf.googlegroups.com>...
> There is a (free) Matlab toolbox that fits Generalised Extreme Value
> (GEV) and Pareto distributions using maximum likelihood here:
> http://www.bilkent.edu.tr/~faruk/evim.htm

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us