2
$\begingroup$

I would like to left-censor (at zero) a probablity distribution function, but I just can't find a way to implement this in R. I have reviewed previous questions about censoring, but none have provided a solution to my problem. I already have a CDF with $\mu$ and $\sigma$ parameters and this CDF has to be censored at zero.

$\endgroup$

2 Answers 2

1
$\begingroup$

if you try to find conditional distribution of X s.to X >0, then this will be p(X |X >0) = p1(X) / (1-F(0)), p1(X) is density of X * I(x>0). It will integrate to 1 as p1(X) will integrate to 1 - F(0). The answer above just need to clarify that truncated density for normal distribution will be 2 * Normal density at x >0, and 0 for x<0, so integrating over all values is 2 * 1/2 =1 .

$\endgroup$
0
$\begingroup$

I think you mean a truncated distribution. A truncated distribution and one which arises from censoring both conceptually involve "cutting" a distribution past a certain threshold. However, censoring refers to the unobserved event time falling past a certain timepoint.

To "implement" a probability distribution in R - in other words to calculate the density function - you just make use of the following result:

Let $\theta$ be the "left" truncated value, meaning no observation less than $\theta$ can be observed. Let $X$ be a random variable distributed according to the "non-truncated" distribution function.

$$ f_Y(y) = \left\{ \begin{array}{cccc} \text{if} & y > \theta & \text{then} & \frac{f_X(y)} {1-F_X(\theta)} \\ &\text{else} && 0 \end{array} \right. $$

In other words, we just normalize the density according to the cumulative probability of the remaining distribution that we haven't cut.

In R this is trivial. Suppose we want the probability density of $y=1$ in a standard normal density that we have cut at 0. We simply call:

dnorm(1, 0, 1) / pnorm(0, 0, 1)

Which is exactly equal to dnorm(1,0,1)*2 which is what we expect: a doubling of the normal density since we have cut it in half.

$\endgroup$
2
  • $\begingroup$ Thank you so much for your help, but I'm not sure my task is to truncate the PDF. In my understanding, the PDF can not have negative values (this matches with the truncating so far), but the more negative values we cut off, the greater the probability of zero will be. The area under the PDF curve also must be one. $\endgroup$
    – bergallen
    Commented Feb 22, 2021 at 18:56
  • $\begingroup$ @bergallen Hm. Let me edit. We are actually conflating the idea of a truncated distribution - which does not heap probability at the truncation point - versus truncation of a sample which does heap probability at the truncation point. I encourage you to look at the density calculation and convince yourself it does sum to one. $\endgroup$
    – AdamO
    Commented Feb 22, 2021 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.