Some standard methods for objects of class polycor, produced by polychor and polyserial, including print, summary, coef, and vcov. The summary method simply invokes the print method.
## S3 method for class 'polycor'print(x, digits = max(3, getOption("digits")-3),...)## S3 method for class 'polycor'summary(object,...)## S3 method for class 'polycor'coef(object, correlation=TRUE, thresholds=TRUE,...)## S3 method for class 'polycor'vcov(object, correlation=TRUE, thresholds=TRUE,...)
Arguments
x, object: an object of class polycor, as returned by polychor
or polyserial.
digits: number of significant digits to be printed.
correlation: return the estimated correlation or sampling variance of the correlation.
thresholds: return the estimated thresholds or sampling variances/covariances of the thresholds.
...: pass arguments from summary to print; otherwise not used.
if(require(mvtnorm)){ 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}if(require(mvtnorm)){ x <- cut(x, c(-Inf,.75,Inf)) y <- cut(y, c(-Inf,-1,.5,1.5,Inf)) print(polychor(x, y, ML=TRUE, std.err=TRUE), digits=3)# polychoric correlation, ML estimate}if(require(mvtnorm)){ coef(polychor(x, y, ML=TRUE, std.err=TRUE))}if(require(mvtnorm)){ vcov(polychor(x, y, ML=TRUE, std.err=TRUE))}