[R] Monty Hall simulation

Johannes Huesing johannes at huesing.name
Sun May 11 10:26:19 CEST 2008


cirrus74 <cirrus74 at hotmail.com> [Sun, May 11, 2008 at 03:44:46AM CEST]:
> 
> Is it possible to simulate the Monty Hall problem using R? If so, could
> someone please show me how? Thanks for any help rendered.

The kind of simulation, as any thinking about this seeingly paradoxical
situation, depends on your mindset.

To my mind, 

niter <- 999
prize <- sample(c("car", "car", "goat"), niter, replace=TRUE)

would be a perfect simulation.

-- 
Johannes Hüsing               There is something fascinating about science. 
                              One gets such wholesale returns of conjecture 
mailto:johannes at huesing.name  from such a trifling investment of fact.                
http://derwisch.wikidot.com         (Mark Twain, "Life on the Mississippi")



More information about the R-help mailing list