Hi Allin, "We already report the likelihood ratio test relative to the constant-only model for most (all? I'm not sure) ML estimators. What would you do differently?"
The deviance compares the estimated model to the full model! Here is the code of my function (overdispersion does not work at the moment). Since you already test on overdispersion it would be great if the calculation of the deviance and the scaled deviance could follow (SAS gives them both). function scalar DV (series y "Endogeneous variable of the last estimated model", string dist "with following distribution: Normal, Bernoulli, Binomial, Poisson", string disp[null] "Overdispersion?") genr yh = $yhat scalar p = cols($coeff) if dist = "Normal" matrix yh2 = yh matrix y2 = y matrix ssr = y2.-yh2 matrix ssr2 = ssr.^2 scalar DV = sum(ssr2) elif dist = "Bernoulli" smpl y=0 --restrict matrix yh2 = yh matrix y2 = y matrix l3 = -ln(1.-yh2) matrix part1 = l3 scalar sum1 = 2*sum(part1) smpl y=1 --restrict --replace matrix yh2 = yh matrix y2 = y matrix l1 = ln(y2./yh2) matrix part2 = y2.*l1 scalar sum2 = 2*sum(part2) scalar DV =sum1+sum2 elif dist = "Binomial" smpl y=0 --restrict matrix yh2 = yh matrix y2 = y matrix l3 = -ln(1.-yh2) matrix part1 = l3 scalar sum1 = 2*sum(part1) smpl y=1 --restrict --replace matrix yh2 = yh matrix y2 = y matrix l1 = ln(y2./yh2) matrix part2 = y2.*l1 scalar sum2 = 2*sum(part2) smpl y>1 --restrict --replace matrix yh2 = yh matrix y2 = y matrix l1 = ln(y2./yh2) matrix l2 = ln(1.-y2) matrix l3 = ln(1.-yh2) matrix l4 = (1.-y2) matrix part3 = y2.*l1+l4.*(l2.-l3) scalar sum3 = 2*sum(part3) scalar DV =sum1+sum2+sum3 elif dist = "Poisson" smpl y>0 --restrict matrix yh2 = yh matrix y2 = y matrix l1 = ln(y2./yh2) matrix l2 = (y2.*l1) - (y2.-yh2) scalar part1 = 2*sum(l2) smpl y=0 --restrict --replace matrix yh2 = yh scalar part2 = 2*sum(yh2) scalar DV = part1 + part2 endif printf "Deviance = %g\n", DV return DV end function I guess there are better ways to do these operations. Well, that's for now. Pindar -----Ursprüngliche Nachricht----- Von: gretl-users-bounces(a)lists.wfu.edu [mailto:gretl-users-bounces(a)lists.wfu.edu] Im Auftrag von Allin Cottrell Gesendet: Sonntag, 9. Mai 2010 18:34 An: Gretl list Betreff: Re: [Gretl-users] Bug in quantile reg output export routine and a question in terms of DEVIANCE On Sun, 9 May 2010, Pindar wrote: > I guess there is a small bug: I can only copy the output of a > quantile reg as plain text, all other formats crush. You should be able to copy quantile regression output in all formats when the specification gives a single value of tau. LaTeX output is not supported when multiple values of tau are given, but that non-support was not properly registered in the GUI. That is now fixed in CVS (i.e. the LaTeX option will not appear in the copy or save menus). > More important is my question, whether it would be possible to > add the deviance goodness of fit measure to all non linear > models? We already report the likelihood ratio test relative to the constant-only model for most (all? I'm not sure) ML estimators. What would you do differently? Allin Cottrell _______________________________________________ Gretl-users mailing list Gretl-users(a)lists.wfu.edu http://lists.wfu.edu/mailman/listinfo/gretl-users