SPSS 20 Vista
when trying to fit a distribution with discrete positive values from 0,1,2, ... with Distribution Fit (extention R)* on the Gamma distribution, this results in an error message: "The distribution could not be fit. Variable: TotalScore, Distribution: gamma" When eliminating the value 0 there is no error message. This is a bit strange, since gamma should be defined for values including 0 and the SPSS dialog (PPLOT) also accepts values including 0. Frank * STATS DISTFIT VARIABLE=TotalScore DISTRIBUTION=gamma /OPTIONS QQPLOT=YES.
Dr. Frank Gaeth
|
It isn't the range of values that is causing
the problem. It is likely that the Gamma distribution fits these
data poorly. The underlying R function used here is documented as
sometimes failing when the fit is poor.
HTH, Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: drfg2008 <[hidden email]> To: [hidden email] Date: 12/29/2011 02:07 AM Subject: [SPSSX-L] Distribution Fit (Gamma) Sent by: "SPSSX(r) Discussion" <[hidden email]> SPSS 20 Vista when trying to fit a distribution with discrete positive values from 0,1,2, ... with Distribution Fit (extention R)* on the Gamma distribution, this results in an error message: "/The distribution could not be fit. Variable: TotalScore, Distribution: gamma/" When eliminating the value 0 there is no error message. This is a bit strange, since gamma should be defined for values including 0 and the SPSS dialog (PPLOT) also accepts values including 0. Frank * STATS DISTFIT VARIABLE=TotalScore DISTRIBUTION=gamma /OPTIONS QQPLOT=YES. ----- Dr. Frank Gaeth FU-Berlin -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Distribution-Fit-Gamma-tp5107230p5107230.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
ok, but if you change 0 into something near 0 it suddenly works (RV "non_zero" should fit as bad as "rv_poisson")
input program. loop a =1 to 1000 by 1. end case. end loop. end file. end input program. EXECUTE. COMPUTE rv_poisson=RV.POISSON(2.5). COMPUTE non_zero=rv_poisson+10**(-100). EXECUTE. STATS DISTFIT VARIABLE=rv_poisson DISTRIBUTION=gamma /OPTIONS QQPLOT=NO. STATS DISTFIT VARIABLE=non_zero DISTRIBUTION=gamma /OPTIONS QQPLOT=NO. Frank
Dr. Frank Gaeth
|
Thanks Paul, yep, that's it. And wiki was wrong: http://en.wikipedia.org/wiki/Gamma_distribution I checked my textbooks now and right, it's x>0. Thanks. Frank Gamma is greater than zero.
Dr. Frank Gaeth
|
In reply to this post by drfg2008
Apparently that change is enough to enable
the numerical algorithm to find adequate starting values. I have
not looked at the code in the underlying R function to see why it might
be so sensitive in this case. The documentation for that function
says,
For the following named distributions, reasonable starting values will be computed if start is omitted or only partially specified: "cauchy", "gamma", "logistic", "negative binomial" (parametrized by mu and size), "t" and "weibull". Note that these starting values may not be good enough if the fit is poor: in particular they are not resistant to outliers unless the fitted distribution is long-tailed. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: drfg2008 <[hidden email]> To: [hidden email] Date: 12/29/2011 07:16 AM Subject: Re: [SPSSX-L] Distribution Fit (Gamma) Sent by: "SPSSX(r) Discussion" <[hidden email]> ok, but if you change 0 into something near 0 it suddenly works (RV "non_zero" should fit as bad as "rv_poisson") input program. loop a =1 to 1000 by 1. end case. end loop. end file. end input program. EXECUTE. COMPUTE rv_poisson=RV.POISSON(2.5). COMPUTE non_zero=rv_poisson+10**(-100). EXECUTE. STATS DISTFIT VARIABLE=rv_poisson DISTRIBUTION=gamma /OPTIONS QQPLOT=NO. STATS DISTFIT VARIABLE=non_zero DISTRIBUTION=gamma /OPTIONS QQPLOT=NO. Frank ----- Dr. Frank Gaeth FU-Berlin -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Distribution-Fit-Gamma-tp5107230p5107726.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Free forum by Nabble | Edit this page |