FI 450/597 – 9.21.2021






Leading up to this example…

… we understand that any distribution from the (a,b,1) class is really a distribution from (a,b,0) for which we have altered the probability of a 0 outcome. There are two different kinds of alterations/modifications we will see for each of these distributions: zero-truncated and zero-modified.

Zero-Truncated

For the zero-truncated case, we set the initial probability at zero \(p^T_0\) equal to zero. This results in the need to renormalize the other probabilities so that the sum of all probabilities is 1. This is done by multiplying each of the probabilities in the distribution by a factor of \(\frac{1}{1-p_0}\). To keep our notation clean, this means:

\[p^T_k = \dfrac{1}{1-p_0}p_k\]

We also saw how this plays out with expected values.

\[
E\left[X\right]=\sum_k kp_k \\
E\left[X^T\right] = \sum_k kp^T_k = \sum_k k\left(\dfrac{1}{1-p_0}p_k\right)=\dfrac{1}{1-p_0}\sum_k kp_k=\dfrac{1}{1-p_0}E[X]
\]

The same logic applies to all raw moments. To get variance, we rely on our old friend

\[Var[X]=E[X^2]-E[X]^2\]

Zero-Modified

For the zero-modified case, we set the initial probability at zero \(p^M_0\) equal to some \(x\), with \(0<x<1\). This also results in the need to renormalize the other probabilities so that the sum of all probabilities is 1. The easiest way is to start from the zero-truncated case, wherein \(p^T_0=0\), and simply “add in” the new probability at \(p^M_0\), which would be given or determined external to the distribution, itself. As in the zero-truncated case, this is done by multiplying each of the probabilities in the zero-truncated distribution by a factor. This time, the factor is \((1-p^M_0)\). Putting this all together we get

\[
p^M_k = (1-p^M_0)p^T_k=\dfrac{1-p^M_0}{1-p_0}p_k
\]
and the moment details parallel those we saw with the zero-truncated case.

Making sense of this with an example

We can see how this all plays out using an example. Here, I’m using a Poisson distribution with \(\lambda=5\).

lambda <- 5 # set lambda to 5
X <- seq(0,100) # set our Xs to be integers from 0 to 100
probs <- dpois(X,lambda=lambda) # this gets probabilities for each X

Before we start changing values in the probability distribution, let’s save some of them so we can look at them (or use them) later. To get \(p_0\) and \(p_5\):

p0 <- probs[1] # remember that X==0 (and therefore its related probability) is at index 1!
p0

[1] 0.006737947

p5 <- probs[6]
p5

[1] 0.1754674

Next, we set \(p_0\) to 0, which makes the sum of our probabilities less than 1.

probs[1] <- 0
sum(probs)

[1] 0.9932621

So, we renormalize the probabilities.

probs <- probs/(1-p0)
sum(probs)

[1] 1

We can now get the \(p^T_5\) using our newly constructed zero-truncated distribution.

pT5 <- probs[6]
pT5

[1] 0.1766577

In order to get the zero-modified distribution, we set the probability at zero to some externally determined value (other than zero). For this example, we’re using \(p^M_0=0.5\).

pM0 <- 0.5
probs[1] <- pM0

This means that the sum of probabilities in our zero-modified distribution is now larger than 1, so we must renormalize it, once again. Keep in mind, though, that we want the probability at zero to remain 0.5 (because we specifically set it to that value).

sum(probs)

[1] 1.5

probs <- (1-pM0) * probs
probs[1] <- pM0
sum(probs)

[1] 1

Finally, we can observe \(p^M_5\).

pM5 <- probs[6]
pM5

[1] 0.08832884

Importantly

pT5 == 1/(1-p0) * p5

[1] TRUE

pM5 == (1-pM0)/(1-p0) * p5

[1] TRUE

A final amazing thing!

As I mentioned in class, zero-truncated and zero-modified distributions are not available in base R. Fortunately, we can use the package actuar to work with these distributions.

library(actuar)

Given our example, we can go directly to the punchline with none of the legwork.

dztpois(5,lambda=lambda) # zero-truncated

[1] 0.1766577

dzmpois(5,lambda=lambda,p0=0.5) # zero-modified with p0 = 0.5

[1] 0.08832884

MAGICAL!