0

Any idea how can I plot this truncated normal PDF in R. The mean is 0 with variance 1 so the PDF is: exp((-x^2)/2)) * I{x>=2} where I is an indicator function. Any help will be appreciated. Thanks.

mmvsbg
  • 3,570
  • 17
  • 52
  • 73
  • Welcome to Stack Overflow! Please read the info about [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – Paul Sep 18 '18 at 10:07

1 Answers1

0

Nothing simpler. Try:

x <- seq(-5, 5, by=0.01)
plot(x[x >= 2], exp((-x^2)/2)[x >= 2])
liori
  • 40,917
  • 13
  • 78
  • 105