Hi again ,
whatever i run it was in MLE window.
but when i try to run script in script command i have following problems:
open data2-1
scalar a = -0.5*log(2*pi)
scalar m=mean(vsat)
scalar mu=m/2
scalar sigma=m/mu
mle logl=a-log(sigma)-((vsat-mu)^2/2*sigma^2)
params mu sigma
end mle --hessian
with this code error is "*Failed to compute numerical Hessian"*
**
And if i use derivatives it says "*NLS: The supplied derivatives seem to be
incorrect"*
**
open data2-1
scalar a = -0.5*log(2*pi)
scalar m=mean(vsat)
scalar mu=m/2
scalar sigma=m/mu
mle logl=a-log(sigma)-((vsat-mu)^2/2*sigma^2)
deriv mu=(vsat-mu)/sigma^2
deriv sigma=-1/sigma+((vsat-mu)^2/sigma^3)
end mle
Derivatives seems to me fine but i do not know may be something wrong!!!
I think i am doing too much basic mistakes but i am not getting those :(,
Thanks in advance.
Ciao
Haider
On 10 May 2010 17:07, Allin Cottrell <cottrell(a)wfu.edu> wrote:
On Mon, 10 May 2010, RAZIA HAIDER wrote:
> I am new to gretl, i want to use its MLE for estimation. I have written
> small script just to check that how MLE works but i have following error
> message (criterion is not met a warning ). I have used sample data set
data
> 2-1.gdt. here is my scrpit.
>
> genr pi=3.14
> scalar a=2*pi
> scalar mu=1
> scalar sigma=1
> series s=sigma^2
> sereis sq=2*s
> series s3=sigma^3
> scalar sq3=2*s3
> series c=vsat-mu
> series sq1=c^2
>
> mle logl=-0.5*log(a)-log(sigma)-(sq1/sq)
> deriv mu=-c/s
> deriv sigma=-1/sigma + (sq1/s3)
> end mle
Please post a script that actually runs. The above has some basic
errors and will not get as far as producing a numerical error from
the mle command.
It fails first at "sereis sq=2*s". That typo is easily fixed, but
it then fails at "scalar sq3=2*s3". This is a type error: s3 is a
series so the formula "2*s3" yields a series result, which cannot
be coerced to a scalar. However, since sq3 is not actually used
below this line can be deleted.
Then we hit "vsat", which is presumably a data series. To
replicate your results, we need to know where that is coming from.
All that said, your mle block is not set up correctly. You have
mle logl=-0.5*log(a)-log(sigma)-(sq1/sq)
deriv mu=-c/s
deriv sigma=-1/sigma + (sq1/s3)
end mle
It looks as if you are trying to estimate mu and sigma, but mu is
given no role in the loglikelihood so this cannot work. In
addition "sq" is apparently a function of sigma but it is not
updated within the mle block. Before the "deriv" lines you need to
update any quantities in the "logl" expression that depend on mu
and sigma.
Also note that "pi" is a built-in constant in gretl; you don't
need to define it yourself, nor do you need to calculate log(a)
within the mle block; it would suffice to do something like
scalar a = -0.5*log(2*pi)
before the mle block, then express logl as "a + ...".
Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
--
Razia Haider
Ph.D. student
Dipartimento di Ingegneria dell'Informazione
Universita' di Modena e Reggio Emilia
Via Vignolese 905, 41100 Modena, Italy
e-mail: razia.haider(a)unimo.it
tel: +39 059 2056314