Re: response to Simulation
- To: mathgroup at smc.vnet.net
- Subject: [mg19409] Re: response to Simulation
- From: rfinley at netdoor.com (Richard Finley)
- Date: Mon, 23 Aug 1999 13:57:19 -0400
- Organization: Internet Doorway, Inc. -- http://www.netdoor.com/
- References: <7pl679$cdc@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Roberto,
Last night I responded to your message with the answer
data = Table[NestList[#+0.01*Sign[Random[Integer,{-1,4}]]&,5,1000]];
but I noticed a couple of things this morning. The answer I gave will give
{-1,0,1} respectively with probabilities {1/6,1/6,4/6} rather than
{1/6,4/6,1/6} as you requested. This is easy to fix and you can simply use:
data = NestList[#+0.01*(RotateLeft[{-1,0,1},Sign[Random[Integer,{-1,4}]]]
[[1]] )&,5,1000];
which will then give {-1,0,1} with the correct probabilities. Note that I
also dropped the Table function as it is not contributing anything.
regards, RF
Roberto Diego wrote in message <7pl679$cdc at smc.vnet.net>...
>Hi there,
>
>I need help on how the expression:
>
>data=Table[NestList[#+0.01*Random[Integer,{-1,1}]&,5,1000]];
>
>could be modified in order to get -1 with probability 1/6, 0 with p 4/6 and
>1 with p 1/6 instead of 1/3,1/3,1/3
>
>Thanks a lot
>
>Roberto Diego
>Sociedad de Bolsas
>
>
>