[R] Cramer von Mises test for a discrete distribution

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Feb 19 18:20:37 CET 2013

On Tue, Feb 19, 2013 at 2:49 PM, Santiago Guallar <sguallar at yahoo.com> wrote:
> Hi,
> I'm trying to carry out Cramer von Mises tests between pairs of vectors belonging to a discrete distribution (concretely frequencies from 0 to 200). However, the program crashes in the attempt. The problem seems to be that these vectors only have positive integer numbers (+ zero). When I add a random very small positive decimal to the non-decimal part everything works fine (files prm1 & prpmr1). I attach two of these vectors so you can run the following code. I've also thought to divide both vectors by a real constant such as pi. Do you think these two approaches are acceptable?
 > setwd("")
 > require(CvM2SL2Test)
 > prm = scan('prm.txt')
 > prpmr = scan('prpmr.txt')
 > ct1 = cvmts.test(prm, prpmr) # here R crashes

 For you maybe. For me, works fine, and:

 > ct1

[1] 30.20509

 > cvmts.pval( ct1, length(prm), length(prpmr) )

 - this is taking a bit longer. I gave up and killed it. Maybe it
would have eventually "crashed R", but you said the other function
call crashed R.

Your two mistakes are:

 1. Saying "R crashes" without showing us any kind of crash report or
error message.
 2. Not listing your system and package versions.

Ah, your three mistakes are...

 3. Not reading http://www.r-project.org/posting-guide.html


More information about the R-help mailing list