powered by
Generate random numbers from a t distribution, rescaled to have user-specified population mean and standard deviation.
rt_rs(n = 10, df = 5, pmean = 0, psd = 1)
A vector of the generated random numbers.
The number of random numbers to generate.
df for stats::rt().
df
stats::rt()
Population mean.
Population standard deviation.
First, specify the parameter df and the desired population mean and standard deviation. The random numbers, drawn from the generalized normal distribution by stats::rt(), will then be rescaled with the desired population mean and standard.
set.seed(90870962) x <- rt_rs(n = 5000, df = 5, pmean = 3, psd = 1) mean(x) sd(x) hist(x)
Run the code above in your browser using DataLab