On Sun, 18 Nov 2012, Jean-Baptiste Combes wrote: > I am using Grelt 1.8.7 with Ubuntu and I am mainly using it for > teaching. With colleagues we are preparing tutorials.
Version 1.8.7 is pretty old by now. You might want to look at http://gretl.sourceforge.net/ChangeLog.html to see what has been improved/added/fixed since then. > One of the tutorial estimate a weibull model with the mle block. We use > censored data on unemployment. I have heard that there is a "duration" > command but for teaching purposes we prefer to use the mle block. We are > quite keen on making sure students understand the different > contributions to the likelihood. > > On top of that we would like them to estimate the mean time passed in > unemployment. The mean of a weibull distribution is not very easy to > compute by hand. Again I know that $yhat save exactly this after a > "duration" command but we are interested in doing it by hand. > > How do you compute an integral within gretl? Well, it depends on the integral: there's no built-in gretl function that computes the integral of an arbitrary function. But the expectation of the Weibull is exp(X*b) * G(1 + sigma) where G denotes the gamma function, which is available in gretl. <hansl> open recid.gdt -q list X = const workprg priors tserved felon alcohol \ drugs black married educ age duration durat X ; cens series yhat = $yhat matrix b = $coeff[1:$ncoeff-1] series means = exp(lincomb(X,b)) * gamma(1+$sigma) print yhat means -o </hansl> Allin Cottrell