rtnorm | R Documentation |

Draws from truncated univariate normal distribution within an interval.

rtnorm(mean, sd = 1, lower, upper, n = NULL)

`mean` |
vector of means. The length is the number of observations. |

`sd` |
standard deviation. Defaults to 1. |

`lower` |
a scalar of lower bound for truncation, or a vector of
lower bounds with the same length as |

`upper` |
a scalar of upper bound for truncation, or a vector of
upper bounds with the same length as |

`n` |
number of random samples when |

Returns a vector of random numbers following the specified truncated univariate normal distribution.

set.seed(1203) x = rtnorm(mean=rep(1,1000), sd=2, lower=-2, upper=3) summary(x) # use the alternative form of input set.seed(1203) x = rtnorm(mean=1, sd=2, lower=-2, upper=3, n=1000) summary(x)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.