[R] Need some help
Hi! I'm taking a course that requires some programming background, but I'm a complete novice in the field. when asked to generate a list of 20 uniform random numbers, is it alright if I put in >randu, and just copy-paste the first 20 numbers?? Or is there, as I suspect, a better way of calling out exactly 20 uniform random numbers?? I'm also unable to solve the following problem: We know that on average 30% of the customers who enter a store make a purchase. Suppose 200 people enter the store today. Run a simulation to see how many purchases we will have today. Any help is greatly appreciated. i went through the Rmanual, but felt that it did not lend me the information i needed to solve the above queries. Thanks again -- View this message in context: http://www.nabble.com/Need-some-help-tf4624513.html#a13206879 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Need some help
Quite helpful indeed. Greatly appreciated. Another problem I had was trying to simulate an example from my book. Simulating 1000 coin tosses, and finding the frequency of sign changes. So how will we plot this using R? (frequency of sign changes in Y axis) Daniel Nordlund wrote: > >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >> On Behalf >> Of azzza >> Sent: Sunday, October 14, 2007 10:21 PM >> To: r-help@r-project.org >> Subject: [R] Need some help >> >> >> Hi! >> I'm taking a course that requires some programming background, but I'm a >> complete novice in the field. >> >> when asked to generate a list of 20 uniform random numbers, is it alright >> if >> I put in >randu, and just copy-paste the first 20 numbers?? Or is there, >> as >> I suspect, a better way of calling out exactly 20 uniform random >> numbers?? >> > See ?runif > > rand_nums <- runif(20) > >> I'm also unable to solve the following problem: >> We know that on average 30% of the customers who enter a store make a >> purchase. Suppose 200 >> people enter the store today. Run a simulation to see how many purchases >> we >> will have today. >> > see ?sample >> number_of_purchases <- sum(sample(c(0,1), 200, prob=c(.70, .30), >> replace=TRUE)) > > Hope this is helpful, > > Dan > > Daniel Nordlund > Bothell, WA USA > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > 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#a13214128 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Need some help
Umm, yes, what you had makes a lot of sense. How would I represent that in a plot of the number of sign changes in the to Y axis, and the toss number (from 0 to 1000) in the x-axis? jholtman wrote: > > You might want to check out 'rle'. This will give you the 'lengths' > of runs of the same value and therefore when the value changes (sign > change?) you can see how often: > >> x <- sample(c(-1,1), 1000, TRUE) >> rle(x) > Run Length Encoding > lengths: int [1:483] 2 2 1 4 3 1 1 1 1 2 ... > values : num [1:483] -1 1 -1 1 -1 1 -1 1 -1 1 ... > > Here was a sample of 1000, and there were 483 changes between the > samples. Is this what you are looking for? > > On 10/15/07, azzza <[EMAIL PROTECTED]> wrote: >> >> >> Quite helpful indeed. Greatly appreciated. >> Another problem I had was trying to simulate an example from my book. >> Simulating 1000 coin tosses, and finding the frequency of sign changes. >> So >> how will we plot this using R? (frequency of sign changes in Y axis) >> >> >> >> >> Daniel Nordlund wrote: >> > >> >> -Original Message- >> >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] >> >> On Behalf >> >> Of azzza >> >> Sent: Sunday, October 14, 2007 10:21 PM >> >> To: r-help@r-project.org >> >> Subject: [R] Need some help >> >> >> >> >> >> Hi! >> >> I'm taking a course that requires some programming background, but I'm >> a >> >> complete novice in the field. >> >> >> >> when asked to generate a list of 20 uniform random numbers, is it >> alright >> >> if >> >> I put in >randu, and just copy-paste the first 20 numbers?? Or is >> there, >> >> as >> >> I suspect, a better way of calling out exactly 20 uniform random >> >> numbers?? >> >> >> > See ?runif >> > >> > rand_nums <- runif(20) >> > >> >> I'm also unable to solve the following problem: >> >> We know that on average 30% of the customers who enter a store make a >> >> purchase. Suppose 200 >> >> people enter the store today. Run a simulation to see how many >> purchases >> >> we >> >> will have today. >> >> >> > see ?sample >> >> number_of_purchases <- sum(sample(c(0,1), 200, prob=c(.70, .30), >> >> replace=TRUE)) >> > >> > Hope this is helpful, >> > >> > Dan >> > >> > Daniel Nordlund >> > Bothell, WA USA >> > >> > __ >> > R-help@r-project.org mailing list >> > https://stat.ethz.ch/mailman/listinfo/r-help >> > 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#a13214128 >> Sent from the R help mailing list archive at Nabble.com. >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > > -- > Jim Holtman > Cincinnati, OH > +1 513 646 9390 > > What is the problem you are trying to solve? > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > 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#a13216156 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Need some help
Thanks Jholtman. However, the plot didnt come out the way I envisone dit to be. On the Y axis, i should have sign changes in 1000 tosses, the range being from negative to postitive, and a straight horizontal line across y=0. The X-axis should have the toss number, range 0-1000 I'm glad u mentioned rle(x)works perfect! jholtman wrote: > > I really depends on what you want to plot. You can plot the > cumulative count of the sign changes with: > > x <- sample(c(0,1), 1000, TRUE) > plot(cumsum(x), type='l') > > There are other things you can do. You can get a rough histogram of > the length of the run by: > >> stem(rle(x)$length) > > The decimal point is at the | > > 1 | > +201 > 1 | > 2 | > +60 > 2 | > 3 | 0 > 3 | > 4 | 00 > 4 | > 5 | 0 > 5 | > 6 | > 6 | > 7 | 0 > > With R, almost anything is possible. > > On 10/15/07, azzza <[EMAIL PROTECTED]> wrote: >> >> Umm, yes, what you had makes a lot of sense. How would I represent that >> in a >> plot of the number of sign changes in the to Y axis, and the toss number >> (from 0 to 1000) in the x-axis? >> >> >> >> >> jholtman wrote: >> > >> > You might want to check out 'rle'. This will give you the 'lengths' >> > of runs of the same value and therefore when the value changes (sign >> > change?) you can see how often: >> > >> >> x <- sample(c(-1,1), 1000, TRUE) >> >> rle(x) >> > Run Length Encoding >> > lengths: int [1:483] 2 2 1 4 3 1 1 1 1 2 ... >> > values : num [1:483] -1 1 -1 1 -1 1 -1 1 -1 1 ... >> > >> > Here was a sample of 1000, and there were 483 changes between the >> > samples. Is this what you are looking for? >> > >> > On 10/15/07, azzza <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> Quite helpful indeed. Greatly appreciated. >> >> Another problem I had was trying to simulate an example from my book. >> >> Simulating 1000 coin tosses, and finding the frequency of sign >> changes. >> >> So >> >> how will we plot this using R? (frequency of sign changes in Y axis) >> >> >> >> >> >> >> >> >> >> Daniel Nordlund wrote: >> >> > >> >> >> -Original Message- >> >> >> From: [EMAIL PROTECTED] >> >> [mailto:[EMAIL PROTECTED] >> >> >> On Behalf >> >> >> Of azzza >> >> >> Sent: Sunday, October 14, 2007 10:21 PM >> >> >> To: r-help@r-project.org >> >> >> Subject: [R] Need some help >> >> >> >> >> >> >> >> >> Hi! >> >> >> I'm taking a course that requires some programming background, but >> I'm >> >> a >> >> >> complete novice in the field. >> >> >> >> >> >> when asked to generate a list of 20 uniform random numbers, is it >> >> alright >> >> >> if >> >> >> I put in >randu, and just copy-paste the first 20 numbers?? Or is >> >> there, >> >> >> as >> >> >> I suspect, a better way of calling out exactly 20 uniform random >> >> >> numbers?? >> >> >> >> >> > See ?runif >> >> > >> >> > rand_nums <- runif(20) >> >> > >> >> >> I'm also unable to solve the following problem: >> >> >> We know that on average 30% of the customers who enter a store make >> a >> >> >> purchase. Suppose 200 >> >> >> people enter the store today. Run a simulation to see how many >> >> purchases >> >> >> we >> >> >> will have today. >> >> >> >> >> > see ?sample >> >> >> number_of_purchases <- sum(sample(c(0,1), 200, prob=c(.70, .30), >> >> >> replace=TRUE)) >> >> > >> >> > Hope this is helpful, >> >> > >> >> > Dan >> >> > >> >> > Daniel Nordlund >> >> > Bothell, WA USA >> >> > >> >
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, for the 50th toss, the sign change may be -5 for instance. The plot shown in the book shows that for most of the tosses, the sign changes were negative, and this would explain how the overall number of sign changes is very low. so basically, i was looking for a code to show the number of sign changes, and a plot of sign changes versus toss number (from toss #0 to toss number 1000). The Y axis (number of sign changes, should include negative values of Y) thanks Daniel Nordlund wrote: > >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >> On Behalf >> Of azzza >> Sent: Monday, October 15, 2007 6:06 PM >> To: r-help@r-project.org >> Subject: Re: [R] Need some help >> >> >> >> Thanks Jholtman. >> However, the plot didnt come out the way I envisone dit to be. On the Y >> axis, i should have sign changes in 1000 tosses, the range being from >> negative to postitive, and a straight horizontal line across y=0. The >> X-axis should have the toss number, range 0-1000 >> > > You would probably get more prompt and useful help if you would provide a > small, self- contained example of what you wanted (maybe small enough that > you could work it by hand). Also, if you provided some code using the > help that you have already received, that would show that you are trying > to solve the problem yourself and others could help with the specific R > program issues that you are having. For example, it is not clear to me if > you want to count the first run of tosses as 0 or 1 sign change. I will > assume it is zero. So with that assumption, does this get you what you > want? > > n <- 1000 > x <- sample(c(0,1), n, TRUE) > y <- rle(x) > > z <- rep(1:length(y$lengths),y$lengths) > plot(1:n,z-1) > > Hope this is helpful, > > Dan > > Daniel Nordlund > Bothell, WA USA > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > 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#a13236681 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Need some help
Thats what is frustrating meI've done a lot of reading, but there doesnt seem to be much info on sign changes..I dont udnerstand why the poportion of sign changes is much less than 50%, despite the proportion of heads being equal to that of tails. Marc Schwartz wrote: > > You might want to do some more research on "Bernoulli Trials" and "Fair > Coins", which would provide some enlightenment on why you would not > "expect" 500 sign changes in 1,000 tosses and why you should, if the > coin is "fair", expect to *approach* a 50/50 distribution of heads and > tails in a large number of tosses, but not actually observe it. > > HTH, > > Marc Schwartz > > > On Tue, 2007-10-16 at 09:05 -0700, azzza wrote: >> >> 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, for the 50th toss, the sign change may be -5 for instance. The >> plot shown in the book shows that for most of the tosses, the sign >> changes >> were negative, and this would explain how the overall number of sign >> changes >> is very low. >> >> so basically, i was looking for a code to show the number of sign >> changes, >> and a plot of sign changes versus toss number (from toss #0 to toss >> number >> 1000). The Y axis (number of sign changes, should include negative values >> of >> Y) >> >> thanks >> >> >> >> Daniel Nordlund wrote: >> > >> >> -Original Message- >> >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] >> >> On Behalf >> >> Of azzza >> >> Sent: Monday, October 15, 2007 6:06 PM >> >> To: r-help@r-project.org >> >> Subject: Re: [R] Need some help >> >> >> >> >> >> >> >> Thanks Jholtman. >> >> However, the plot didnt come out the way I envisone dit to be. On the >> Y >> >> axis, i should have sign changes in 1000 tosses, the range being from >> >> negative to postitive, and a straight horizontal line across y=0. The >> >> X-axis should have the toss number, range 0-1000 >> >> >> > >> > You would probably get more prompt and useful help if you would provide >> a >> > small, self- contained example of what you wanted (maybe small enough >> that >> > you could work it by hand). Also, if you provided some code using the >> > help that you have already received, that would show that you are >> trying >> > to solve the problem yourself and others could help with the specific R >> > program issues that you are having. For example, it is not clear to me >> if >> > you want to count the first run of tosses as 0 or 1 sign change. I >> will >> > assume it is zero. So with that assumption, does this get you what you >> > want? >> > >> > n <- 1000 >> > x <- sample(c(0,1), n, TRUE) >> > y <- rle(x) >> > >> > z <- rep(1:length(y$lengths),y$lengths) >> > plot(1:n,z-1) >> > >> > Hope this is helpful, >> > >> > Dan >> > >> > Daniel Nordlund >> > Bothell, WA USA >> > >> > __ >> > R-help@r-project.org mailing list >> > https://stat
Re: [R] Need some help
ok, so suppose a coin is tossed 1000 times. Each time head occurs, we win a dollar, otherwise we lose a dollar. Let S(n) be our accumulated winnings after n tosses. For instance, if the sequence HHHTT occurs in the first five tosses, then S(5) = $1.00 wheras if the sequence H occurs, S(5) =-$3. So now, we want to see how many times during the 1000tosses S9n) will go from a positive balance to a negative balanc eor the other way around. So for our simulation, S(n) is computed by adding one to S(n-1) if a head occurs, and subtracting one form S(n-1) if a tail occurs. A change in sign will occur on the nth toss in one of two ways: S(n-2)=1, S(n-1)=0 and, S(n)= -1 OR S(n-2) = -1, S(n-1)=0 and S(n)=1. This is equivalent to S(n-2)+ S(n-1)+ S(n)=0. so now, n is the numbe rof tosses, S(n) is the number of heads minus the number of tails in n tosses and C is the number of times S(n) changes sign. so we initialize n=0, S(-1)=0, S(0)=0, and C(0)=0 now we should, -generate u, a uniform number, with the increment, n=n+1 (our n=1000) -if u<1/2, that is tails occur, set S(n)=S(n-1)-1, and also set S(n)=S(n-1)+1 - If S(n) +S(n-1)+S(n-2)=0, then increment C=C+1. My issue is simulating this in R, where I need to code the number of sign changes, the frequency of heads, and to plot S(n) versus n in a line graph. for each coin toss, the number of sign changes could either be a positive number, zero, or a negative number. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help 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#a13240042 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Need some help
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 on. 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 issues are. Sorry I don't have any better advice at the moment, Dan Daniel J. Nordlund Research and Data Analysis Washington State Department of Social and Health Services Olympia, WA 98504-5204 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help 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. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Need some help
Thank you guyz. your codes gave me the results I was looking for. And thanks for the reference suggestion. Lastly, how do I code the frequency of heads? Daniel Lakeland wrote: > > On Tue, Oct 16, 2007 at 02:06:47PM -0400, jim holtman wrote: >> If what you are asking for is to see how many times it crosses the >> axis when 'accumulating' the values of the top (+1, -1), then the >> following will do it - this is for 1000 and shows there are 32 >> crossings of the axis. > > I think what he wants is the number of times that the current sample > is different from the previous sample. (ie. imagine heads = 1 and > tails = -1 how many times does the sequence change sign?) > > -- > Daniel Lakeland > [EMAIL PROTECTED] > http://www.street-artists.org/~dlakelan > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > 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#a13241095 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Need some help
THANKYOU guyz! yes, Jim's code was right (it was similar to someone elses)I somehow missed his reply! Yes, that was exactly what i was looking for. lastly, how do i find the frequency of heads perhaps? Marc Schwartz wrote: > > On Tue, 2007-10-16 at 11:53 -0700, azzza wrote: >> >> >> ok, so suppose a coin is tossed 1000 times. Each time head occurs, we win >> a >> dollar, otherwise we lose a dollar. Let S(n) be our accumulated winnings >> after n tosses. For instance, if the sequence HHHTT occurs in the first >> five >> tosses, then S(5) = $1.00 wheras if the sequence H occurs, S(5) =-$3. >> So >> now, we want to see how many times during the 1000tosses S9n) will go >> from a >> positive balance to a negative balanc eor the other way around. So for >> our >> simulation, S(n) is computed by adding one to S(n-1) if a head occurs, >> and >> subtracting one form S(n-1) if a tail occurs. A change in sign will occur >> on >> the nth toss in one of two ways: S(n-2)=1, S(n-1)=0 and, S(n)= -1 OR >> S(n-2) >> = -1, S(n-1)=0 and S(n)=1. This is equivalent to S(n-2)+ S(n-1)+ S(n)=0. >> so now, n is the numbe rof tosses, S(n) is the number of heads minus the >> number of tails in n tosses and C is the number of times S(n) changes >> sign. >> so we initialize n=0, S(-1)=0, S(0)=0, and C(0)=0 >> >> now we should, >> -generate u, a uniform number, with the increment, n=n+1 (our n=1000) >> -if u<1/2, that is tails occur, set S(n)=S(n-1)-1, and also set >> S(n)=S(n-1)+1 >> - If S(n) +S(n-1)+S(n-2)=0, then increment C=C+1. >> >> My issue is simulating this in R, where I need to code the number of sign >> changes, the frequency of heads, and to plot S(n) versus n in a line >> graph. >> >> >> for each coin toss, the number of sign changes could either be a positive >> number, zero, or a negative number. > > I believe that Jim had the right approach in his reply here: > > https://stat.ethz.ch/pipermail/r-help/2007-October/143383.html > > and Prof. Koenker has given you a reference on the theory: > > https://stat.ethz.ch/pipermail/r-help/2007-October/143385.html > > HTH, > > Marc > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > 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#a13241118 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.