Running ‘check_methods.R’ [5s/6s]
  Running ‘check_mvord_data.R’ [3s/3s]
  Running ‘check_mvord_errors.R’ [3s/3s]
  Running ‘check_set_threshold_type.R’ [3s/3s]
  Running ‘check_toy_example.R’ [3s/3s]
  Running ‘check_transf_sigmas.R’ [2s/3s]
  Running ‘check_transf_thresholds.R’ [3s/3s]
Running the tests in ‘tests/check_methods.R’ failed.
Complete output:
  > library(mvord)
  Loading required package: minqa
  Loading required package: BB
  Loading required package: ucminf
  Loading required package: dfoptim
  > 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 = mvprobit(),
  +                      control = mvord.control(solver = "newuoa"),
  +                      #se = T,
  +                      error.structure = cor_general(~1),
  +                      threshold.constraints = c(1,2),
  +                      coef.constraints = c(1,1))
  > 
  > 
  > 
  > print(res)
  
  Call:
  mvord:::mvord(formula = MMO(Y, i, j) ~ 0 + X1 + X2, data = df_NA, 
      error.structure = cor_general(~1), link = mvprobit(), coef.constraints = c(1, 
          1), threshold.constraints = c(1, 2), control = mvord.control(solver = "newuoa"))
  
  Thresholds:
  $`1`
        1|2       2|3 
  -2.243410  1.664118 
  
  $`2`
        1|2       2|3 
  -1.856055  1.655492 
  
  Coefficients:
       X1 1      X2 1 
   1.398855 -2.970139 
  
  Parameters of the error structure:
   corr 1 2 
  0.8117168 
  
  > summary(res)
  Error in `[<-.data.frame`(`*tmp*`, tmp[, 2] == 0, 3, value = NA) : 
    replacement has 1 row, data has 0
  Calls: summary -> summary.mvord -> [<- -> [<-.data.frame
  Execution halted
Running the tests in ‘tests/check_toy_example.R’ failed.
Complete output:
  > library(mvord)
  Loading required package: minqa
  Loading required package: BB
  Loading required package: ucminf
  Loading required package: dfoptim
  > 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))
  Error in `[<-.data.frame`(`*tmp*`, is.na(mf[, k]), k, value = 0) : 
    replacement has 1 row, data has 0
  Calls: <Anonymous> ... initialize_MMO -> lapply -> FUN -> [<- -> [<-.data.frame
  In addition: Warning message:
  In mvord:::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, link = mvprobit(),  :
    Variables f1 and f2 are absent, the contrasts will be ignored.
  Execution halted