[R] Need some help
azza.khogaliali at utoronto.ca
Tue Oct 16 21:13:56 CEST 2007
Ok, so n= the toss number, and s(n) is the accumulated winnings after n
tosses. Now, each time we have a heads, we win a dollar, and each time we
have a tails, we lose a dollar. So, s(n) is th sign changes in 1000 tosses.
In the beginning, S(0) must be 0, and S(-1) must be zero too. ok, so if on
the first toss, the result is tails, s(1) =-1 (because we lose a dollar
for every tails). On the second toss, if we have heads , we gain a dollar,
so our accumulated winnings will be s(2)=0 if on the third toss we get
another head, we gain a dollar and our total winnings would be s(3)=1 and so
Now, you were asking what sign changes is. we will denote this by C. C will
be the numbe rof times S9n) changes signs (that is from negative to positive
or from positive to negative)
from positive to negative would be S(n-2)=1, S(n-1)=0 and, S(n)= -1 and
form negative to positive would be S(n-2) = -1, S(n-1)=0 and S(n)=1
So in the beginning, when n=0, and s(n)=0, c msu tbe zero.
Hope that clarifies things.
I guess I don't understand what you mean by "sign change". It seems to me
that on any given toss there either is or there isn't a change from heads to
tails (or tails to head). How then would it be possible to get a +3 sign
change on the first toss? Also, I might guess as to what you mean by a
negative sign change but my crystal ball is in the shop :-).
Again, I would recommend that you simulate 10 coin tosses, and then by hand
determine your negative and positive sign changes, and then show us the
tosses, the sign changes, and the y value that you want plotted for each
toss. That would at least clarify for me (if for no one else) what the
Sorry I don't have any better advice at the moment,
Daniel J. Nordlund
Research and Data Analysis
Washington State Department of Social and Health Services
Olympia, WA 98504-5204
R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
View this message in context: http://www.nabble.com/Need-some-help-tf4624513.html#a13240408
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help