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