I’m trying to implement Zero Inflated Poisson probability distribution (ZIP) using ProbabilityDistribution. I’m using the following code:
zipDistribution[l_,w_]:=ProbabilityDistribution[Switch[k,0,w+(1-w)Exp[-l],_,(1-w)l^k/k! Exp[-l]], {k, 0, \[Infinity], 1}];
however this doesn’t seem to work. For example, the probability of my random variable being equal to zero should be close to 0.1 but I get 0.000041. This is the code that I’m using to calculate this probability:
PDF[zipDistribution[10, .1], 0] (* Returns 0.000041, expected return is 0.100041 *)
I also tried plotting the CDF which further indicates some kind of issue:
DiscretePlot[CDF[zipDistribution[10,.1],a]//Evaluate,{a,-10,30},ImageSize->Large,PlotRange->{{-1,30},{0,1.1}}]