R Under development (unstable) (2023-12-02 r85657 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. > library(ordinal) > > > ## Testing that errors in chol() are caught soon enough: > cy <- with(wine, which(temp == "cold" & contact == "yes")) > wine2 <- subset(wine, subset=(!1:nrow(wine) %in% cy)) > wine2[c(9, 15, 46), "rating"] <- NA > fm1 <- clm(rating ~ temp, scale=~contact, nominal=~contact, + data=wine2) Warning message: (1) Hessian is numerically singular: parameters are not uniquely determined In addition: Absolute convergence criterion was met, but relative criterion was not met > fm1 <- try(clm(rating ~ temp, scale=~contact, nominal=~contact, + data=wine2, control=list(gradTol=1e-12)), silent=TRUE) Warning message: (1) Hessian is numerically singular: parameters are not uniquely determined In addition: Absolute convergence criterion was met, but relative criterion was not met > fm2 <- try(clm(rating ~ temp, scale=~contact, nominal=~contact, + data=wine2, control=list(gradTol=1e-15)), silent=TRUE) Warning message: (-1) Model failed to converge with max|grad| = 1.11481e-07 (tol = 1e-15) In addition: iteration limit reached > ## These gave errors in version 2014.11-12. > stopifnot(!inherits(fm1, "try-error")) > stopifnot(!inherits(fm2, "try-error")) > summary(fm1) formula: rating ~ temp scale: ~contact nominal: ~contact data: wine2 link threshold nobs logLik AIC niter max.grad cond.H logit flexible 51 -60.44 140.87 63(39) 1.51e-13 -2.1e+16 Coefficients: Estimate Std. Error z value Pr(>|z|) tempwarm 2.306 NA NA NA log-scale coefficients: Estimate Std. Error z value Pr(>|z|) contactyes -0.07119 NA NA NA Threshold coefficients: Estimate Std. Error z value 1|2.(Intercept) -1.354 NA NA 2|3.(Intercept) 1.092 NA NA 3|4.(Intercept) 3.469 NA NA 4|5.(Intercept) 5.066 NA NA 1|2.contactyes -30.684 NA NA 2|3.contactyes -1.425 NA NA 3|4.contactyes -1.808 NA NA 4|5.contactyes -1.870 NA NA (3 observations deleted due to missingness) > summary(fm2) formula: rating ~ temp scale: ~contact nominal: ~contact data: wine2 link threshold nobs logLik AIC niter max.grad cond.H logit flexible 51 -60.44 140.87 111(86) 1.11e-07 1.8e+17 Coefficients: Estimate Std. Error z value Pr(>|z|) tempwarm 2.3060 0.7713 2.99 0.00279 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 log-scale coefficients: Estimate Std. Error z value Pr(>|z|) contactyes -0.07126 2995.02357 0 1 Threshold coefficients: Estimate Std. Error z value 1|2.(Intercept) -1.354e+00 5.707e-01 -2.373 2|3.(Intercept) 1.092e+00 5.251e-01 2.080 3|4.(Intercept) 3.469e+00 7.982e-01 4.346 4|5.(Intercept) 5.066e+00 1.193e+00 4.246 1|2.contactyes -3.822e+01 1.282e+09 0.000 2|3.contactyes -1.425e+00 7.902e+03 0.000 3|4.contactyes -1.808e+00 1.933e+03 -0.001 4|5.contactyes -1.870e+00 2.665e+03 -0.001 (3 observations deleted due to missingness) > > ## Error in convergence.clm() due to bad evaluation of model > ## environment with update(object, doFit=FALSE): > wine3 <- wine > set.seed(1234) > wts <- runif(nrow(wine3), 0, 2) > fm3 <- clm(rating ~ temp + contact, data=wine3, + weights=wts) > c0 <- convergence(fm3) > set.seed(1234) > fm3 <- clm(rating ~ temp + contact, data=wine3, + weights=runif(nrow(wine3), 0, 2)) > c1 <- convergence(fm3) > c0$info$logLik.Error [1] "<1e-10" > c1$info$logLik.Error [1] "<1e-10" > all.equal(c0$info$logLik.Error, c1$info$logLik.Error) [1] TRUE > ## In version 2014.11-14: > ## > wine3 <- wine > ## > set.seed(1234) > ## > wts <- runif(nrow(wine3), 0, 2) > ## > fm3 <- clm(rating ~ temp + contact, data=wine3, > ## + weights=wts) > ## > c0 <- convergence(fm3) > ## > set.seed(1234) > ## > fm3 <- clm(rating ~ temp + contact, data=wine3, > ## + weights=runif(nrow(wine3), 0, 2)) > ## > c1 <- convergence(fm3) > ## > c0$info$logLik.Error > ## [1] "<1e-10" > ## > c1$info$logLik.Error > ## [1] "4.80e+00" > ## > all.equal(c0$info$logLik.Error, c1$info$logLik.Error) > ## [1] "1 string mismatch" > stopifnot(c0$info$logLik.Error == + c1$info$logLik.Error) > > proc.time() user system elapsed 1.54 0.28 1.81