beta_cdf: A function that generates random Numbers using the monte...

Description Usage Arguments Value Examples

Description

a function to compute a Monte Carlo estimate of the Beta(3, 3) cdf. and use the function to estimate F(x) for x = 0.1,0.2,…,0.9. Compare the estimates with the values returned by the pbeta function in R.

Usage

1
beta_cdf(n, a, b)

Arguments

n

The number of random Numbers generated

a

The lower bound of the interval

b

The upper bound of the interval

Value

a random sample of size n

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
a <- data.frame(x=seq(0.1,0.9,0.1),Montacarlo=numeric(9),pbeta=numeric(9))#construct a dataframe to show the value of cdf
i <- 1
while (i<=9) {
  a[i,2] <- beta_cdf(10000,0,i*0.1)
  a[i,3] <- pbeta(i*0.1,3,3)
  i=i+1
}
print(a)

## End(Not run)

liujin07/StartComp18065 documentation built on May 5, 2019, 11:07 p.m.