Running ‘anova.R’ [2s/3s]
  Running ‘clm.fit.R’ [2s/3s]
  Running ‘clm.formula.R’ [2s/3s]
  Running ‘clmm.R’ [3s/4s]
  Running ‘clmm.control.R’ [2s/3s]
  Running ‘clmm.formula.R’ [3s/5s]
  Running ‘confint.R’ [3s/4s]
  Running ‘nominal.test.R’ [4s/6s]
  Running ‘test-all.R’ [20s/29s]
  Running ‘test.clm.Theta.R’ [3s/5s]
  Running ‘test.clm.convergence.R’ [2s/3s]
  Running ‘test.clm.flex.link.R’ [2s/3s]
  Running ‘test.clm.model.matrix.R’ [2s/4s]
  Running ‘test.clm.predict.R’ [2s/3s]
  Running ‘test.clm.profile.R’ [2s/3s]
  Running ‘test.clm.single.anova.R’ [2s/4s]
  Running ‘test.general.R’ [0s/1s]
  Running ‘test.makeThresholds.R’ [2s/2s]
  Running ‘test.sign.R’ [2s/3s]
  Running ‘test0weights.R’ [3s/4s]
  Running ‘testAnova.clm2.R’ [2s/4s]
  Running ‘testCLM.R’ [3s/5s]
Running the tests in ‘tests/clmm.R’ failed.
Complete output:
  > library(ordinal)
  > data(wine)
  > 
  > #################################
  > ## Estimation with a single simple RE term:
  > ## Laplace:
  > fmm1 <- clmm(rating ~ contact + temp + (1|judge), data=wine)
  > summary(fmm1)
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  ordinal
   --- call from context --- 
  summary.clmm(fmm1)
   --- call from argument --- 
  if (class(vc) == "try-error") {
      warning("Variance-covariance matrix of the parameters is not defined")
      coef[, 2:4] <- NaN
      if (correlation) 
          warning("Correlation matrix is unavailable")
      object$condHess <- NaN
  } else {
      coef[, 2] <- sd <- sqrt(diag(vc)[1:nfepar])
      object$condHess <- if (any(is.na(object$Hessian))) 
          Inf
      else with(eigen(object$Hessian, only.values = TRUE), abs(max(values)/min(values)))
      coef[, 3] <- coef[, 1]/coef[, 2]
      coef[, 4] <- 2 * pnorm(abs(coef[, 3]), lower.tail = FALSE)
      if (correlation) 
          object$correlation <- cov2cor(vc)
  }
   --- R stacktrace ---
  where 1: summary.clmm(fmm1)
  where 2: summary(fmm1)
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (object, correlation = FALSE, ...) 
  {
      if (is.null(object$Hessian)) 
          stop("Model needs to be fitted with Hess = TRUE")
      nfepar <- object$dims$nfepar
      coef <- matrix(0, nfepar, 4, dimnames = list(names(object$coefficients[1:nfepar]), 
          c("Estimate", "Std. Error", "z value", "Pr(>|z|)")))
      coef[, 1] <- object$coefficients[1:nfepar]
      vc <- try(vcov(object), silent = TRUE)
      if (class(vc) == "try-error") {
          warning("Variance-covariance matrix of the parameters is not defined")
          coef[, 2:4] <- NaN
          if (correlation) 
              warning("Correlation matrix is unavailable")
          object$condHess <- NaN
      }
      else {
          coef[, 2] <- sd <- sqrt(diag(vc)[1:nfepar])
          object$condHess <- if (any(is.na(object$Hessian))) 
              Inf
          else with(eigen(object$Hessian, only.values = TRUE), 
              abs(max(values)/min(values)))
          coef[, 3] <- coef[, 1]/coef[, 2]
          coef[, 4] <- 2 * pnorm(abs(coef[, 3]), lower.tail = FALSE)
          if (correlation) 
              object$correlation <- cov2cor(vc)
      }
      object$info$cond.H <- formatC(object$condHess, digits = 1, 
          format = "e")
      object$coefficients <- coef
      class(object) <- "summary.clmm"
      return(object)
  }
  <bytecode: 0x55ce7a670e20>
  <environment: namespace:ordinal>
   --- function search by body ---
  Function summary.clmm in namespace ordinal has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1
Running the tests in ‘tests/clmm.formula.R’ failed.
Complete output:
  > library(ordinal)
  > data(wine)
  > 
  > #################################
  > ## Appropriate evaluation of formulas:
  > 
  > ## These all work as intended with no warnings or errors:
  > fm1 <- clmm(rating ~ contact + (1|judge), data=wine)
  > fm1
  Cumulative Link Mixed Model fitted with the Laplace approximation
  
  formula: rating ~ contact + (1 | judge)
  data:    wine
  
   link  threshold nobs logLik AIC    niter    max.grad
   logit flexible  72   -98.80 209.59 228(686) 3.67e-06
  
  Random effects:
   Groups Name        Variance Std.Dev.
   judge  (Intercept) 0.4428   0.6654  
  Number of groups:  judge 9 
  
  Coefficients:
  contactyes 
         1.3 
  
  Thresholds:
       1|2      2|3      3|4      4|5 
  -2.28331  0.04325  1.86062  3.20298 
  > fm1 <- clmm("rating ~ contact + (1|judge)", data=wine)
  > fm1
  Cumulative Link Mixed Model fitted with the Laplace approximation
  
  formula: rating ~ contact + (1 | judge)
  data:    wine
  
   link  threshold nobs logLik AIC    niter    max.grad
   logit flexible  72   -98.80 209.59 228(686) 3.67e-06
  
  Random effects:
   Groups Name        Variance Std.Dev.
   judge  (Intercept) 0.4428   0.6654  
  Number of groups:  judge 9 
  
  Coefficients:
  contactyes 
         1.3 
  
  Thresholds:
       1|2      2|3      3|4      4|5 
  -2.28331  0.04325  1.86062  3.20298 
  > fm1 <- clmm(as.formula("rating ~ contact + (1|judge)"), data=wine)
  > fm1 
  Cumulative Link Mixed Model fitted with the Laplace approximation
  
  formula: rating ~ contact + (1 | judge)
  data:    wine
  
   link  threshold nobs logLik AIC    niter    max.grad
   logit flexible  72   -98.80 209.59 228(686) 3.67e-06
  
  Random effects:
   Groups Name        Variance Std.Dev.
   judge  (Intercept) 0.4428   0.6654  
  Number of groups:  judge 9 
  
  Coefficients:
  contactyes 
         1.3 
  
  Thresholds:
       1|2      2|3      3|4      4|5 
  -2.28331  0.04325  1.86062  3.20298 
  > fm1 <- clmm(as.formula(rating ~ contact + (1|judge)), data=wine) 
  > fm1
  Cumulative Link Mixed Model fitted with the Laplace approximation
  
  formula: rating ~ contact + (1 | judge)
  data:    wine
  
   link  threshold nobs logLik AIC    niter    max.grad
   logit flexible  72   -98.80 209.59 228(686) 3.67e-06
  
  Random effects:
   Groups Name        Variance Std.Dev.
   judge  (Intercept) 0.4428   0.6654  
  Number of groups:  judge 9 
  
  Coefficients:
  contactyes 
         1.3 
  
  Thresholds:
       1|2      2|3      3|4      4|5 
  -2.28331  0.04325  1.86062  3.20298 
  > 
  > #################################
  > 
  > ### finding variables in the environment of the formula:
  > makeform <- function() {
  +   f1 <- as.formula(rating ~ temp + contact + (1|judge))
  +   rating <- wine$rating
  +   temp <- wine$temp
  +   contact <- wine$contact
  +   judge <- wine$judge
  +   f1
  + }
  > ## 'makeform' makes are formula object in the environment of the
  > ## function makeform:
  > f1 <- makeform()
  > f1 # print
  rating ~ temp + contact + (1 | judge)
  <environment: 0x557ba4ae3300>
  > class(f1)
  [1] "formula"
  > ## If we give the data, we can evaluate the model:
  > fm1 <- clmm(f1, data=wine)
  > ## We can also evaluate the model because the data are available in
  > ## the environment associated with the formula:
  > fm1 <- clmm(f1)
  > ## For instance, the 'rating' variable is not found in the Global
  > ## environment; we have to evaluate the 'name' of 'rating' in the
  > ## appropriate environment:
  > (try(rating, silent=TRUE))
  [1] "Error in try(rating, silent = TRUE) : object 'rating' not found\n"
  attr(,"class")
  [1] "try-error"
  attr(,"condition")
  <simpleError in doTryCatch(return(expr), name, parentenv, handler): object 'rating' not found>
  > eval(as.name("rating"), envir=environment(f1))
   [1] 2 3 3 4 4 4 5 5 1 2 1 3 2 3 5 4 2 3 3 2 5 5 4 4 3 2 3 2 3 2 5 3 2 3 4 3 3 3
  [39] 3 3 3 2 3 2 2 4 5 4 1 1 2 2 2 3 2 3 2 2 2 3 3 3 3 4 1 2 3 2 3 2 4 4
  Levels: 1 < 2 < 3 < 4 < 5
  > ## If instead we generate the formula in the Global environment where
  > ## the variables are not found, we cannot evaluate the model:
  > f2 <- as.formula(rating ~ temp + contact + (1|judge))
  > (try(fm2 <- clmm(f2), silent=TRUE))
  [1] "Error in eval(predvars, data, env) : object 'rating' not found\n"
  attr(,"class")
  [1] "try-error"
  attr(,"condition")
  <simpleError in eval(predvars, data, env): object 'rating' not found>
  > environment(f2) <- environment(f1)
  > fm2 <- clmm(f2)
  > 
  > #################################
  > ## Use of formula-objects
  > f <- formula(rating ~ temp + contact + (1|judge))
  > m2 <- clmm(f, data = wine)
  > summary(m2)
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  ordinal
   --- call from context --- 
  summary.clmm(m2)
   --- call from argument --- 
  if (class(vc) == "try-error") {
      warning("Variance-covariance matrix of the parameters is not defined")
      coef[, 2:4] <- NaN
      if (correlation) 
          warning("Correlation matrix is unavailable")
      object$condHess <- NaN
  } else {
      coef[, 2] <- sd <- sqrt(diag(vc)[1:nfepar])
      object$condHess <- if (any(is.na(object$Hessian))) 
          Inf
      else with(eigen(object$Hessian, only.values = TRUE), abs(max(values)/min(values)))
      coef[, 3] <- coef[, 1]/coef[, 2]
      coef[, 4] <- 2 * pnorm(abs(coef[, 3]), lower.tail = FALSE)
      if (correlation) 
          object$correlation <- cov2cor(vc)
  }
   --- R stacktrace ---
  where 1: summary.clmm(m2)
  where 2: summary(m2)
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (object, correlation = FALSE, ...) 
  {
      if (is.null(object$Hessian)) 
          stop("Model needs to be fitted with Hess = TRUE")
      nfepar <- object$dims$nfepar
      coef <- matrix(0, nfepar, 4, dimnames = list(names(object$coefficients[1:nfepar]), 
          c("Estimate", "Std. Error", "z value", "Pr(>|z|)")))
      coef[, 1] <- object$coefficients[1:nfepar]
      vc <- try(vcov(object), silent = TRUE)
      if (class(vc) == "try-error") {
          warning("Variance-covariance matrix of the parameters is not defined")
          coef[, 2:4] <- NaN
          if (correlation) 
              warning("Correlation matrix is unavailable")
          object$condHess <- NaN
      }
      else {
          coef[, 2] <- sd <- sqrt(diag(vc)[1:nfepar])
          object$condHess <- if (any(is.na(object$Hessian))) 
              Inf
          else with(eigen(object$Hessian, only.values = TRUE), 
              abs(max(values)/min(values)))
          coef[, 3] <- coef[, 1]/coef[, 2]
          coef[, 4] <- 2 * pnorm(abs(coef[, 3]), lower.tail = FALSE)
          if (correlation) 
              object$correlation <- cov2cor(vc)
      }
      object$info$cond.H <- formatC(object$condHess, digits = 1, 
          format = "e")
      object$coefficients <- coef
      class(object) <- "summary.clmm"
      return(object)
  }
  <bytecode: 0x557ba9e36898>
  <environment: namespace:ordinal>
   --- function search by body ---
  Function summary.clmm in namespace ordinal has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1