Learn R Programming

polycor (version 0.8-1)

print.polycor: Standard Methods for polycor Objects

Description

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.

Usage

# S3 method for polycor
print(x, digits = max(3, getOption("digits") - 3), ...)
# S3 method for polycor
summary(object, ...)
# S3 method for polycor
coef(object, correlation=TRUE, thresholds=TRUE, ...)
# S3 method for 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.

See Also

polychor, polyserial

Examples

Run this code
# NOT RUN {
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))
    }
# }

Run the code above in your browser using DataLab