[R] multinormial runs tests?

2009-09-24 Thread liujb

Dear R users,

I would like to test the randomness in a series of N values (N=2). I know
that runs.test works for dichotomous factor only:
x - rep(c(1,2), 50)
runs.test(factor(x))


However it doesn't work for series that can take any N values (N2):
x - rep(c(1,2,5,4),50)
runs.test(factor(x))

Error in runs.test(factor(x)) : x does not contain dichotomous data

Are there any R function that does multinormial runs test?

Thank you very much,
sincerely,
Julia


-- 
View this message in context: 
http://www.nabble.com/multinormial-runs-tests--tp25574075p25574075.html
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] multinormial runs tests?

2009-09-24 Thread Greg Snow
You can do this by simulation:

Generate data from a multinomial of the same length as your data (the sample 
function can help) using either theoretical or observed probabilities.

Measure the length of the longest run, or the number of runs (the rle function 
can help).

Repeat this a bunch of times (the replicate function can help)

See how your observed data compares to the simulations.


Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of liujb
 Sent: Thursday, September 24, 2009 8:52 AM
 To: r-help@r-project.org
 Subject: [R] multinormial runs tests?
 
 
 Dear R users,
 
 I would like to test the randomness in a series of N values (N=2). I
 know
 that runs.test works for dichotomous factor only:
 x - rep(c(1,2), 50)
 runs.test(factor(x))
 
 
 However it doesn't work for series that can take any N values (N2):
 x - rep(c(1,2,5,4),50)
 runs.test(factor(x))
 
 Error in runs.test(factor(x)) : x does not contain dichotomous data
 
 Are there any R function that does multinormial runs test?
 
 Thank you very much,
 sincerely,
 Julia
 
 
 --
 View this message in context: http://www.nabble.com/multinormial-runs-
 tests--tp25574075p25574075.html
 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.

__
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.