R Under development (unstable) (2024-09-17 r87161 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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. > > library("MASS") > library("tram") Loading required package: mlt Loading required package: basefun Loading required package: variables Loading required package: mvtnorm > > ### Windows diffs... > options(digits = 3) > > tol <- .Machine$double.eps^(1/4) > > cmp <- function(x, y) + stopifnot(isTRUE(all.equal(x, y, tolerance = tol))) > > (house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)) Call: polr(formula = Sat ~ Infl + Type + Cont, data = housing, weights = Freq) Coefficients: InflMedium InflHigh TypeApartment TypeAtrium TypeTerrace 0.566 1.289 -0.572 -0.366 -1.091 ContHigh 0.360 Intercepts: Low|Medium Medium|High -0.496 0.691 Residual Deviance: 3479.15 AIC: 3495.15 > summary(house.plr) Re-fitting to get Hessian Call: polr(formula = Sat ~ Infl + Type + Cont, data = housing, weights = Freq) Coefficients: Value Std. Error t value InflMedium 0.566 0.1047 5.41 InflHigh 1.289 0.1272 10.14 TypeApartment -0.572 0.1192 -4.80 TypeAtrium -0.366 0.1552 -2.36 TypeTerrace -1.091 0.1515 -7.20 ContHigh 0.360 0.0955 3.77 Intercepts: Value Std. Error t value Low|Medium -0.496 0.125 -3.974 Medium|High 0.691 0.125 5.505 Residual Deviance: 3479.15 AIC: 3495.15 > > (house.plr2 <- Polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)) Proportional Odds Regression Model Call: Polr(formula = Sat ~ Infl + Type + Cont, data = housing, weights = Freq) Coefficients: InflMedium InflHigh TypeApartment TypeAtrium TypeTerrace 0.566 1.289 -0.572 -0.366 -1.091 ContHigh 0.360 Log-Likelihood: -1740 (df = 8) > summary(house.plr2) Proportional Odds Regression Model Call: Polr(formula = Sat ~ Infl + Type + Cont, data = housing, weights = Freq) Coefficients: Estimate Std. Error z value Pr(>|z|) InflMedium 0.5664 0.1047 5.41 6.2e-08 *** InflHigh 1.2888 0.1272 10.14 < 2e-16 *** TypeApartment -0.5724 0.1192 -4.80 1.6e-06 *** TypeAtrium -0.3662 0.1552 -2.36 0.01828 * TypeTerrace -1.0910 0.1515 -7.20 5.9e-13 *** ContHigh 0.3603 0.0955 3.77 0.00016 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Log-Likelihood: -1740 (df = 8) Likelihood-ratio Test: Chisq = 170 on 6 degrees of freedom; p = <2e-16 > > cmp(coef(house.plr), coef(house.plr2)) > ll <- logLik(house.plr) > attr(ll, "nobs") <- NULL > cmp(ll, logLik(house.plr2)) > > proc.time() user system elapsed 1.09 0.09 1.18