| Start |
|---|
| Random permutations To generate random permutation of 5 numbers: To generate random permutation of any vector: One could also use the package |
| Random number generator's reproducibility When expecting someone to reproduce an R code that has random elements in it, the These two will also produce different outputs: However, if we set the seed to something identical in both cases (most people use 1 for simplicity), we get two identical samples: and same with, say, |
| Generating random numbers using various density functions Below are examples of generating 5 random numbers using various probability distributions. Uniform distribution between 0 and 10Normal distribution with 0 mean and standard deviation of 1Binomial distribution with 10 trials and success probability of 0.5Geometric distribution with 0.2 success probabilityHypergeometric distribution with 3 white balls, 10 black balls and 5 drawsNegative Binomial distribution with 10 trials and success probability of 0.8Poisson distribution with mean and variance (lambda) of 2Exponential distribution with the rate of 1.5Logistic distribution with 0 location and scale of 1Chi-squared distribution with 15 degrees of freedomBeta distribution with shape parameters a=1 and b=0.5Gamma distribution with shape parameter of 3 and scale=0.5Cauchy distribution with 0 location and scale of 1Log-normal distribution with 0 mean and standard deviation of 1 (on log scale)Weibull distribution with shape parameter of 0.5 and scale of 1Wilcoxon distribution with 10 observations in the first sample and 20 in second.Multinomial distribution with 5 object and 3 boxes using the specified probabilities |
Read Article
https://develop.horje.com/learn/1434/reference