Re: [SPSSX-L] Negative Binomial – SPSS Bug (?)
Posted by
Ryan on
Sep 28, 2012; 3:40am
URL: http://spssx-discussion.165.s1.nabble.com/Negative-Binomial-SPSS-Bug-tp5715014p5715342.html
There are two parameterizations of the negative binomial distribution with which I am familiar. If you search the document below for "4.8", you'll find the negative binomial probability distribution which I think interests you:
Based on the probability distribution function provided in the document above (4.8), one could easily obtain the probability that y equals a specific value using the syntax BELOW my name. Note that I have set the mean at lambda=3 and the variance at variance=4; this represents an overdispersed situation, which is appropriate for the negative binomial distribution. Also, you'll see that I demonstrate how to compute the dispersion parameter ("k") based on the mean and variance. Finally, the AGGREGATE function shows you how to obtain the probability that y is less than or equal to 15.
HTH,
Ryan
--
DATA LIST LIST / lambda variance y.
BEGIN DATA.
3 4 0
3 4 1
3 4 2
3 4 3
3 4 4
3 4 5
3 4 6
3 4 7
3 4 8
3 4 9
3 4 10
3 4 11
3 4 12
3 4 13
3 4 14
3 4 15
END DATA.
compute k = lambda**2 / (variance - lambda).
compute prob_y = ((k / (k + lambda))**k) * (exp(lngamma(k + y)) / (exp(lngamma(y+1))*exp(lngamma(k)))) * (lambda / (k + lambda))**y.
execute.
AGGREGATE
/OUTFILE=* MODE=ADDVARIABLES
/BREAK=
/cum_prob_15=SUM(prob_y).
Ryan
On Thu, Sep 27, 2012 at 7:04 AM, SD
<[hidden email]> wrote:
Hello,
I have the same problem like Frank and I don't manage to solve it.
Regarding to
http://pic.dhe.ibm.com/infocenter/spssstat/v21r0m0/index.jsp?topic=%2Fcom.ibm.spss.statistics.help%2Fsyn_transformation_expressions_random_variable_distribution_functions.htm
, http://pic.dhe.ibm.com/infocenter
<http://pic.dhe.ibm.com/infocenter/spssstat/v21r0m0/index.jsp?topic=%2Fcom.ibm.spss.statistics.help%2Fsyn_transformation_expressions_random_variable_distribution_functions.htm>
there is used a density formula, which uses an other definition of the
negative Binomial distribution than the one from the source from Frank [1].
Since I have the expected value E and the Variance V, I want to compute the
two parameters probability p and the threshold r.
For the in SPSS used definition, I found
E=r/p
V=r*(1-p)/p²
(found at
http://de.wikipedia.org/wiki/Negative_Binomialverteilung#Erwartungswert
<http://de.wikipedia.org/wiki/Negative_Binomialverteilung#Erwartungswert> ,
sorry for the german link, I just didn't found this in english.)
Derived from this I get
p=1/(V/E +1)
r=E*p
But this results in two problems:
One is, that there are different results than with the variant from Franks
source.
The other is that like this, p is always <1/2 (since V/E>1, over dispersion)
and resulting from this, if E<=2, then r<1, then SPSS Error.
Thank you in advance,
Silvio.
Literature:
[1] Schlittgen, R.: Einführung in die Statistik. 5. Auflg. Oldenbourg 1995,
S.203 ff
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Negative-Binomial-SPSS-Bug-tp5715014p5715310.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