R Under development (unstable) (2023-08-27 r85021 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > set.seed(290875) > > ret <- TRUE > > if (require("rms") && require("tram")) { + + x <- runif(2000) + y <- round(rnorm(length(x), mean = 2 * x, sd = .25), 1) + d <- data.frame(y = y, x = x) + d$Ry <- with(d, R(y, as.R.ordered = TRUE)) + + mP <- Polr(Ry ~ x, data = d) + mM <- Polr(Ry ~ x, data = d, sparse_nlevels = 2) + mO <- orm(y ~ x, data = d) + + tol <- 1e-4 + ret <- + isTRUE(all.equal(coef(mP), coef(mM), tol = tol)) && + isTRUE(all.equal(coef(mP), coef(mO)["x"], tol = tol)) && + isTRUE(all.equal(coef(as.mlt(mP)), coef(as.mlt(mM)), tol = tol)) && + isTRUE(all.equal(rev(coef(as.mlt(mP)))[-1L], + -rev(coef(mO))[-1L], tol = tol, + check.attributes = FALSE)) && + isTRUE(all.equal(logLik(mP), logLik(mM), tol = tol)) && + isTRUE(all.equal(c(logLik(mP)), c(logLik(mO)), tol = tol)) && + + isTRUE(all.equal(c(vcov(mP)), as.numeric(vcov(mM)), tol = tol)) && + isTRUE(all.equal(c(vcov(mP)), vcov(mO)["x", "x"], tol = tol)) + + } Loading required package: rms Loading required package: Hmisc Attaching package: 'Hmisc' The following objects are masked from 'package:base': format.pval, units Loading required package: tram Loading required package: mlt Loading required package: basefun Loading required package: variables Loading required package: mvtnorm > > ret [1] TRUE > > proc.time() user system elapsed 12.31 2.23 14.53