-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of azzza
Sent: Tuesday, October 16, 2007 9:06 AM
To: r-help at r-project.org
Subject: Re: [R] Need some help
You are right, I was a bit too vague. I am trying to simulate
1000 coin
Tosses. Then to write a code for the number of
heads/Tails.....naturally, we
would expect the proportion of heads to be 50% so the number
of heads would
be around 500. Secondly, I'm trying to look at the number of
sign changes in
1000 tosses. The example in the book shows that the number of
sign changes
is WAY less than 50%. so I was trying to look for a code
that shows the
number of sign changes, which someone pointed out would be to use
rle(x).....my concern however is that when the rle(x) is used, the
proportion of sign changes is about 50% (around 500), which
would be logical
to expect, however, real life experiments have shown that the
number of sign
changes is actually much less than 50%. The other thing I was
trying to do
is to plot a line graph of number of sign changes versus the number of
tosses. Yes, the number of tosses should begin at zero, and
at zero coin
toss, the sign change is zero. The range of the number of
sign changes in
the Y-axis should include negative values of Y. So, for toss
number zero,
the sign change is 0, for the first toss, the sign change may
be +3 for
instance,