Description Usage Arguments Value Examples
a function to generate a random sample of size n from the Beta(a, b) distribution by the acceptance-rejection method
1 | beta_arm(n, a, b)
|
n |
the number of samples |
a |
the first parameter of function 'beta' |
b |
the second parameter of function 'beta' |
a random sample of size n
1 2 3 4 5 | sample_beta <- beta_arm(1000,3,2)
head(sample_beta,20)
sample_beta_theo <- rbeta(1000,3,2)
data_beta <- data.frame(sample = c(sample_beta,sample_beta_theo),class = rep(c('empirical','theoretical'),each = 1000))
ggplot(data_beta,aes(x = sample,fill = class))+geom_histogram(position="identity", alpha=0.5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.