Re: [R] A function for random test based on longest run(UNCLASSI FIED)

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Thu, 27 Dec 2007 12:20:47 -0700

You could do this as a permutation test:  

tmp <- unlist(strsplit('HHTHTTTTHHH', '')) out1 <- c( max(rle(tmp)$lengths),
 replicate( 999, {tmp2 <- sample(tmp); max(rle(tmp2)$lengths)} ) ) hist(out1)
abline(v=out1[1], col='red')
mean(out1 <= out1[1])
mean(out1 >= out1[1])  

There may be a better option, but this works and is fairly straight forward.  

Hope it helps,


From: r-help-bounces_at_r-project.org on behalf of Park, Kyong H Mr ECBC Sent: Thu 12/27/2007 11:47 AM
To: 'bogdan romocea'
Cc: R-help_at_stat.math.ethz.ch
Subject: Re: [R] A function for random test based on longest run(UNCLASSI FIED)

Classification: UNCLASSIFIED
Caveats: NONE

 Thanks for your quick response. The program you mentioned below available from R is based on number of runs (up or down) not based on a longest length of runs of same events. To be more specific, for example, from a series, HHTHTTTTHHH, the number of runs are 5, and the longest length of runs of the same events is 4. I'll check for the website you mentioned below.

Kyong

-----Original Message-----
From: bogdan romocea [mailto:br44114_at_gmail.com] Sent: Thursday, December 27, 2007 12:08 PM To: kyong.ho.park_at_us.army.mil
Cc: r-help
Subject: RE: [R] A function for random test based on longest run (UNCLASSIFIED)   > require(tseries)
  > ?runs.test
Also, take a look at dieharder, it implements a large number of randomness tests:
http://www.phy.duke.edu/~rgb/General/dieharder.php

> -----Original Message-----
> From: r-help-bounces@r-project.org
> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Park, Kyong H Mr
> ECBC
> Sent: Thursday, December 27, 2007 11:05 AM
> To: 'r-help_at_r-project.org'
> Subject: [R] A function for random test based on longest run
> (UNCLASSIFIED)

>

> Classification: UNCLASSIFIED
> Caveats: NONE
>

> Hello, R users,
>

> Has anybody written a function for random test based on the length of
> longest run of same events. I really appreciate your help.
>

> Kyong Park
> Classification: UNCLASSIFIED
> Caveats: NONE
>
>

> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_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.
>
Classification: UNCLASSIFIED
Caveats: NONE

        [[alternative HTML version deleted]]



R-help_at_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.

        [[alternative HTML version deleted]]



R-help_at_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. Received on Thu 27 Dec 2007 - 19:24:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 27 Dec 2007 - 19:31:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.