[R-SIG-Mac] bug in polychor with R 2.6.0
John Fox
jfox at mcmaster.ca
Sat Sep 15 22:19:01 CEST 2007
Dear Bill,
This works fine for me under Windows XP with R 2.6.0 alpha, so I suspect a
problem with the Mac build:
> example(polychor)
plychr> set.seed(12345)
plychr> data <- rmvnorm(1000, c(0, 0), matrix(c(1, .5, .5, 1), 2, 2))
plychr> x <- data[,1]
plychr> y <- data[,2]
plychr> cor(x, y) # sample correlation
[1] 0.5285446
plychr> x <- cut(x, c(-Inf, .75, Inf))
plychr> y <- cut(y, c(-Inf, -1, .5, 1.5, Inf))
plychr> polychor(x, y) # 2-step estimate
[1] 0.5365251
plychr> polychor(x, y, ML=TRUE, std.err=TRUE) # ML estimate
Polychoric Correlation, ML est. = 0.5364 (0.03775)
Test of bivariate normality: Chisquare = 0.545, df = 2, p = 0.7615
Row Threshold
Threshold Std.Err.
0.7292 0.04368
Column Thresholds
Threshold Std.Err.
1 -0.9947 0.04767
2 0.5100 0.04145
3 1.5450 0.06265
Regards,
John
--------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox
--------------------------------
> -----Original Message-----
> From: William Revelle [mailto:revelle at northwestern.edu]
> Sent: Saturday, September 15, 2007 1:50 PM
> To: John Fox
> Cc: R-Sig-Mac
> Subject: bug in polychor with R 2.6.0
>
> John,
> I have been testing out R2.6.0 alpha to see if my psych package
> works. I am running the R Gui for the Mac.
>
> There seems to be a problem with the polychor function in
> your polycor package. I think this might be a general
> problem with R 2.6.0 alpha but I am not sure. I am copying
> the R mac list to see if this is a general problem with the alpha gui.
>
> Bill
>
>
> From a clean start
>
> [Workspace restored from /Volumes/WR/bill/.RData]
>
> > version
> _
> platform i386-apple-darwin8.10.1
> arch i386
> os darwin8.10.1
> system i386, darwin8.10.1
> status alpha
> major 2
> minor 6.0
> year 2007
> month 09
> day 14
> svn rev 42851
> language R
> version.string R version 2.6.0 alpha (2007-09-14 r42851)
>
>
> > library(polycor)
> Loading required package: mvtnorm
> > ?polychor #to get the help file with the following demo
> > set.seed(12345)
> > data <- rmvnorm(1000, c(0, 0), matrix(c(1, .5, .5, 1), 2,
> 2)) x <-
> > data[,1] y <- data[,2] cor(x, y) # sample correlation
> [1] 0.5285446
> > x <- cut(x, c(-Inf, .75, Inf))
> > y <- cut(y, c(-Inf, -1, .5, 1.5, Inf)) polychor(x, y) # 2-step
> > estimate
>
> *** caught bus error ***
> address 0x0, cause 'non-existent physical address'
>
> Traceback:
> 1: .Fortran("mvtdst", N = as.integer(n), NU = as.integer(df), LOWER
> = as.double(lower), UPPER = as.double(upper), INFIN =
> as.integer(infin), CORREL = as.double(corrF), DELTA =
> as.double(delta), MAXPTS = as.integer(maxpts), ABSEPS =
> as.double(abseps), RELEPS = as.double(releps), error =
> as.double(error), value = as.double(value), inform =
> as.integer(inform), PACKAGE = "mvtnorm")
> 2: mvt(lower = lower, upper = upper, df = 0, corr = corr, delta =
> mean, maxpts = maxpts, abseps = abseps, releps = releps)
> 3: pmvnorm(lower = c(row.cuts[i], col.cuts[j]), upper =
> c(row.cuts[i
> + 1], col.cuts[j + 1]), corr = R)
> 4: binBvn(rho, row.cuts, col.cuts)
> 5: f(arg, ...)
> 6: function (arg) f(arg, ...)(-0.23606797749979)
> 7: optimise(f, interval = c(-1, 1))
> 8: polychor(x, y)
>
>
>
> Bill
>
> --
> William Revelle
> http://personality-project.org/revelle.html
> Professor
> http://personality-project.org/personality.html
> Department of Psychology
> http://www.wcas.northwestern.edu/psych/
> Northwestern University http://www.northwestern.edu/
> Use R for statistics:
> http://personality-project.org/r
>
More information about the R-SIG-Mac
mailing list