Sampling from a truncated PDF I have a PDF $f$ that I know how to sample from, and I want to sample from the PDF
$$ g(x) = \frac{f(x)}{\bar{F}(s)} \mathbb{1}_{(x>s)}$$
where $s > 0$, $\bar{F}(s) = \mathbb{P}(X>s)$, and $\mathbb{1}_{(\cdot)}$ is the indicator function.
Can I sample from $f$ and accept only samples that are greater than $s$ to be samples form $g$?
 A: Continuing from @dhab's Comment.
Suppose the original distribution is $X \sim\mathsf{Norm}(\mu = 1.5, \sigma=1),$
and that you want to truncate it to just the positive values. 
Then write the PDF and CDF of $X$ as $\varphi(x, 1.5,1)$ and $\Phi(x, 1.5,1).$
In this notation the PDF of the truncated random variable $T = X^+$ is
$$g(t) = \frac{\varphi(t; 1.5, 1)}{1 - \Phi(0, 1.5, 1)} = 1.0716\varphi(t;1.5,1),$$
for $t > 0$ where the constant 1.0716 ensures that $g(t)$ integrates to 1 over $(0,\infty).$
k = 1/(1 - pnorm(0, 1.5, 1));  k  # in R, normal cdf is 'pnorm'
## 1.07159

Now if you want $P(T < 2) = 0.669,$ you can (a) use normal tables or software;
(b) sample values of $X,$ reject the negative values, and find the proportion
of those below 2; or (c) find a way (consistent with your course) to sample from $g(x)$ directly. Methods
(a) and (b) are illustrated below. For (b), $10^6$ values of $X$ yield enough
values of $T$ to get three-place accuracy.
k*diff(pnorm(c(0,2), 1.5, 1))   # (a) numerical integration 
## 0.6693743

x = rnorm(10^6, 1.5, 1)         # (b) in R, 'rnorm' generates normal obs 
y = x[x > 0]                    #     truncate
## mean(y < 2)                  #     find proportion < 2
## 0.6689555


