Description Usage Arguments Value Examples
question3.7(Statistical Computing with R):Write a function to generate a random sample of size n from the Beta(a, b) distribution by the acceptance-rejection method. Generate a random sample of size 1000 from the Beta(3,2) distribution. Graph the histogram of the sample with the theoretical Beta(3,2) density superimposed
Here we use Acceptance-Rejection Method to generate a random sample, and And draw the density function of beta distribution and compare them.
1 | GenerateBeta(n, a, b)
|
n |
The sise of random sample we want to generateBeta |
a |
The first parameter of Beta distribution function |
b |
The second parameter of Beta distribution function |
y The random sample has been Generated, which is a vector
1 2 3 4 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.