Random Number Per a Distn Generation in Stata or R Hi Tring
Random Number Per a Dist\'n Generation in Stata (or R)
Hi. Tring to generate the following, but I\'m not sure of the syntax in Stata or R.
Solution
N(0,2,3) is not a distribution, normal distribution has only 2 parameters - mean and standard deviation (or variance)
to create a vector of 10 normal random variables with mean = 4 (example), and standard deviaiton = 7 (example)
write following in R: x = rnorm(10, 4, 7)
So, for third part, we can write x2 = rnorm(1,3,3)
and for fourth part, we can write x1 = runif(1,3,7)
which creates 1 random number from uniform(3,7) distribution
