Running ‘check_methods.R’ [2s/4s]
  Running ‘check_mvord_data.R’ [2s/3s]
  Running ‘check_mvord_errors.R’ [2s/3s]
  Running ‘check_set_threshold_type.R’ [2s/3s]
  Running ‘check_toy_example.R’ [7s/10s]
  Running ‘check_transf_sigmas.R’ [2s/3s]
  Running ‘check_transf_thresholds.R’ [2s/4s]
Running the tests in ‘tests/check_methods.R’ failed.
Complete output:
  > #q("no")
  > #R
  > library(mvord)
  > data(data_mvord_toy)
  > tolerance <- 1e-6
  > 
  > # convert data_mvord_toy into long format
  > df <- cbind.data.frame("i" = rep(1:100,2), "j" = rep(1:2,each = 100),
  +                        "Y" = c(data_mvord_toy$Y1,data_mvord_toy$Y2),
  +                        "X1" = rep(data_mvord_toy$X1,2),
  +                        "X2" = rep(data_mvord_toy$X2,2),
  +                        "f1" = factor(sample(rep(data_mvord_toy$Y2,2)), ordered =F),
  +                        "f2" = factor(rep(data_mvord_toy$Y1,2), ordered=F))
  > 
  > df_NA <- df[-c(1,90:110),]
  > 
  > 
  > res <- mvord:::mvord(formula = MMO(Y, i, j) ~ 0 + X1 + X2,
  +                      data = df_NA,
  +                      #index = c("i", "j"),
  +                      link = mvlogit(),
  +                      control = mvord.control(solver = "newuoa"),
  +                      #se = T,
  +                      error.structure = cor_general(~1),
  +                      threshold.constraints = c(1,2),
  +                      coef.constraints = c(1,1))
  Error in mvord.fit(rho) : 
    NO/FALSE CONVERGENCE - choose a different optimizer or different starting values.
  Calls: <Anonymous> -> mvord.fit
  Execution halted
Running the tests in ‘tests/check_toy_example.R’ failed.
Complete output:
  > library(mvord)
  > library(MASS)
  > 
  > 
  > #data(data_toy_example)
  > tolerance <- 1e-6
  > 
  > mult.obs <- 2
  > sigma <- matrix(c(1,0.8,0.8,1), ncol = 2)
  > betas <- list(c(0.8,-0.5),
  +               c(0.8,-0.5))
  > thresholds <- list(c(-1,1),c(-1,1))
  > nobs <- 100
  > seed <- 2017
  > set.seed(2017)
  > errors <-  mvrnorm(n = nobs, mu = rep(0, mult.obs), Sigma = sigma)
  > 
  > X1 <- rnorm(nobs, 0, 1)
  > X2 <- rnorm(nobs, 0, 1)
  > 
  > pred <- cbind(X1, X2)
  > 
  > y <- sapply(1:mult.obs, function(j) pred %*% betas[[j]] + errors[, j], simplify = "array")
  > y.ord <- sapply(1:mult.obs, function(j) cut(y[, , j], c(min(y[, , j]) - 1, c(thresholds[[j]]), max(y[, , j]) + 1),
  +                                             labels = FALSE), simplify = "array")
  > predictors.fixed <- lapply(1:mult.obs, function(j) pred)
  > y <- as.data.frame(y.ord)
  > 
  > for(i in 1:mult.obs){
  +   y[, i] <- factor(y[, i], levels = sort(unique(y[, i])),
  +                    ordered = TRUE)
  + }
  > 
  > 
  > 
  > 
  > data_toy_example <- cbind.data.frame(y, predictors.fixed[[1]])
  > colnames(data_toy_example) <- c("Y1","Y2", "X1", "X2")
  > w <- c(rep(1/20, 20), rep(1/30, 30), rep(1/20, 20), rep(1/30, 30))
  > 
  > 
  > 
  > # convert data_toy_example into long format
  > df <- cbind.data.frame("i" = rep(1:100,2),
  +                        "j" = rep(1:2,each = 100),
  +                        "Y" = c(data_toy_example$Y1,data_toy_example$Y2),
  +                        "X1" = rep(data_toy_example$X1,2),
  +                        "X2" = rep(data_toy_example$X2,2),
  +                        "f1" = factor(sample(rep(data_toy_example$Y2,2)), ordered =F),
  +                        "f2" = factor(rep(data_toy_example$Y1,2), ordered=F),
  +                        w=rep(w,2))
  > 
  > 
  > 
  > # library(ROI)
  > # ROI_solver <- function(starting.values, objFun, control){
  > #     n <- length(starting.values)
  > #     op <- OP(objective = F_objective(objFun, n = n),
  > #              bounds = V_bound(li = seq_len(n), lb = rep.int(-Inf, n)))
  > #     optRes <- ROI_solve(op, solver = "nlminb",
  > #         control = c(list(start = starting.values),
  > #                     control))
  > #     list(optpar    = optRes$solution,
  > #          objective = optRes$objval) # a vector of length equal to number of parameters to optimize
  > # }
  > #
  > #
  > #
  > res <- mvord:::mvord(formula = MMO(Y) ~ 0 + X1 + X2,
  +                       data = df,
  +                       #index = c("i", "j"),
  +                       link = mvprobit(),
  +                       #control = mvord.control(solver = "BFGS"),
  +                       #se = T,
  +                       error.structure = cor_general(~1),
  +                       threshold.constraints = c(1,1),
  +                       coef.constraints = c(1,1),
  +                       contrasts = list(f1 = function(x)
  +                        contr.treatment(nlevels(df$f1), base = 1),
  +                        f2 = "contr.sum"),
  +                       control= mvord.control(solver="BFGS",se=T))
  > 
  > 
  > 
  > 
  > res.summary <- summary(res, short = FALSE)
  
  Call: mvord:::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~1), 
      link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 
          1), contrasts = list(f1 = function(x) contr.treatment(nlevels(df$f1), 
          base = 1), f2 = "contr.sum"), control = mvord.control(solver = "BFGS", 
          se = T))
  
  Formula: MMO(Y) ~ 0 + X1 + X2
  
      link threshold nsubjects ndim   logPL  CLAIC  CLBIC fevals
  mvprobit  flexible       100    2 -134.91 280.34 294.06     32
  
  Thresholds:
        Estimate Std. Error z value  Pr(>|z|)    
  1 1|2 -0.96257    0.16614 -5.7938 6.882e-09 ***
  1 2|3  1.03347    0.15004  6.8877 5.668e-12 ***
  2 1|2 -0.96257    0.16614 -5.7938 6.882e-09 ***
  2 2|3  1.03347    0.15004  6.8877 5.668e-12 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  
  Coefficients:
       Estimate Std. Error z value  Pr(>|z|)    
  X1 1  0.63801    0.13577  4.6993 2.611e-06 ***
  X2 1 -0.42673    0.13644 -3.1276  0.001762 ** 
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  
  Error Structure:
           Estimate Std. Error z value  Pr(>|z|)    
  corr 1 2 0.854267   0.062441  13.681 < 2.2e-16 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  > # paste(format(res.summary$thresholds$Estimate), collapse = ",")
  > # paste(format(res.summary$coefficients$Estimate), collapse = ",")
  > # paste(format(res.summary$error.structure$Estimate), collapse = ",")
  > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-0.96257386663519672876,  1.03347036873223707687, -0.96257386663519672876,  1.03347036873223707687), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.63801035062404309883, -0.42672524816263474046), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.85426672822122684536), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.16613952738605441972, 0.15004482537617935822, 0.16613952738605441972, 0.15004482537617935822), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.13576747301357894315, 0.13643665802446261481), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.062440889990360744222), tolerance = tolerance))
  > mvord:::check(all.equal(logLik(res)[[1]], -134.90867383086322207, tolerance = tolerance))
  > mvord:::check(all.equal(AIC(res), 280.3436634512001433, tolerance = tolerance))
  > mvord:::check(all.equal(BIC(res), 294.05508548271637892, tolerance = tolerance))
  > 
  > 
  > res2 <- mvord:::mvord(formula = MMO(Y) ~ 0 + X1 + X2,
  +                      data = df,
  +                      link = mvprobit(),
  +                      control = mvord.control(solver = "BFGS"),
  +                      #se = T,
  +                      error.structure = cor_general(~1),
  +                      threshold.constraints = c(1,1),
  +                      coef.constraints = list(matrix(rep(1,4), ncol = 1), matrix(rep(1,4), ncol = 1)))
  > 
  > mvord:::check(all.equal(res$beta, res2$beta, tolerance = tolerance))
  > mvord:::check(all.equal(res$sebeta, res2$sebeta, tolerance = tolerance))
  > ########################################################################
  > ## No coefficients
  > res <- mvord:::mvord(formula = MMO(Y) ~ -1,
  +                       data = df,#data_toy_example,
  +                       link = mvprobit(),
  +                       error.structure = cor_general(~1),
  +                       threshold.constraints = c(1,1),
  +                       control= mvord.control(solver="BFGS",se=T))
  > res.summary <- summary(res, short = FALSE)
  
  Call: mvord:::mvord(formula = MMO(Y) ~ -1, data = df, error.structure = cor_general(~1), 
      link = mvprobit(), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS", 
          se = T))
  
  Formula: MMO(Y) ~ -1
  
      link threshold nsubjects ndim   logPL  CLAIC  CLBIC fevals
  mvprobit  flexible       100    2 -153.66 313.51 321.57     26
  
  Thresholds:
        Estimate Std. Error z value  Pr(>|z|)    
  1 1|2 -0.75480    0.13106 -5.7593 8.444e-09 ***
  1 2|3  0.86086    0.13361  6.4433 1.169e-10 ***
  2 1|2 -0.75480    0.13106 -5.7593 8.444e-09 ***
  2 2|3  0.86086    0.13361  6.4433 1.169e-10 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  
  Coefficients:
       Estimate Std. Error z value Pr(>|z|)
  
  Error Structure:
           Estimate Std. Error z value  Pr(>|z|)    
  corr 1 2 0.905795   0.038855  23.312 < 2.2e-16 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-0.75479706538110091785,  0.86086304364935783973, -0.75479706538110091785,  0.86086304364935783973), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(numeric(0)), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.90579517144642240911), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.13105603927553965971, 0.13360642334434202905, 0.13105603927553965971, 0.13360642334434202905), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(numeric(0)), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.038855435949034601573), tolerance = tolerance))
  > mvord:::check(all.equal(logLik(res)[[1]], -153.66397119528727444, tolerance = tolerance))
  > mvord:::check(all.equal(AIC(res), 313.51350940088383368, tolerance = tolerance))
  > mvord:::check(all.equal(BIC(res), 321.57073678022845797, tolerance = tolerance))
  > 
  > #polychor
  > res <- mvord:::mvord(formula = MMO(Y) ~ 1,
  +                      data = df,#data_toy_example,
  +                      link = mvprobit(),
  +                      error.structure = cor_general(~1),
  +                      threshold.constraints = c(1,1),
  +                      control= mvord.control(solver="BFGS",se=T))
  Note: First threshold for each response is fixed to 0 in order to ensure identifiability!
  > res.summary <- summary(res, short = FALSE)
  
  Call: mvord:::mvord(formula = MMO(Y) ~ 1, data = df, error.structure = cor_general(~1), 
      link = mvprobit(), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS", 
          se = T))
  
  Formula: MMO(Y) ~ 1
  
      link threshold nsubjects ndim   logPL  CLAIC  CLBIC fevals
  mvprobit fix1first       100    2 -153.56 315.46 326.32     52
  
  Thresholds:
        Estimate Std. Error z value  Pr(>|z|)    
  1 1|2  0.00000    0.00000      NA        NA    
  1 2|3  1.61576    0.15607  10.353 < 2.2e-16 ***
  2 1|2  0.00000    0.00000      NA        NA    
  2 2|3  1.61576    0.15607  10.353 < 2.2e-16 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  
  Coefficients:
                Estimate Std. Error z value  Pr(>|z|)    
  (Intercept) 1  0.73786    0.13501  5.4653 4.622e-08 ***
  (Intercept) 2  0.77256    0.14064  5.4932 3.948e-08 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  
  Error Structure:
           Estimate Std. Error z value  Pr(>|z|)    
  corr 1 2 0.906374   0.038916  23.291 < 2.2e-16 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(0.0000000000000000000, 1.6157607546978449697, 0.0000000000000000000, 1.6157607546978449697), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.73786225358709867095, 0.77255634837212872057), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.90637393266264265623), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.00000000000000000000, 0.15607113684416776267, 0.00000000000000000000, 0.15607113684416776267), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.13500906208906049422, 0.14063945843173727979), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.038916052675185497378), tolerance = tolerance))
  > mvord:::check(all.equal(logLik(res)[[1]], -153.5640565887688922, tolerance = tolerance))
  > mvord:::check(all.equal(AIC(res), 315.46144651087109878, tolerance = tolerance))
  > mvord:::check(all.equal(BIC(res), 326.31632228582151356, tolerance = tolerance))
  > #######################################################################
  > ## cor_general(~factor)
  > res <- mvord:::mvord(formula = MMO(Y) ~ 0 + X1 + X2,
  +                      data = df,
  +                      link = mvprobit(),
  +                      control = mvord.control(solver = "BFGS"),
  +                      error.structure = cor_general(~f2),
  +                      threshold.constraints = c(1,1),
  +                      coef.constraints = c(1,1),
  +                      contrasts = list(f2 = "contr.sum"))
  > 
  > res.summary <- summary(res, short = FALSE)
  
  Call: mvord:::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~f2), 
      link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 
          1), contrasts = list(f2 = "contr.sum"), control = mvord.control(solver = "BFGS"))
  
  Formula: MMO(Y) ~ 0 + X1 + X2
  
      link threshold nsubjects ndim   logPL  CLAIC CLBIC fevals
  mvprobit  flexible       100    2 -134.17 283.39   303     38
  
  Thresholds:
        Estimate Std. Error z value  Pr(>|z|)    
  1 1|2 -0.90553    0.18266 -4.9575 7.139e-07 ***
  1 2|3  1.00421    0.17467  5.7491 8.972e-09 ***
  2 1|2 -0.90553    0.18266 -4.9575 7.139e-07 ***
  2 2|3  1.00421    0.17467  5.7491 8.972e-09 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  
  Coefficients:
       Estimate Std. Error z value  Pr(>|z|)    
  X1 1  0.64793    0.14154  4.5779 4.698e-06 ***
  X2 1 -0.42893    0.13990 -3.0660  0.002169 ** 
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  
  Error Structure:
               Estimate Std. Error z value  Pr(>|z|)    
  corr f21 1 2 0.736679   0.178238  4.1331 3.579e-05 ***
  corr f22 1 2 0.918298   0.068859 13.3360 < 2.2e-16 ***
  corr f23 1 2 0.837106   0.131036  6.3884 1.677e-10 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  > 
  > # paste(format(res.summary$thresholds$Estimate), collapse = ",")
  > # paste(format(res.summary$coefficients$Estimate), collapse = ",")
  > # paste(format(res.summary$error.structure$Estimate), collapse = ",")
  > mvord:::check(all.equal(res.summary$thresholds$Estimate,
  +   c(-0.90552506790519915469,  1.00420547521745429087, -0.90552506790519915469,  1.00420547521745429087), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$coefficients$Estimate,
  +   c(0.64793126338493944871, -0.42893128334048874484), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$error.structure$Estimate,
  +   c(0.73667859723415496376, 0.91829826305234418804, 0.83710611971260706632), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`,
  +   c(0.18265647646915181279, 0.17467164336594759311, 0.18265647646915181279, 0.17467164336594759311), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`,
  +   c(0.14153585035881874332, 0.13989943737309898375), tolerance = tolerance))
  > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`,
  +   c(0.17823839430849069965, 0.06885865619995423792, 0.13103608299872890330), tolerance = tolerance))
  > mvord:::check(all.equal(logLik(res)[[1]], -134.17046176709035876, tolerance = tolerance))
  > mvord:::check(all.equal(AIC(res), 283.39468697504094052, tolerance = tolerance))
  > mvord:::check(all.equal(BIC(res), 303.00349482656417877, tolerance = tolerance))
  > 
  > ##################################################################################
  > res <- mvord:::mvord(formula = MMO(Y, i, j) ~  0 + X1 + X2,
  +                      data = df,
  +                      #index = c("i", "j"),
  +                      link = mvlogit(df = 8L),
  +                      #solver = "newuoa",
  +                      #se = T,
  +                      error.structure = cor_general(~1),
  +                      threshold.constraints = c(1,1),
  + coef.constraints = c(1,1))
  Error in mvord.fit(rho) : 
    NO/FALSE CONVERGENCE - choose a different optimizer or different starting values.
  Calls: <Anonymous> -> mvord.fit
  Execution halted