MCbeta: use the Monte Carlo to estimate of the Beta(3, 3)cdf

Description Usage Arguments Value Examples

Description

Write a function to compute a Monte Carlo estimate of the Beta(3, 3) cdf

Compare the estimates with the values returned by the pbeta function in R

Usage

1
MCbeta(x)

Arguments

x

the number of points between 0 and 1

Value

the first value is Monte Carlo estimate;the second value is the pbeta estimate;the third value is the error of

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
x_seq <- seq(.1,.9,by=.1)
F_seq <- numeric(length(x_seq))
P_seq <- numeric(length(x_seq))
for (i in 1:length(x_seq)) {
  F_seq[i] <- F(x_seq[i])  # using the F function to estimate the probability
  P_seq[i] <- pbeta(x_seq[i],3,3) # using the pbeta function in R to estimate the probability
}
print(round(rbind(x_seq, F_seq, P_seq), 3))

## End(Not run)

woshiershixiong/StatComp18081 documentation built on May 12, 2019, 5:19 p.m.