[R] Monte Carlo simulation in R
dwinsemius at comcast.net
Wed Mar 24 02:59:42 CET 2010
On Mar 23, 2010, at 9:05 PM, Hongwei Dong wrote:
> Hi, R-helpers,
> I'm trying to use R to do a Monte Carlo simulation and need the
> help. What I
> have is a matrix that consists of the probabilities for the persons to
> choose zones. For example, in the matrix shown below, each column
> a person, and each row represents a zone. So, the probability that
> the first
> person will choose the 2nd zone is 30%.
> 25% 30% 10% 30% 20% 0% 20% 50% 60% 50% 0% 10% 20% 0% 20%
As Alex Trebeck would say: Can you put that in the form of an R data
> Based on this matrix, I want to locate the persons to zones based on
> probability using a Monte Carlo method. The result I want to see is
> 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0
> Could anyone please give some help? Thanks.
You cannot specify what the result _will_ be and call the process
simulation of results at the same time. The sample function should
work for a vector. Why not use it?
David Winsemius, MD
West Hartford, CT
More information about the R-help