search for: rintexp

Displaying 1 result from an estimated 1 matches for "rintexp".

Did you mean: rinterp
2008 Aug 25
8
Two envelopes problem
...ction: rposnorm <- function (n, ...) { return(abs(rnorm(n, ...))) } env <- generateenv(r=2, rposnorm, n=1e6, mean=20, sd=10) mean(env[,1]) # you keep the randomly assigned first envelope mean(env[,2]) # you always switch and keep the second # example, exponential approximated as an integer rintexp <- function(n, ...) return (ceiling(rexp(n, ...))) # we use ceiling as we don't want zeroes env <- generateenv(r=2, rintexp, n=1e6, rate=1/10) mean(env[,1]) # you keep the randomly assigned first envelope mean(env[,2]) # you always switch and keep the second i10 <- which(env[,1]==10)...