CRAN Package Check Results for Package mvord

Last updated on 2024-01-10 19:52:36 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.1.1 16.78 191.70 208.48 ERROR
r-devel-linux-x86_64-debian-gcc 1.1.1 12.68 143.22 155.90 ERROR
r-devel-linux-x86_64-fedora-clang 1.1.1 254.55 ERROR
r-devel-linux-x86_64-fedora-gcc 1.1.1 260.72 ERROR
r-devel-windows-x86_64 1.1.1 15.00 175.00 190.00 ERROR
r-patched-linux-x86_64 1.1.1 18.07 207.85 225.92 OK
r-release-linux-x86_64 1.1.1 12.97 207.42 220.39 OK
r-release-macos-arm64 1.1.1 95.00 NOTE
r-release-macos-x86_64 1.1.1 147.00 NOTE
r-release-windows-x86_64 1.1.1 19.00 224.00 243.00 OK
r-oldrel-macos-arm64 1.1.1 83.00 OK
r-oldrel-windows-x86_64 1.1.1 19.00 237.00 256.00 OK

Check Details

Version: 1.1.1
Check: Rd files
Result: NOTE checkRd: (-1) error_structure.Rd:25-26: Lost braces in \itemize; meant \describe ? checkRd: (-1) error_structure.Rd:27-28: Lost braces in \itemize; meant \describe ? checkRd: (-1) error_structure.Rd:29-30: Lost braces in \itemize; meant \describe ? checkRd: (-1) error_structure.Rd:31-32: Lost braces in \itemize; meant \describe ? checkRd: (-1) mvlinks.Rd:22-24: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvlinks.Rd:25-28: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvlinks.Rd:29-33: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvlinks.Rd:34-38: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvlinks.Rd:39-49: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvlinks.Rd:50-56: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvlinks.Rd:57-66: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvlinks.Rd:61: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvlinks.Rd:62: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvlinks.Rd:63: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvord.Rd:106-136: Lost braces in \itemize; meant \describe ? checkRd: (-1) mvord.Rd:141-159: Lost braces in \itemize; meant \describe ? checkRd: (-1) mvord.Rd:164-170: Lost braces in \itemize; meant \describe ? checkRd: (-1) mvord.Rd:172-177: Lost braces in \itemize; meant \describe ? checkRd: (-1) mvord.Rd:66-68: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvord.Rd:71: Lost braces 71 | a named \code{\link{list}}{ of threshold parameters} | ^ checkRd: (-1) mvord.Rd:72-75: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvord.Rd:76-78: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvord.Rd:79-81: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvord.Rd:82-84: Lost braces in \itemize; \value handles \item{}{} directly checkRd: (-1) mvord.Rd:85-87: Lost braces in \itemize; \value handles \item{}{} directly Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc

Version: 1.1.1
Check: tests
Result: ERROR 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’ [2s/3s] Running ‘check_toy_example.R’ [34s/37s] Running ‘check_transf_sigmas.R’ [2s/3s] Running ‘check_transf_thresholds.R’ [2s/3s] 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 > suppressWarnings(RNGversion("3.5.0")) > 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 = FALSE), + "f2" = factor(rep(data_toy_example$Y1,2), ordered = FALSE), + w = rep(w,2)) > df$X3 <- cut(df$X2, c(-Inf, -0.2, 0.2, Inf)) > > > > # 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, + link = mvprobit(), + 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=TRUE)) 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. > options(digits = 22) > > 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 = TRUE)) 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 1 1|2 -0.96257386663499888702 0.16613952738603396386 -5.7937700000000003087 1 2|3 1.03347036873238828925 0.15004482537615168591 6.8877399999999999736 2 1|2 -0.96257386663499888702 0.16613952738603396386 -5.7937700000000003087 2 2|3 1.03347036873238828925 0.15004482537615168591 6.8877399999999999736 Pr(>|z|) 1 1|2 6.8825e-09 *** 1 2|3 5.6684e-12 *** 2 1|2 6.8825e-09 *** 2 2|3 5.6684e-12 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.63801035062442590373 0.13576747301354935571 4.6992900000000004113 X2 1 -0.42672524816265555714 0.13643665802445156809 -3.1276399999999999757 Pr(>|z|) X1 1 2.6107e-06 *** X2 1 0.0017621 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.854266728221043991631 0.062440889990424582046 13.681210000000000093 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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"), + 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, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + control= mvord.control(solver="BFGS",se=TRUE)) > 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 = TRUE)) 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 1 1|2 -0.75479706538162727458 0.13105603927552006427 -5.7593500000000004135 1 2|3 0.86086304364912058507 0.13360642334434574829 6.4432799999999996743 2 1|2 -0.75479706538162727458 0.13105603927552006427 -5.7593500000000004135 2 2|3 0.86086304364912058507 0.13360642334434574829 6.4432799999999996743 Pr(>|z|) 1 1|2 8.4440e-09 *** 1 2|3 1.1692e-10 *** 2 1|2 8.4440e-09 *** 2 2|3 1.1692e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value Pr(>|z|) Error Structure: Estimate Std. Error z value corr 1 2 0.905795171446388658332 0.038855435949046335242 23.311930000000000263 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + control= mvord.control(solver="BFGS",se=TRUE)) 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 = TRUE)) 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 1 1|2 0.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.61576075469784496974 0.15607113684416781818 10.3527199999999997 2 1|2 0.00000000000000000000 0.00000000000000000000 NA 2 2|3 1.61576075469784496974 0.15607113684416781818 10.3527199999999997 Pr(>|z|) 1 1|2 NA 1 2|3 < 2.22e-16 *** 2 1|2 NA 2 2|3 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error (Intercept) 1 0.73786225358709867095 0.13500906208906057748 (Intercept) 2 0.77255634837212872057 0.14063945843173736305 z value Pr(>|z|) (Intercept) 1 5.4652799999999999159 4.6218e-08 *** (Intercept) 2 5.4931700000000001083 3.9478e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.906373932662642656233 0.038916052675185490439 23.290489999999998361 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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 1 1|2 -0.90552506790495312927 0.18265647646917998470 -4.9575300000000002143 1 2|3 1.00420547521769010224 0.17467164336593621332 5.7491000000000003212 2 1|2 -0.90552506790495312927 0.18265647646917998470 -4.9575300000000002143 2 2|3 1.00420547521769010224 0.17467164336593621332 5.7491000000000003212 Pr(>|z|) 1 1|2 7.1395e-07 *** 1 2|3 8.9718e-09 *** 2 1|2 7.1395e-07 *** 2 2|3 8.9718e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.64793126338519113627 0.14153585035884308496 4.5778600000000002623 X2 1 -0.42893128334031871418 0.13989943737311180683 -3.0659999999999998366 Pr(>|z|) X1 1 4.6976e-06 *** X2 1 0.0021695 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error corr f21 1 2 0.736678597233847209935 0.178238394308690428769 corr f22 1 2 0.918298263052714447419 0.068858656199650286611 corr f23 1 2 0.837106119713037832852 0.131036082998424396884 z value Pr(>|z|) corr f21 1 2 4.1331100000000002836 3.5789e-05 *** corr f22 1 2 13.3359900000000006770 < 2.22e-16 *** corr f23 1 2 6.3883599999999995944 1.6767e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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, + link = mvlogit(df = 8L), + error.structure = cor_general(~1)) > #threshold.constraints = c(1,1), > #coef.constraints = c(1,1)) > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y, i, j) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~1), link = mvlogit(df = 8L)) Formula: MMO(Y, i, j) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvlogit flexible 100 2 -132.87 285.51 311.28 489 Thresholds: Estimate Std. Error z value 1 1|2 -1.61992919266584012306 0.33738755193354152961 -4.8013899999999996027 1 2|3 1.83247553193428514007 0.36742759194553598068 4.9873099999999999099 2 1|2 -1.61590358150649326952 0.33963206188857408829 -4.7578100000000000946 2 2|3 1.74613495493027071070 0.30112280645182398775 5.7987500000000000711 Pr(>|z|) 1 1|2 1.5757e-06 *** 1 2|3 6.1226e-07 *** 2 1|2 1.9571e-06 *** 2 2|3 6.6812e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 1.28924304054451899226 0.30395054778163360654 4.2416200000000001680 X1 2 0.88420478543597791354 0.29740834729385978719 2.9730300000000000615 X2 1 -0.84290995357526543597 0.30080364930704572846 -2.8021899999999999586 X2 2 -0.71568801844518059596 0.25697668743292467752 -2.7850299999999998946 Pr(>|z|) X1 1 2.2191e-05 *** X1 2 0.0029487 ** X2 1 0.0050756 ** X2 2 0.0053523 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.88389347246287641724 0.07117465756729765558 12.418649999999999523 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.6170817306633420, 1.7855897338762188, -1.6170817306633420, 1.7855897338762188), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$coefficients$Estimate, c(1.07242200717115987, 1.07242200717115987, -0.76715925377701732, -0.76715925377701732), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.85317690560688531), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.28997405649500174, 0.27427389826231802, 0.28997405649500174, 0.27427389826231802), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.24111402270822993, 0.24111402270822993, 0.24156664773225886, 0.24156664773225886), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.063316529381183581), tolerance = tolerance)) > # mvord:::check(all.equal(logLik(res), -135.41665313840898, tolerance = tolerance)) > # mvord:::check(all.equal(AIC(res), 281.35962206629165, tolerance = tolerance)) > # mvord:::check(all.equal(BIC(res), 295.07104409780789, tolerance = tolerance)) > > ################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cov_general(~1), + threshold.constraints = c(1,1), + threshold.values = list(c(-1,NA), + c(-1,NA)), + coef.constraints = c(1,1)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cov_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), threshold.values = list(c(-1, NA), c(-1, NA)), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit fix1first 100 2 -134.64 282.04 298.67 37 Thresholds: Estimate Std. Error z value 1 1|2 -1.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.08266798008347264748 0.24926043418153945308 4.3435199999999998255 2 1|2 -1.00000000000000000000 0.00000000000000000000 NA 2 2|3 1.08266798008347264748 0.24926043418153945308 4.3435199999999998255 Pr(>|z|) 1 1|2 NA 1 2|3 1.4022e-05 *** 2 1|2 NA 2 2|3 1.4022e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.68834946142116071321 0.15128036741855890868 4.5501599999999999824 X2 1 -0.45406517655044392745 0.15704134440910905157 -2.8913700000000002177 Pr(>|z|) X1 1 5.3606e-06 *** X2 1 0.0038356 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.856153637803035327813 0.061822221469868911259 13.8486399999999996169 sigma 1 1.001934583868995254363 0.185187960683942831608 5.4103700000000003456 sigma 2 1.089828199315897139243 0.197593289723884180109 5.5155099999999999127 Pr(>|z|) corr 1 2 < 2.22e-16 *** sigma 1 6.2896e-08 *** sigma 2 3.4777e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.000000000000000000000, 1.082667980083374503764, -1.000000000000000000000, 1.082667980083374503764), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6883494614209317852271, -0.4540651765505133163892), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8561536378031743277361, 1.0019345838689188710191, 1.0898281993157663549709), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.0000000000000000000000, 0.2492604341815170820862, 0.0000000000000000000000, 0.2492604341815170820862), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1512803674185349001036, 0.1570413444091093568833), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06182222146981963123435, 0.18518796068392143205905, 0.19759328972385112321852), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.6391112878561102661, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.0441800225207202857, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 298.6729258905298252103, tolerance = tolerance)) > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_equi(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(1,1),c(1,2))) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_equi(~1), link = mvprobit(), coef.constraints = cbind(c(1, 1), c(1, 2)), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -134.84 282.45 299.08 35 Thresholds: Estimate Std. Error z value 1 1|2 -0.96275665235849350321 0.16703865743956156087 -5.7636799999999999145 1 2|3 1.03388029135981107665 0.15203091606548349568 6.8004600000000001714 2 1|2 -0.96275665235849350321 0.16703865743956156087 -5.7636799999999999145 2 2|3 1.03388029135981107665 0.15203091606548349568 6.8004600000000001714 Pr(>|z|) 1 1|2 8.2301e-09 *** 1 2|3 1.0429e-11 *** 2 1|2 8.2301e-09 *** 2 2|3 1.0429e-11 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.63820467410984904610 0.13670492809261164391 4.6684799999999997411 X2 1 -0.44676561119570956659 0.15900879662663833236 -2.8096899999999997988 X2 2 -0.40750155519148029137 0.13850979189698683913 -2.9420399999999999885 Pr(>|z|) X1 1 3.0343e-06 *** X2 1 0.0049589 ** X2 2 0.0032606 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value (Intercept) 1.272900571254562907 0.232216118479298822 5.4815300000000002356 Pr(>|z|) (Intercept) 4.2165e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.9627566523584676350112, 1.0338802913596250032668, -0.9627566523584676350112, 1.0338802913596247812222), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6382046741095841468905, -0.4467656111955374820255, -0.4075015551913261924177), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$Estimate, c(1.272900571254629964457), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1670386574395647250046, 0.1520309160654948199554, 0.1670386574395647250046, 0.1520309160654948199554), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1367049280926301846328, 0.1590087966266460206555, 0.1385097918969951935608), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.2322161184793045674013), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.8432321319771745038, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.4524217107628487611, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 299.0811675787719536856, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_equi(~1), + threshold.constraints = c(1,1), + coef.constraints = list(X2 = cbind(c(1,1,0,0), c(0,0,1,1)), + X1 = 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)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_ar1(~ 1 + X1), + threshold.constraints = c(1,1), + coef.constraints = c(1,1)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_ar1(~1 + X1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -133.94 280.64 297.27 35 Thresholds: Estimate Std. Error z value 1 1|2 -0.95722951152620627813 0.16558288168118384664 -5.7809699999999999420 1 2|3 1.03746793968351225246 0.15306952616694896596 6.7777599999999997848 2 1|2 -0.95722951152620627813 0.16558288168118384664 -5.7809699999999999420 2 2|3 1.03746793968351225246 0.15306952616694896596 6.7777599999999997848 Pr(>|z|) 1 1|2 7.4272e-09 *** 1 2|3 1.2206e-11 *** 2 1|2 7.4272e-09 *** 2 2|3 1.2206e-11 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.65304208674295927128 0.13584016202002618945 4.8074300000000000921 X2 1 -0.42273136793587207105 0.13820217716269161956 -3.0587900000000001199 Pr(>|z|) X1 1 1.5288e-06 *** X2 1 0.0022223 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error (Intercept) 1.29891554197069947207 0.24517466007549018614 X1 0.29350892362873459707 0.29416988646860059431 z value Pr(>|z|) (Intercept) 5.29792000000000040671 1.1713e-07 *** X1 0.99775000000000002576 0.3184 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.9572295115261755249492, 1.0374679396833161870717, -0.9572295115261755249492, 1.0374679396833161870717), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6530420867428219366957, -0.4227313679354475217664), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(1.298915541971320308789, 0.293508923629326790028), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1655828816811988069002, 0.1530695261669812456962, 0.1655828816811988069002, 0.1530695261669812456962), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1358401620200463122412, 0.1382021771627104100855), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.2451746600755327076815, 0.2941698864686516090572), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -133.938827675498004055, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 280.6436127978045078635, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 297.272358665813612788, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_ar1(~1 + X1), + 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)) > > ######################################################################################## > res <- mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + X2, + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(1,2),c(NA,1))) > > res.summary <- summary(res, short = FALSE) Call: mvord(formula = MMO2(Y1, Y2) ~ 0 + X1 + X2, data = data_toy_example, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = cbind(c(1, 2), c(NA, 1)), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO2(Y1, Y2) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -137.65 288.06 304.69 63 Thresholds: Estimate Std. Error z value Y1 1|2 -0.89892942527351460402 0.16246077762271260436 -5.5332100000000004059 Y1 2|3 0.98413365940588137804 0.15981657213961378283 6.1578900000000000858 Y2 1|2 -0.89892942527351460402 0.16246077762271260436 -5.5332100000000004059 Y2 2|3 0.98413365940588148906 0.15981657213961378283 6.1578900000000000858 Pr(>|z|) Y1 1|2 3.1442e-08 *** Y1 2|3 7.3718e-10 *** Y2 1|2 3.1442e-08 *** Y2 2|3 7.3718e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.681944859288770910410 0.174961892922592010535 3.89767999999999981142 X1 2 0.468376583108602972949 0.157106006693615907199 2.98127999999999993008 X2 1 -0.052179801987810067732 0.089798215416072579842 -0.58108000000000004093 Pr(>|z|) X1 1 9.712e-05 *** X1 2 0.0028705 ** X2 1 0.5611876 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr Y1 Y2 0.890390657144698227654 0.063175533024007315963 14.09392000000000067 Pr(>|z|) corr Y1 Y2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.8989294252736504953205, 0.9841336594057152886705, -0.8989294252736503842982, 0.9841336594057153996928), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.68194485928859438494953, 0.46837658310856356003171, -0.05217980198794509860694), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8903906571446290607597), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1624607776227008359982, 0.1598165721396140603883, 0.1624607776227008359982, 0.1598165721396140603883), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.17496189292260000414103, 0.15710600669362786985239, 0.08979821541610534529898), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.0631755330240382911855), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -137.6494615446075613363, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 288.064880536023622426, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 304.6936264040327273506, tolerance = tolerance)) > > > res2 <- mvord::mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + X2, + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)), + X2 = matrix(c(rep(0,2),rep(1,2)), ncol = 1))) > > mvord:::check(all.equal(res$beta, res2$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res2$sebeta, tolerance = tolerance)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + offset(X2), + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + offset(X2), data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = list(X1 = cbind(c(1, 1, 0, 0), c(0, 0, 1, 1))), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + offset(X2) link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -194.33 403.71 423.31 78 Thresholds: Estimate Std. Error z value 1 1|2 -0.76726526230223290881 0.12023341892342831461 -6.3814599999999996882 1 2|3 0.89190483009970544792 0.13058942975202555981 6.8298399999999999110 2 1|2 -0.79675344626816624327 0.11172347359918627374 -7.1314799999999998192 2 2|3 0.87294080476112090317 0.13662238116423594536 6.3894399999999995643 Pr(>|z|) 1 1|2 1.7540e-10 *** 1 2|3 8.5010e-12 *** 2 1|2 9.9297e-13 *** 2 2|3 1.6649e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.53370081959011461681 0.13636430505431412774 3.9137900000000001022 X1 2 0.34385576067169915104 0.10634167794017658493 3.2334999999999998188 Pr(>|z|) X1 1 9.086e-05 *** X1 2 0.0012228 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.940808527820523377017 0.033697206769472437538 27.919480000000000075 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.7672652623027305107684, 0.8919048301000485068357, -0.7967534462687086982413, 0.8729408047614937160574), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.5337008195901541407480, 0.3438557606717420056519), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9408085278204662005308), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1202334189234334493879, 0.1305894297520299174309, 0.1117234735991832761393, 0.1366223811642423013879), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1363643050543318635537, 0.1063416779401736012023), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.03369720676949919391241), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -194.3258468555947047207, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 403.705457152049632441, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 423.314265003572927526, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1, + offset = list(df$X2[1:100], df$X2[101:200]), + data = df, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > > mvord:::check(all.equal(res$beta, res2$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res2$sebeta, tolerance = tolerance)) > > res3 <- mvord::mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + offset(X2), + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > mvord:::check(all.equal(res$beta, res3$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res3$sebeta, tolerance = tolerance)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvlogit(), + #solver = "newuoa", + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(NA, NA), c(1,2)), + coef.values = cbind(c(1, 1), c(NA,NA))) > #rho <- res$rho > > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~1), link = mvlogit(), coef.constraints = cbind(c(NA, NA), c(1, 2)), coef.values = cbind(c(1, 1), c(NA, NA)), threshold.constraints = c(1, 1)) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvlogit flexible 100 2 -135.52 281.57 295.28 180 Thresholds: Estimate Std. Error z value 1 1|2 -1.58328853691710325080 0.25851087521015303494 -6.1246499999999999275 1 2|3 1.75864257978098414981 0.24251595835343375818 7.2516600000000002169 2 1|2 -1.58328853691710325080 0.25851087521015303494 -6.1246499999999999275 2 2|3 1.75864257978098414981 0.24251595835343375818 7.2516600000000002169 Pr(>|z|) 1 1|2 9.0883e-10 *** 1 2|3 4.1170e-13 *** 2 1|2 9.0883e-10 *** 2 2|3 4.1170e-13 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X2 1 -0.77306066201133261107 0.26732809962259085346 -2.8917999999999999261 X2 2 -0.72430296230010837721 0.24403985402359068546 -2.9679700000000002191 Pr(>|z|) X2 1 0.0038304 ** X2 2 0.0029977 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.855894580949125072244 0.060599146841922621465 14.123870000000000147 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > tolerance2 <- 1e-4 > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.583288915548024533564, 1.758642501421955106622, -1.583288915548024533564, 1.758642501421955106622), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(-0.7730608423417825170176, -0.7243032675736262859800), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8558944465934688050623), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2585108482987530376107, 0.2425159370850978601819, 0.2585108482987530376107, 0.2425159370850978601819), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.2673280928737744588375, 0.2440398419906193439033), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06059919526643173237623), tolerance = tolerance2)) > mvord:::check(all.equal(logLik(res)[[1]], -135.5210996495467554723, tolerance = tolerance2)) > mvord:::check(all.equal(AIC(res), 281.568515088567210114, tolerance = tolerance2)) > mvord:::check(all.equal(BIC(res), 295.2799371200834457341, tolerance = tolerance2)) > > # res1 <- mvord::mvord(formula = MMO(Y) ~ 1 + X1 + X2, > # data = df, > # index = c("i", "j"), > # link = mvprobit(), > # solver = "BFGS", > # se = TRUE, > # error.structure = cor_equi(~1), > # threshold.constraints = c(1,1), > # coef.constraints = list(Intercept = matrix(rep(1,6), ncol = 1), > # X2 = cbind(c(1,1,1,0,0,0), c(0,0,0,1,1,1)), X1 = matrix(rep(1,6), ncol = 1))) > > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X3, + 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)) > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X3, data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X3 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -136.05 284.87 301.5 34 Thresholds: Estimate Std. Error z value 1 1|2 -1.21270698725037129329 0.21131407873814866960 -5.7388799999999999812 1 2|3 0.75845153901176631805 0.18860790313554207098 4.0213099999999997181 2 1|2 -1.21270698725037129329 0.21131407873814866960 -5.7388799999999999812 2 2|3 0.75845153901176631805 0.18860790313554207098 4.0213099999999997181 Pr(>|z|) 1 1|2 9.5302e-09 *** 1 2|3 5.7874e-05 *** 2 1|2 9.5302e-09 *** 2 2|3 5.7874e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error X1 1 0.582346304092164257504 0.133874274950955496344 X3(-0.2,0.2] 1 0.065949564660296139396 0.394250784463485104414 X3(0.2, Inf] 1 -0.639867558058156649103 0.239596299509497845381 z value Pr(>|z|) X1 1 4.34994999999999976126 1.3617e-05 *** X3(-0.2,0.2] 1 0.16728000000000001202 0.8671512 X3(0.2, Inf] 1 -2.67060999999999992838 0.0075714 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.857975765661059597278 0.062391829886098891522 13.751409999999999911 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.212706987250618206886, 0.758451539011639419563, -1.212706987250618206886, 0.758451539011639419563), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.58234630409261545214150, 0.06594956465951176682871, -0.63986755805831896370961), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8579757656611409766256), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2113140787381464491546, 0.1886079031355630819533, 0.2113140787381464491546, 0.1886079031355630819533), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1338742749509412854891, 0.3942507844634823288565, 0.2395962995094961522913), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06239182988606906121731), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -136.0526219854373835005, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 284.8712014176832667545, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 301.499947285692371679, tolerance = tolerance)) > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 1 + 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), + threshold.values = list(c(-1,NA), + c(-1,NA)), + coef.constraints = c(1,1)) > res.summary <- summary(res, short = TRUE) Call: mvord::mvord(formula = MMO(Y) ~ 1 + X1 * X2, data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), threshold.values = list(c(-1, NA), c(-1, NA)), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 1 + X1 * X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit fix1first 100 2 -134.63 282.02 298.65 34 Thresholds: Estimate Std. Error z value 1 1|2 -1.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.00269513578732416548 0.22781659168150072969 4.4013299999999997425 Pr(>|z|) 1 1|2 NA 1 2|3 1.0759e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error (Intercept) 1 -0.021913582738025384755 0.167100624889530591233 X1 1 0.621621046245967145971 0.138540865251019801319 X2 1 -0.427624354284268537452 0.140667605271754703189 X1:X2 1 -0.102567255999721287929 0.150381573286269054623 z value Pr(>|z|) (Intercept) 1 -0.13114000000000000656 0.8956645 X1 1 4.48690999999999995396 7.2262e-06 *** X2 1 -3.03996000000000021757 0.0023661 ** X1:X2 1 -0.68205000000000004512 0.4952094 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.853574805224538435411 0.063090989221389948138 13.529270000000000351 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.000000000000000000000, 1.002695135787324165477), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(-0.02191358273802538475516, 0.62162104624596714597118, -0.42762435428426853745165, -0.10256725599972128792903), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8535748052245384354109), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.0000000000000000000000, 0.2278165916815008962271), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1671006248895306467439, 0.1385408652510198845853, 0.1406676052717547309445, 0.1503815732862690546234), tolerance = tolerance)) > #mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.063097735777156036), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06309098922138993426056), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.6255603757719541136, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.0170781983524079806, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 298.6458240663615129051, tolerance = tolerance)) > ######################################################################################## > df_NA <- df[-c(1,90:110),] > > > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_NA, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 99 2 -119.45 258.71 284.4 51 Thresholds: Estimate Std. Error z value 1 1|2 -1.02012637737389844084 0.19996641229614070534 -5.1014900000000000801 1 2|3 1.14180364925262156639 0.22379090693934000633 5.1021000000000000796 2 1|2 -0.90662822300351997296 0.19059651595704024674 -4.7567899999999996297 2 2|3 0.99945117269173178176 0.17403069740197851800 5.7429600000000000648 Pr(>|z|) 1 1|2 3.3699e-07 *** 1 2|3 3.3590e-07 *** 2 1|2 1.9669e-06 *** 2 2|3 9.3036e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.83733616646617137214 0.18898470050444338142 4.4307100000000003703 X1 2 0.49821075302607176205 0.16630384260854050305 2.9957899999999999530 X2 1 -0.44740279449456488159 0.18763575165139662060 -2.3844199999999999839 X2 2 -0.35390389963374180304 0.14489624593604932823 -2.4424600000000000755 Pr(>|z|) X1 1 9.3924e-06 *** X1 2 0.0027374 ** X2 1 0.0171060 * X2 2 0.0145874 * --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.910650307821128435215 0.070553566078478416324 12.907220000000000582 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.0201263773742383911269, 1.1418036492524186176212, -0.9066282230038859024646, 0.9994511726914282467860), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8373361664658567349306, 0.4982107530258053085248, -0.4474027944949834356692, -0.3539038996339812781500), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9106503078209118307029), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1999664122961394840949, 0.2237909069393826111405, 0.1905965159570501277209, 0.1740306974019930341679), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1889847005044749950198, 0.1663038426085674814647, 0.1876357516513920686840, 0.1448962459360401411335), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.07055356607861483497768), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -119.4526280916837492896, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 258.7052561833675099479, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 284.3969426996999345647, tolerance = tolerance)) > > #weights > df_NA$weights <- 0.5 > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + weights.name = "weights", + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_NA, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), weights.name = "weights") Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 99 2 -59.73 139.25 164.94 470 Thresholds: Estimate Std. Error z value 1 1|2 -1.02012812480871528642 0.39993316222628882972 -2.5507499999999998508 1 2|3 1.14180477101864741307 0.44758335787565117769 2.5510399999999999743 2 1|2 -0.90661610117580127000 0.38119353284182333486 -2.3783599999999998076 2 2|3 0.99945811052964006471 0.34806068555282732024 2.8715099999999997848 Pr(>|z|) 1 1|2 0.0107492 * 1 2|3 0.0107401 * 2 1|2 0.0173898 * 2 2|3 0.0040852 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.83733318754043106757 0.37797050239240559399 2.2153399999999998649 X1 2 0.49821357229097545938 0.33260837571971485493 1.4979000000000000092 X2 1 -0.44740660005602911342 0.37527222777998581194 -1.1922200000000000575 X2 2 -0.35390625839926942442 0.28979246676291725571 -1.2212400000000001032 Pr(>|z|) X1 1 0.026737 * X1 2 0.134160 X2 1 0.233175 X2 2 0.221995 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.91064682418431319721 0.14111087043920636508 6.4534099999999998687 Pr(>|z|) corr 1 2 1.0936e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.0201283793713198377873, 1.1418048707357395521456, -0.9066161533747665313143, 0.9994581570190742558779), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8373332969208180376341, 0.4982136050008418859392, -0.4474066175154422508875, -0.3539061566757252808024), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9106469196938988819312), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.3999331442401471981007, 0.4475833313547766811880, 0.3811935020996289336104, 0.3480606771313752845209), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.3779704499331774103510, 0.3326083385001772918521, 0.3752721890043577146479, 0.2897924558296670061175), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.1411107414052604758226), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -59.72631403934757088336, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 139.2526280786951531354, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 164.944314595027606174, tolerance = tolerance)) > ########################################################################################## > df_23 <- df > > ##For the first response (first 100 obs), replace the level 3 by 2. > ## Now the first response has 2 levels and the second one 3 levels > df_23$Y[which(df_23$Y[1:100] == 3)] <- 2 > > ## Must be converted to integer. Ordered factor is not OK, as we have diff number of responses. > df_23$Y <- as.integer(df_23$Y) > > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_23, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_23, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -109.15 235.69 258.34 52 Thresholds: Estimate Std. Error z value 1 1|2 -0.97243369041145588660 0.20101574846710046351 -4.8376000000000001222 2 1|2 -0.97734151029783122855 0.18730956260707903871 -5.2177899999999999281 2 2|3 1.01224642882576909564 0.15713428754508013130 6.4419199999999996464 Pr(>|z|) 1 1|2 1.3142e-06 *** 2 1|2 1.8107e-07 *** 2 2|3 1.1797e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.82969552084031761297 0.22409294296771067878 3.7024599999999998623 X1 2 0.53332636576341019286 0.14638351173003005812 3.6433499999999998664 X2 1 -0.39479319852757205345 0.18931396166552202920 -2.0853899999999998549 X2 2 -0.38625976505564324492 0.13976399874801781475 -2.7636599999999997834 Pr(>|z|) X1 1 0.00021352 *** X1 2 0.00026911 *** X2 1 0.03703403 * X2 2 0.00571576 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.85295804978384348605 0.10226978918638686411 8.3402700000000002944 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > > mvord:::check(all.equal(res.summary$thresholds$Estimate, + c(-0.9724336904108278334391, -0.9773415102989740921302, 1.0122464288213952610107), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8296955208405573101160, 0.5333263657626993170524, -0.3947931985275920929723, -0.3862597650564197349077), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8529580497839671648919), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2010157484670624383760, 0.1873095626070425123721, 0.1571342875452053644558), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.2240929429677874784588, 0.1463835117300714416810, 0.1893139616655838686210, 0.1397639987481304746364), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.1022697891863128538681), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -109.147957798495554016, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 235.6872199448172011671, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 258.3408737360180111864, tolerance = tolerance)) > > ########################################################################################## > ## make three responses > suppressWarnings(RNGversion("3.5.0")) > set.seed(100) > Y3 <- sample(1:3, nobs, replace = TRUE) > dat_3 <- cbind(Y3, data_toy_example) > res <- mvord::mvord(formula = MMO2(Y1, Y2, Y3) ~ 0, + data = dat_3, + link = mvprobit(), + error.structure = cor_general(~1), + control= mvord.control(solver="BFGS",se=TRUE)) Warning message: Responses are unordered. Natural ordering is used. > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO2(Y1, Y2, Y3) ~ 0, data = dat_3, error.structure = cor_general(~1), link = mvprobit(), control = mvord.control(solver = "BFGS", se = TRUE)) Formula: MMO2(Y1, Y2, Y3) ~ 0 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 3 -565.19 1163.2 1205.96 52 Thresholds: Estimate Std. Error z value Y1 1|2 -0.70654808839442972968 0.14413615638980573075 -4.9019500000000002515 Y1 2|3 0.84166389562761123599 0.15094934798831763367 5.5758000000000000895 Y2 1|2 -0.80564017944257926285 0.14777311388303038253 -5.4518700000000004380 Y2 2|3 0.87834342403448395498 0.15259796098861780345 5.7559300000000002129 Y3 1|2 -0.52550677773958742733 0.13805473124275705055 -3.8065099999999998381 Y3 2|3 0.43872841951737284738 0.13625729487946994234 3.2198500000000001009 Pr(>|z|) Y1 1|2 9.4890e-07 *** Y1 2|3 2.4639e-08 *** Y2 1|2 4.9842e-08 *** Y2 2|3 8.6165e-09 *** Y3 1|2 0.00014094 *** Y3 2|3 0.00128256 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value Pr(>|z|) Error Structure: Estimate Std. Error corr Y1 Y2 0.908534877536116503016 0.039421737990092485526 corr Y1 Y3 -0.068886066523438385656 0.133978933777760100821 corr Y2 Y3 -0.150586382344864100347 0.129319546675897428800 z value Pr(>|z|) corr Y1 Y2 23.0465499999999998693 < 2e-16 *** corr Y1 Y3 -0.5141599999999999504 0.60714 corr Y2 Y3 -1.1644499999999999851 0.24424 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > > mvord:::check(all.equal(res.summary$thresholds$Estimate, + c(-0.70654808839454852354, 0.84166389562778798350 ,-0.80564017944211274713, + 0.87834342403465937021, -0.52550677773899212575, 0.43872841951666374793), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, + c(0.908534877536098850470 , -0.068886066520331828977, -0.150586382347683067628), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, + c(0.14413615638981053246, 0.15094934798830694778, 0.14777311388303066009, + 0.15259796098859162994, 0.13805473124275577379, 0.13625729487947765839), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.039421737990101658744,0.133978933777893494117,0.129319546675785962409), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -565.1857975044365502981, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 1163.199625517649110407, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 1205.960928690734590418, tolerance = tolerance)) > ########################################## > ### fixed coefs fixed thresholds > ########################################### > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.values = list(c(-1,1), c(-1,1)), + coef.values = matrix(c(0.8,-0.5, 0.8,-0.5),ncol=2, byrow=TRUE), + control= mvord.control(solver="BFGS",se=TRUE)) We suggest to include an intercept in the model (formula = y ~ 1 + ...)Error in rho[["constraints_mat"]] %*% par_beta : non-conformable arguments Error in optimx.check(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower, : Cannot evaluate function at initial parameters Calls: <Anonymous> -> mvord.fit Execution halted Flavor: r-devel-linux-x86_64-debian-clang

Version: 1.1.1
Check: tests
Result: ERROR Running ‘check_methods.R’ [4s/5s] 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’ [25s/39s] Running ‘check_transf_sigmas.R’ [2s/3s] Running ‘check_transf_thresholds.R’ [2s/3s] 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 > suppressWarnings(RNGversion("3.5.0")) > 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 = FALSE), + "f2" = factor(rep(data_toy_example$Y1,2), ordered = FALSE), + w = rep(w,2)) > df$X3 <- cut(df$X2, c(-Inf, -0.2, 0.2, Inf)) > > > > # 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, + link = mvprobit(), + 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=TRUE)) 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. > options(digits = 22) > > 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 = TRUE)) 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 1 1|2 -0.96257386663499888702 0.16613952738603396386 -5.7937700000000003087 1 2|3 1.03347036873238828925 0.15004482537615168591 6.8877399999999999736 2 1|2 -0.96257386663499888702 0.16613952738603396386 -5.7937700000000003087 2 2|3 1.03347036873238828925 0.15004482537615168591 6.8877399999999999736 Pr(>|z|) 1 1|2 6.8825e-09 *** 1 2|3 5.6684e-12 *** 2 1|2 6.8825e-09 *** 2 2|3 5.6684e-12 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.63801035062442590373 0.13576747301354935571 4.6992900000000004113 X2 1 -0.42672524816265555714 0.13643665802445156809 -3.1276399999999999757 Pr(>|z|) X1 1 2.6107e-06 *** X2 1 0.0017621 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.854266728221043991631 0.062440889990424582046 13.681210000000000093 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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"), + 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, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + control= mvord.control(solver="BFGS",se=TRUE)) > 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 = TRUE)) 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 1 1|2 -0.75479706538162727458 0.13105603927552006427 -5.7593500000000004135 1 2|3 0.86086304364912058507 0.13360642334434574829 6.4432799999999996743 2 1|2 -0.75479706538162727458 0.13105603927552006427 -5.7593500000000004135 2 2|3 0.86086304364912058507 0.13360642334434574829 6.4432799999999996743 Pr(>|z|) 1 1|2 8.4440e-09 *** 1 2|3 1.1692e-10 *** 2 1|2 8.4440e-09 *** 2 2|3 1.1692e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value Pr(>|z|) Error Structure: Estimate Std. Error z value corr 1 2 0.905795171446388658332 0.038855435949046335242 23.311930000000000263 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + control= mvord.control(solver="BFGS",se=TRUE)) 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 = TRUE)) 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 1 1|2 0.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.61576075469784496974 0.15607113684416781818 10.3527199999999997 2 1|2 0.00000000000000000000 0.00000000000000000000 NA 2 2|3 1.61576075469784496974 0.15607113684416781818 10.3527199999999997 Pr(>|z|) 1 1|2 NA 1 2|3 < 2.22e-16 *** 2 1|2 NA 2 2|3 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error (Intercept) 1 0.73786225358709867095 0.13500906208906057748 (Intercept) 2 0.77255634837212872057 0.14063945843173736305 z value Pr(>|z|) (Intercept) 1 5.4652799999999999159 4.6218e-08 *** (Intercept) 2 5.4931700000000001083 3.9478e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.906373932662642656233 0.038916052675185490439 23.290489999999998361 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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 1 1|2 -0.90552506790495312927 0.18265647646917998470 -4.9575300000000002143 1 2|3 1.00420547521769010224 0.17467164336593621332 5.7491000000000003212 2 1|2 -0.90552506790495312927 0.18265647646917998470 -4.9575300000000002143 2 2|3 1.00420547521769010224 0.17467164336593621332 5.7491000000000003212 Pr(>|z|) 1 1|2 7.1395e-07 *** 1 2|3 8.9718e-09 *** 2 1|2 7.1395e-07 *** 2 2|3 8.9718e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.64793126338519113627 0.14153585035884308496 4.5778600000000002623 X2 1 -0.42893128334031871418 0.13989943737311180683 -3.0659999999999998366 Pr(>|z|) X1 1 4.6976e-06 *** X2 1 0.0021695 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error corr f21 1 2 0.736678597233847209935 0.178238394308690428769 corr f22 1 2 0.918298263052714447419 0.068858656199650286611 corr f23 1 2 0.837106119713037832852 0.131036082998424396884 z value Pr(>|z|) corr f21 1 2 4.1331100000000002836 3.5789e-05 *** corr f22 1 2 13.3359900000000006770 < 2.22e-16 *** corr f23 1 2 6.3883599999999995944 1.6767e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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, + link = mvlogit(df = 8L), + error.structure = cor_general(~1)) > #threshold.constraints = c(1,1), > #coef.constraints = c(1,1)) > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y, i, j) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~1), link = mvlogit(df = 8L)) Formula: MMO(Y, i, j) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvlogit flexible 100 2 -132.87 285.51 311.28 511 Thresholds: Estimate Std. Error z value 1 1|2 -1.61992786233870722512 0.33738750771603759349 -4.8013899999999996027 1 2|3 1.83247518660670660751 0.36742755631687890050 4.9873099999999999099 2 1|2 -1.61590337284521257111 0.33963209828825563497 -4.7578100000000000946 2 2|3 1.74613536577869354893 0.30112279718858919741 5.7987500000000000711 Pr(>|z|) 1 1|2 1.5757e-06 *** 1 2|3 6.1226e-07 *** 2 1|2 1.9571e-06 *** 2 2|3 6.6812e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 1.28924231700551916724 0.30395058932048724110 4.2416200000000001680 X1 2 0.88420505931337933792 0.29740837588461088714 2.9730300000000000615 X2 1 -0.84290987603267142347 0.30080366324077506546 -2.8021899999999999586 X2 2 -0.71568836854213746523 0.25697671764104856873 -2.7850299999999998946 Pr(>|z|) X1 1 2.2191e-05 *** X1 2 0.0029487 ** X2 1 0.0050757 ** X2 2 0.0053522 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.883893508117684856273 0.071174638678112481238 12.418659999999999144 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.6170817306633420, 1.7855897338762188, -1.6170817306633420, 1.7855897338762188), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$coefficients$Estimate, c(1.07242200717115987, 1.07242200717115987, -0.76715925377701732, -0.76715925377701732), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.85317690560688531), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.28997405649500174, 0.27427389826231802, 0.28997405649500174, 0.27427389826231802), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.24111402270822993, 0.24111402270822993, 0.24156664773225886, 0.24156664773225886), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.063316529381183581), tolerance = tolerance)) > # mvord:::check(all.equal(logLik(res), -135.41665313840898, tolerance = tolerance)) > # mvord:::check(all.equal(AIC(res), 281.35962206629165, tolerance = tolerance)) > # mvord:::check(all.equal(BIC(res), 295.07104409780789, tolerance = tolerance)) > > ################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cov_general(~1), + threshold.constraints = c(1,1), + threshold.values = list(c(-1,NA), + c(-1,NA)), + coef.constraints = c(1,1)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cov_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), threshold.values = list(c(-1, NA), c(-1, NA)), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit fix1first 100 2 -134.64 282.04 298.67 37 Thresholds: Estimate Std. Error z value 1 1|2 -1.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.08266798008332409964 0.24926043418148299824 4.3435199999999998255 2 1|2 -1.00000000000000000000 0.00000000000000000000 NA 2 2|3 1.08266798008332409964 0.24926043418148299824 4.3435199999999998255 Pr(>|z|) 1 1|2 NA 1 2|3 1.4022e-05 *** 2 1|2 NA 2 2|3 1.4022e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.68834946142083863752 0.15128036741851591529 4.5501599999999999824 X2 1 -0.45406517655023831415 0.15704134440906966641 -2.8913700000000002177 Pr(>|z|) X1 1 5.3606e-06 *** X2 1 0.0038356 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.856153637803131029038 0.061822221469835146601 13.8486399999999996169 sigma 1 1.001934583868862471689 0.185187960683899310865 5.4103700000000003456 sigma 2 1.089828199315680645753 0.197593289723817816528 5.5155099999999999127 Pr(>|z|) corr 1 2 < 2.22e-16 *** sigma 1 6.2896e-08 *** sigma 2 3.4777e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.000000000000000000000, 1.082667980083374503764, -1.000000000000000000000, 1.082667980083374503764), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6883494614209317852271, -0.4540651765505133163892), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8561536378031743277361, 1.0019345838689188710191, 1.0898281993157663549709), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.0000000000000000000000, 0.2492604341815170820862, 0.0000000000000000000000, 0.2492604341815170820862), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1512803674185349001036, 0.1570413444091093568833), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06182222146981963123435, 0.18518796068392143205905, 0.19759328972385112321852), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.6391112878561102661, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.0441800225207202857, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 298.6729258905298252103, tolerance = tolerance)) > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_equi(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(1,1),c(1,2))) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_equi(~1), link = mvprobit(), coef.constraints = cbind(c(1, 1), c(1, 2)), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -134.84 282.45 299.08 35 Thresholds: Estimate Std. Error z value 1 1|2 -0.96275665235849350321 0.16703865743956156087 -5.7636799999999999145 1 2|3 1.03388029135981107665 0.15203091606548349568 6.8004600000000001714 2 1|2 -0.96275665235849350321 0.16703865743956156087 -5.7636799999999999145 2 2|3 1.03388029135981107665 0.15203091606548349568 6.8004600000000001714 Pr(>|z|) 1 1|2 8.2301e-09 *** 1 2|3 1.0429e-11 *** 2 1|2 8.2301e-09 *** 2 2|3 1.0429e-11 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.63820467410984904610 0.13670492809261164391 4.6684799999999997411 X2 1 -0.44676561119570956659 0.15900879662663833236 -2.8096899999999997988 X2 2 -0.40750155519148029137 0.13850979189698683913 -2.9420399999999999885 Pr(>|z|) X1 1 3.0343e-06 *** X2 1 0.0049589 ** X2 2 0.0032606 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value (Intercept) 1.272900571254562907 0.232216118479298822 5.4815300000000002356 Pr(>|z|) (Intercept) 4.2165e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.9627566523584676350112, 1.0338802913596250032668, -0.9627566523584676350112, 1.0338802913596247812222), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6382046741095841468905, -0.4467656111955374820255, -0.4075015551913261924177), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$Estimate, c(1.272900571254629964457), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1670386574395647250046, 0.1520309160654948199554, 0.1670386574395647250046, 0.1520309160654948199554), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1367049280926301846328, 0.1590087966266460206555, 0.1385097918969951935608), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.2322161184793045674013), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.8432321319771745038, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.4524217107628487611, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 299.0811675787719536856, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_equi(~1), + threshold.constraints = c(1,1), + coef.constraints = list(X2 = cbind(c(1,1,0,0), c(0,0,1,1)), + X1 = 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)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_ar1(~ 1 + X1), + threshold.constraints = c(1,1), + coef.constraints = c(1,1)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_ar1(~1 + X1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -133.94 280.64 297.27 35 Thresholds: Estimate Std. Error z value 1 1|2 -0.95722951152620627813 0.16558288168118384664 -5.7809699999999999420 1 2|3 1.03746793968351225246 0.15306952616694896596 6.7777599999999997848 2 1|2 -0.95722951152620627813 0.16558288168118384664 -5.7809699999999999420 2 2|3 1.03746793968351225246 0.15306952616694896596 6.7777599999999997848 Pr(>|z|) 1 1|2 7.4272e-09 *** 1 2|3 1.2206e-11 *** 2 1|2 7.4272e-09 *** 2 2|3 1.2206e-11 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.65304208674295927128 0.13584016202002618945 4.8074300000000000921 X2 1 -0.42273136793587207105 0.13820217716269161956 -3.0587900000000001199 Pr(>|z|) X1 1 1.5288e-06 *** X2 1 0.0022223 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error (Intercept) 1.29891554197069947207 0.24517466007549018614 X1 0.29350892362873459707 0.29416988646860059431 z value Pr(>|z|) (Intercept) 5.29792000000000040671 1.1713e-07 *** X1 0.99775000000000002576 0.3184 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.9572295115261755249492, 1.0374679396833161870717, -0.9572295115261755249492, 1.0374679396833161870717), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6530420867428219366957, -0.4227313679354475217664), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(1.298915541971320308789, 0.293508923629326790028), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1655828816811988069002, 0.1530695261669812456962, 0.1655828816811988069002, 0.1530695261669812456962), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1358401620200463122412, 0.1382021771627104100855), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.2451746600755327076815, 0.2941698864686516090572), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -133.938827675498004055, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 280.6436127978045078635, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 297.272358665813612788, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_ar1(~1 + X1), + 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)) > > ######################################################################################## > res <- mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + X2, + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(1,2),c(NA,1))) > > res.summary <- summary(res, short = FALSE) Call: mvord(formula = MMO2(Y1, Y2) ~ 0 + X1 + X2, data = data_toy_example, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = cbind(c(1, 2), c(NA, 1)), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO2(Y1, Y2) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -137.65 288.06 304.69 63 Thresholds: Estimate Std. Error z value Y1 1|2 -0.89892942527347374781 0.16246077762270585976 -5.5332100000000004059 Y1 2|3 0.98413365940588914960 0.15981657213960923092 6.1578900000000000858 Y2 1|2 -0.89892942527347374781 0.16246077762270585976 -5.5332100000000004059 Y2 2|3 0.98413365940588914960 0.15981657213960923092 6.1578900000000000858 Pr(>|z|) Y1 1|2 3.1442e-08 *** Y1 2|3 7.3718e-10 *** Y2 1|2 3.1442e-08 *** Y2 2|3 7.3718e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.681944859289025373528 0.174961892922584016929 3.89767999999999981142 X1 2 0.468376583108783883791 0.157106006693618127645 2.98127999999999993008 X2 1 -0.052179801987866043789 0.089798215416094520624 -0.58108000000000004093 Pr(>|z|) X1 1 9.712e-05 *** X1 2 0.0028705 ** X2 1 0.5611876 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr Y1 Y2 0.890390657144648600685 0.063175533024032046181 14.09392000000000067 Pr(>|z|) corr Y1 Y2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.8989294252736504953205, 0.9841336594057152886705, -0.8989294252736503842982, 0.9841336594057153996928), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.68194485928859438494953, 0.46837658310856356003171, -0.05217980198794509860694), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8903906571446290607597), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1624607776227008359982, 0.1598165721396140603883, 0.1624607776227008359982, 0.1598165721396140603883), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.17496189292260000414103, 0.15710600669362786985239, 0.08979821541610534529898), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.0631755330240382911855), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -137.6494615446075613363, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 288.064880536023622426, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 304.6936264040327273506, tolerance = tolerance)) > > > res2 <- mvord::mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + X2, + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)), + X2 = matrix(c(rep(0,2),rep(1,2)), ncol = 1))) > > mvord:::check(all.equal(res$beta, res2$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res2$sebeta, tolerance = tolerance)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + offset(X2), + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + offset(X2), data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = list(X1 = cbind(c(1, 1, 0, 0), c(0, 0, 1, 1))), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + offset(X2) link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -194.33 403.71 423.31 78 Thresholds: Estimate Std. Error z value 1 1|2 -0.76726526230223290881 0.12023341892342831461 -6.3814599999999996882 1 2|3 0.89190483009970544792 0.13058942975202555981 6.8298399999999999110 2 1|2 -0.79675344626816624327 0.11172347359918627374 -7.1314799999999998192 2 2|3 0.87294080476112090317 0.13662238116423594536 6.3894399999999995643 Pr(>|z|) 1 1|2 1.7540e-10 *** 1 2|3 8.5010e-12 *** 2 1|2 9.9297e-13 *** 2 2|3 1.6649e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.53370081959011461681 0.13636430505431412774 3.9137900000000001022 X1 2 0.34385576067169915104 0.10634167794017658493 3.2334999999999998188 Pr(>|z|) X1 1 9.086e-05 *** X1 2 0.0012228 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.940808527820523377017 0.033697206769472437538 27.919480000000000075 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.7672652623027305107684, 0.8919048301000485068357, -0.7967534462687086982413, 0.8729408047614937160574), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.5337008195901541407480, 0.3438557606717420056519), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9408085278204662005308), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1202334189234334493879, 0.1305894297520299174309, 0.1117234735991832761393, 0.1366223811642423013879), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1363643050543318635537, 0.1063416779401736012023), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.03369720676949919391241), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -194.3258468555947047207, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 403.705457152049632441, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 423.314265003572927526, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1, + offset = list(df$X2[1:100], df$X2[101:200]), + data = df, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > > mvord:::check(all.equal(res$beta, res2$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res2$sebeta, tolerance = tolerance)) > > res3 <- mvord::mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + offset(X2), + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > mvord:::check(all.equal(res$beta, res3$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res3$sebeta, tolerance = tolerance)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvlogit(), + #solver = "newuoa", + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(NA, NA), c(1,2)), + coef.values = cbind(c(1, 1), c(NA,NA))) > #rho <- res$rho > > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~1), link = mvlogit(), coef.constraints = cbind(c(NA, NA), c(1, 2)), coef.values = cbind(c(1, 1), c(NA, NA)), threshold.constraints = c(1, 1)) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvlogit flexible 100 2 -135.52 281.57 295.28 185 Thresholds: Estimate Std. Error z value 1 1|2 -1.58328918795447060042 0.25851088281309753114 -6.1246499999999999275 1 2|3 1.75864230623915296370 0.24251597104480449030 7.2516600000000002169 2 1|2 -1.58328918795447060042 0.25851088281309753114 -6.1246499999999999275 2 2|3 1.75864230623915296370 0.24251597104480449030 7.2516600000000002169 Pr(>|z|) 1 1|2 9.0882e-10 *** 1 2|3 4.1171e-13 *** 2 1|2 9.0882e-10 *** 2 2|3 4.1171e-13 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X2 1 -0.77306088543480555586 0.26732808892679288393 -2.8918099999999999916 X2 2 -0.72430317045670444820 0.24403984738634890150 -2.9679700000000002191 Pr(>|z|) X2 1 0.0038303 ** X2 2 0.0029977 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.855894638731551027355 0.060599125316657634355 14.123879999999999768 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > tolerance2 <- 1e-4 > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.583288915548024533564, 1.758642501421955106622, -1.583288915548024533564, 1.758642501421955106622), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(-0.7730608423417825170176, -0.7243032675736262859800), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8558944465934688050623), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2585108482987530376107, 0.2425159370850978601819, 0.2585108482987530376107, 0.2425159370850978601819), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.2673280928737744588375, 0.2440398419906193439033), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06059919526643173237623), tolerance = tolerance2)) > mvord:::check(all.equal(logLik(res)[[1]], -135.5210996495467554723, tolerance = tolerance2)) > mvord:::check(all.equal(AIC(res), 281.568515088567210114, tolerance = tolerance2)) > mvord:::check(all.equal(BIC(res), 295.2799371200834457341, tolerance = tolerance2)) > > # res1 <- mvord::mvord(formula = MMO(Y) ~ 1 + X1 + X2, > # data = df, > # index = c("i", "j"), > # link = mvprobit(), > # solver = "BFGS", > # se = TRUE, > # error.structure = cor_equi(~1), > # threshold.constraints = c(1,1), > # coef.constraints = list(Intercept = matrix(rep(1,6), ncol = 1), > # X2 = cbind(c(1,1,1,0,0,0), c(0,0,0,1,1,1)), X1 = matrix(rep(1,6), ncol = 1))) > > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X3, + 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)) > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X3, data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X3 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -136.05 284.87 301.5 34 Thresholds: Estimate Std. Error z value 1 1|2 -1.21270698725037129329 0.21131407873814866960 -5.7388799999999999812 1 2|3 0.75845153901176631805 0.18860790313554207098 4.0213099999999997181 2 1|2 -1.21270698725037129329 0.21131407873814866960 -5.7388799999999999812 2 2|3 0.75845153901176631805 0.18860790313554207098 4.0213099999999997181 Pr(>|z|) 1 1|2 9.5302e-09 *** 1 2|3 5.7874e-05 *** 2 1|2 9.5302e-09 *** 2 2|3 5.7874e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error X1 1 0.582346304092164257504 0.133874274950955496344 X3(-0.2,0.2] 1 0.065949564660296139396 0.394250784463485104414 X3(0.2, Inf] 1 -0.639867558058156649103 0.239596299509497845381 z value Pr(>|z|) X1 1 4.34994999999999976126 1.3617e-05 *** X3(-0.2,0.2] 1 0.16728000000000001202 0.8671512 X3(0.2, Inf] 1 -2.67060999999999992838 0.0075714 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.857975765661059597278 0.062391829886098891522 13.751409999999999911 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.212706987250618206886, 0.758451539011639419563, -1.212706987250618206886, 0.758451539011639419563), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.58234630409261545214150, 0.06594956465951176682871, -0.63986755805831896370961), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8579757656611409766256), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2113140787381464491546, 0.1886079031355630819533, 0.2113140787381464491546, 0.1886079031355630819533), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1338742749509412854891, 0.3942507844634823288565, 0.2395962995094961522913), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06239182988606906121731), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -136.0526219854373835005, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 284.8712014176832667545, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 301.499947285692371679, tolerance = tolerance)) > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 1 + 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), + threshold.values = list(c(-1,NA), + c(-1,NA)), + coef.constraints = c(1,1)) > res.summary <- summary(res, short = TRUE) Call: mvord::mvord(formula = MMO(Y) ~ 1 + X1 * X2, data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), threshold.values = list(c(-1, NA), c(-1, NA)), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 1 + X1 * X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit fix1first 100 2 -134.63 282.02 298.65 34 Thresholds: Estimate Std. Error z value 1 1|2 -1.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.00269513578732416548 0.22781659168150072969 4.4013299999999997425 Pr(>|z|) 1 1|2 NA 1 2|3 1.0759e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error (Intercept) 1 -0.021913582738025384755 0.167100624889530591233 X1 1 0.621621046245967145971 0.138540865251019801319 X2 1 -0.427624354284268537452 0.140667605271754703189 X1:X2 1 -0.102567255999721287929 0.150381573286269054623 z value Pr(>|z|) (Intercept) 1 -0.13114000000000000656 0.8956645 X1 1 4.48690999999999995396 7.2262e-06 *** X2 1 -3.03996000000000021757 0.0023661 ** X1:X2 1 -0.68205000000000004512 0.4952094 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.853574805224538435411 0.063090989221389948138 13.529270000000000351 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.000000000000000000000, 1.002695135787324165477), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(-0.02191358273802538475516, 0.62162104624596714597118, -0.42762435428426853745165, -0.10256725599972128792903), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8535748052245384354109), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.0000000000000000000000, 0.2278165916815008962271), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1671006248895306467439, 0.1385408652510198845853, 0.1406676052717547309445, 0.1503815732862690546234), tolerance = tolerance)) > #mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.063097735777156036), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06309098922138993426056), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.6255603757719541136, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.0170781983524079806, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 298.6458240663615129051, tolerance = tolerance)) > ######################################################################################## > df_NA <- df[-c(1,90:110),] > > > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_NA, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 99 2 -119.45 258.71 284.4 51 Thresholds: Estimate Std. Error z value 1 1|2 -1.02012637737389844084 0.19996641229614070534 -5.1014900000000000801 1 2|3 1.14180364925262156639 0.22379090693934000633 5.1021000000000000796 2 1|2 -0.90662822300351997296 0.19059651595704024674 -4.7567899999999996297 2 2|3 0.99945117269173178176 0.17403069740197851800 5.7429600000000000648 Pr(>|z|) 1 1|2 3.3699e-07 *** 1 2|3 3.3590e-07 *** 2 1|2 1.9669e-06 *** 2 2|3 9.3036e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.83733616646617137214 0.18898470050444338142 4.4307100000000003703 X1 2 0.49821075302607176205 0.16630384260854050305 2.9957899999999999530 X2 1 -0.44740279449456488159 0.18763575165139662060 -2.3844199999999999839 X2 2 -0.35390389963374180304 0.14489624593604932823 -2.4424600000000000755 Pr(>|z|) X1 1 9.3924e-06 *** X1 2 0.0027374 ** X2 1 0.0171060 * X2 2 0.0145874 * --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.910650307821128435215 0.070553566078478416324 12.907220000000000582 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.0201263773742383911269, 1.1418036492524186176212, -0.9066282230038859024646, 0.9994511726914282467860), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8373361664658567349306, 0.4982107530258053085248, -0.4474027944949834356692, -0.3539038996339812781500), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9106503078209118307029), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1999664122961394840949, 0.2237909069393826111405, 0.1905965159570501277209, 0.1740306974019930341679), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1889847005044749950198, 0.1663038426085674814647, 0.1876357516513920686840, 0.1448962459360401411335), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.07055356607861483497768), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -119.4526280916837492896, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 258.7052561833675099479, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 284.3969426996999345647, tolerance = tolerance)) > > #weights > df_NA$weights <- 0.5 > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + weights.name = "weights", + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_NA, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), weights.name = "weights") Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 99 2 -59.73 139.25 164.94 470 Thresholds: Estimate Std. Error z value 1 1|2 -1.02012812480871528642 0.39993316222628882972 -2.5507499999999998508 1 2|3 1.14180477101864741307 0.44758335787565117769 2.5510399999999999743 2 1|2 -0.90661610117580127000 0.38119353284182333486 -2.3783599999999998076 2 2|3 0.99945811052964006471 0.34806068555282732024 2.8715099999999997848 Pr(>|z|) 1 1|2 0.0107492 * 1 2|3 0.0107401 * 2 1|2 0.0173898 * 2 2|3 0.0040852 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.83733318754043106757 0.37797050239240559399 2.2153399999999998649 X1 2 0.49821357229097545938 0.33260837571971485493 1.4979000000000000092 X2 1 -0.44740660005602911342 0.37527222777998581194 -1.1922200000000000575 X2 2 -0.35390625839926942442 0.28979246676291725571 -1.2212400000000001032 Pr(>|z|) X1 1 0.026737 * X1 2 0.134160 X2 1 0.233175 X2 2 0.221995 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.91064682418431319721 0.14111087043920636508 6.4534099999999998687 Pr(>|z|) corr 1 2 1.0936e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.0201283793713198377873, 1.1418048707357395521456, -0.9066161533747665313143, 0.9994581570190742558779), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8373332969208180376341, 0.4982136050008418859392, -0.4474066175154422508875, -0.3539061566757252808024), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9106469196938988819312), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.3999331442401471981007, 0.4475833313547766811880, 0.3811935020996289336104, 0.3480606771313752845209), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.3779704499331774103510, 0.3326083385001772918521, 0.3752721890043577146479, 0.2897924558296670061175), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.1411107414052604758226), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -59.72631403934757088336, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 139.2526280786951531354, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 164.944314595027606174, tolerance = tolerance)) > ########################################################################################## > df_23 <- df > > ##For the first response (first 100 obs), replace the level 3 by 2. > ## Now the first response has 2 levels and the second one 3 levels > df_23$Y[which(df_23$Y[1:100] == 3)] <- 2 > > ## Must be converted to integer. Ordered factor is not OK, as we have diff number of responses. > df_23$Y <- as.integer(df_23$Y) > > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_23, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_23, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -109.15 235.69 258.34 52 Thresholds: Estimate Std. Error z value 1 1|2 -0.97243369041134364306 0.20101574846709677202 -4.8376000000000001222 2 1|2 -0.97734151029791072052 0.18730956260707720684 -5.2177899999999999281 2 2|3 1.01224642882576243430 0.15713428754507915985 6.4419199999999996464 Pr(>|z|) 1 1|2 1.3142e-06 *** 2 1|2 1.8107e-07 *** 2 2|3 1.1797e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.82969552084014241977 0.22409294296769713406 3.7024599999999998623 X1 2 0.53332636576346359458 0.14638351173002656092 3.6433499999999998664 X2 1 -0.39479319852748012698 0.18931396166550790161 -2.0853899999999998549 X2 2 -0.38625976505569992181 0.13976399874801789802 -2.7636599999999997834 Pr(>|z|) X1 1 0.00021352 *** X1 2 0.00026911 *** X2 1 0.03703403 * X2 2 0.00571576 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.85295804978394829110 0.10226978918632162463 8.3402700000000002944 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > > mvord:::check(all.equal(res.summary$thresholds$Estimate, + c(-0.9724336904108278334391, -0.9773415102989740921302, 1.0122464288213952610107), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8296955208405573101160, 0.5333263657626993170524, -0.3947931985275920929723, -0.3862597650564197349077), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8529580497839671648919), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2010157484670624383760, 0.1873095626070425123721, 0.1571342875452053644558), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.2240929429677874784588, 0.1463835117300714416810, 0.1893139616655838686210, 0.1397639987481304746364), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.1022697891863128538681), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -109.147957798495554016, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 235.6872199448172011671, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 258.3408737360180111864, tolerance = tolerance)) > > ########################################################################################## > ## make three responses > suppressWarnings(RNGversion("3.5.0")) > set.seed(100) > Y3 <- sample(1:3, nobs, replace = TRUE) > dat_3 <- cbind(Y3, data_toy_example) > res <- mvord::mvord(formula = MMO2(Y1, Y2, Y3) ~ 0, + data = dat_3, + link = mvprobit(), + error.structure = cor_general(~1), + control= mvord.control(solver="BFGS",se=TRUE)) Warning message: Responses are unordered. Natural ordering is used. > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO2(Y1, Y2, Y3) ~ 0, data = dat_3, error.structure = cor_general(~1), link = mvprobit(), control = mvord.control(solver = "BFGS", se = TRUE)) Formula: MMO2(Y1, Y2, Y3) ~ 0 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 3 -565.19 1163.2 1205.96 52 Thresholds: Estimate Std. Error z value Y1 1|2 -0.70654808839442972968 0.14413615638980573075 -4.9019500000000002515 Y1 2|3 0.84166389562761123599 0.15094934798831763367 5.5758000000000000895 Y2 1|2 -0.80564017944257926285 0.14777311388303038253 -5.4518700000000004380 Y2 2|3 0.87834342403448395498 0.15259796098861780345 5.7559300000000002129 Y3 1|2 -0.52550677773958742733 0.13805473124275705055 -3.8065099999999998381 Y3 2|3 0.43872841951737284738 0.13625729487946994234 3.2198500000000001009 Pr(>|z|) Y1 1|2 9.4890e-07 *** Y1 2|3 2.4639e-08 *** Y2 1|2 4.9842e-08 *** Y2 2|3 8.6165e-09 *** Y3 1|2 0.00014094 *** Y3 2|3 0.00128256 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value Pr(>|z|) Error Structure: Estimate Std. Error corr Y1 Y2 0.908534877536116503016 0.039421737990092485526 corr Y1 Y3 -0.068886066523438385656 0.133978933777760100821 corr Y2 Y3 -0.150586382344864100347 0.129319546675897428800 z value Pr(>|z|) corr Y1 Y2 23.0465499999999998693 < 2e-16 *** corr Y1 Y3 -0.5141599999999999504 0.60714 corr Y2 Y3 -1.1644499999999999851 0.24424 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > > mvord:::check(all.equal(res.summary$thresholds$Estimate, + c(-0.70654808839454852354, 0.84166389562778798350 ,-0.80564017944211274713, + 0.87834342403465937021, -0.52550677773899212575, 0.43872841951666374793), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, + c(0.908534877536098850470 , -0.068886066520331828977, -0.150586382347683067628), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, + c(0.14413615638981053246, 0.15094934798830694778, 0.14777311388303066009, + 0.15259796098859162994, 0.13805473124275577379, 0.13625729487947765839), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.039421737990101658744,0.133978933777893494117,0.129319546675785962409), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -565.1857975044365502981, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 1163.199625517649110407, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 1205.960928690734590418, tolerance = tolerance)) > ########################################## > ### fixed coefs fixed thresholds > ########################################### > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.values = list(c(-1,1), c(-1,1)), + coef.values = matrix(c(0.8,-0.5, 0.8,-0.5),ncol=2, byrow=TRUE), + control= mvord.control(solver="BFGS",se=TRUE)) We suggest to include an intercept in the model (formula = y ~ 1 + ...)Error in rho[["constraints_mat"]] %*% par_beta : non-conformable arguments Error in optimx.check(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower, : Cannot evaluate function at initial parameters Calls: <Anonymous> -> mvord.fit Execution halted Flavor: r-devel-linux-x86_64-debian-gcc

Version: 1.1.1
Check: Rd cross-references
Result: NOTE Undeclared package ‘VGAM’ in Rd xrefs Flavor: r-devel-linux-x86_64-fedora-clang

Version: 1.1.1
Check: tests
Result: ERROR Running ‘check_methods.R’ Running ‘check_mvord_data.R’ Running ‘check_mvord_errors.R’ Running ‘check_set_threshold_type.R’ Running ‘check_toy_example.R’ [41s/49s] Running ‘check_transf_sigmas.R’ Running ‘check_transf_thresholds.R’ 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 > suppressWarnings(RNGversion("3.5.0")) > 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 = FALSE), + "f2" = factor(rep(data_toy_example$Y1,2), ordered = FALSE), + w = rep(w,2)) > df$X3 <- cut(df$X2, c(-Inf, -0.2, 0.2, Inf)) > > > > # 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, + link = mvprobit(), + 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=TRUE)) 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. > options(digits = 22) > > 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 = TRUE)) 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 1 1|2 -0.96257386663499888702 0.16613952738603396386 -5.7937700000000003087 1 2|3 1.03347036873238828925 0.15004482537615168591 6.8877399999999999736 2 1|2 -0.96257386663499888702 0.16613952738603396386 -5.7937700000000003087 2 2|3 1.03347036873238828925 0.15004482537615168591 6.8877399999999999736 Pr(>|z|) 1 1|2 6.8825e-09 *** 1 2|3 5.6684e-12 *** 2 1|2 6.8825e-09 *** 2 2|3 5.6684e-12 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.63801035062442590373 0.13576747301354935571 4.6992900000000004113 X2 1 -0.42672524816265555714 0.13643665802445156809 -3.1276399999999999757 Pr(>|z|) X1 1 2.6107e-06 *** X2 1 0.0017621 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.854266728221043991631 0.062440889990424582046 13.681210000000000093 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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"), + 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, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + control= mvord.control(solver="BFGS",se=TRUE)) > 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 = TRUE)) 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 1 1|2 -0.75479706538162727458 0.13105603927552006427 -5.7593500000000004135 1 2|3 0.86086304364912058507 0.13360642334434574829 6.4432799999999996743 2 1|2 -0.75479706538162727458 0.13105603927552006427 -5.7593500000000004135 2 2|3 0.86086304364912058507 0.13360642334434574829 6.4432799999999996743 Pr(>|z|) 1 1|2 8.4440e-09 *** 1 2|3 1.1692e-10 *** 2 1|2 8.4440e-09 *** 2 2|3 1.1692e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value Pr(>|z|) Error Structure: Estimate Std. Error z value corr 1 2 0.905795171446388658332 0.038855435949046335242 23.311930000000000263 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + control= mvord.control(solver="BFGS",se=TRUE)) 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 = TRUE)) 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 1 1|2 0.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.61576075469784496974 0.15607113684416781818 10.3527199999999997 2 1|2 0.00000000000000000000 0.00000000000000000000 NA 2 2|3 1.61576075469784496974 0.15607113684416781818 10.3527199999999997 Pr(>|z|) 1 1|2 NA 1 2|3 < 2.22e-16 *** 2 1|2 NA 2 2|3 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error (Intercept) 1 0.73786225358709867095 0.13500906208906057748 (Intercept) 2 0.77255634837212872057 0.14063945843173736305 z value Pr(>|z|) (Intercept) 1 5.4652799999999999159 4.6218e-08 *** (Intercept) 2 5.4931700000000001083 3.9478e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.906373932662642656233 0.038916052675185490439 23.290489999999998361 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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 1 1|2 -0.90552506790495312927 0.18265647646917998470 -4.9575300000000002143 1 2|3 1.00420547521769010224 0.17467164336593621332 5.7491000000000003212 2 1|2 -0.90552506790495312927 0.18265647646917998470 -4.9575300000000002143 2 2|3 1.00420547521769010224 0.17467164336593621332 5.7491000000000003212 Pr(>|z|) 1 1|2 7.1395e-07 *** 1 2|3 8.9718e-09 *** 2 1|2 7.1395e-07 *** 2 2|3 8.9718e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.64793126338519113627 0.14153585035884308496 4.5778600000000002623 X2 1 -0.42893128334031871418 0.13989943737311180683 -3.0659999999999998366 Pr(>|z|) X1 1 4.6976e-06 *** X2 1 0.0021695 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error corr f21 1 2 0.736678597233847209935 0.178238394308690428769 corr f22 1 2 0.918298263052714447419 0.068858656199650286611 corr f23 1 2 0.837106119713037832852 0.131036082998424396884 z value Pr(>|z|) corr f21 1 2 4.1331100000000002836 3.5789e-05 *** corr f22 1 2 13.3359900000000006770 < 2.22e-16 *** corr f23 1 2 6.3883599999999995944 1.6767e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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, + link = mvlogit(df = 8L), + error.structure = cor_general(~1)) > #threshold.constraints = c(1,1), > #coef.constraints = c(1,1)) > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y, i, j) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~1), link = mvlogit(df = 8L)) Formula: MMO(Y, i, j) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvlogit flexible 100 2 -132.87 285.51 311.28 489 Thresholds: Estimate Std. Error z value 1 1|2 -1.61992919266584012306 0.33738755193354152961 -4.8013899999999996027 1 2|3 1.83247553193428514007 0.36742759194553598068 4.9873099999999999099 2 1|2 -1.61590358150649326952 0.33963206188857408829 -4.7578100000000000946 2 2|3 1.74613495493027071070 0.30112280645182398775 5.7987500000000000711 Pr(>|z|) 1 1|2 1.5757e-06 *** 1 2|3 6.1226e-07 *** 2 1|2 1.9571e-06 *** 2 2|3 6.6812e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 1.28924304054451899226 0.30395054778163360654 4.2416200000000001680 X1 2 0.88420478543597791354 0.29740834729385978719 2.9730300000000000615 X2 1 -0.84290995357526543597 0.30080364930704572846 -2.8021899999999999586 X2 2 -0.71568801844518059596 0.25697668743292467752 -2.7850299999999998946 Pr(>|z|) X1 1 2.2191e-05 *** X1 2 0.0029487 ** X2 1 0.0050756 ** X2 2 0.0053523 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.88389347246287641724 0.07117465756729765558 12.418649999999999523 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.6170817306633420, 1.7855897338762188, -1.6170817306633420, 1.7855897338762188), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$coefficients$Estimate, c(1.07242200717115987, 1.07242200717115987, -0.76715925377701732, -0.76715925377701732), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.85317690560688531), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.28997405649500174, 0.27427389826231802, 0.28997405649500174, 0.27427389826231802), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.24111402270822993, 0.24111402270822993, 0.24156664773225886, 0.24156664773225886), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.063316529381183581), tolerance = tolerance)) > # mvord:::check(all.equal(logLik(res), -135.41665313840898, tolerance = tolerance)) > # mvord:::check(all.equal(AIC(res), 281.35962206629165, tolerance = tolerance)) > # mvord:::check(all.equal(BIC(res), 295.07104409780789, tolerance = tolerance)) > > ################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cov_general(~1), + threshold.constraints = c(1,1), + threshold.values = list(c(-1,NA), + c(-1,NA)), + coef.constraints = c(1,1)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cov_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), threshold.values = list(c(-1, NA), c(-1, NA)), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit fix1first 100 2 -134.64 282.04 298.67 37 Thresholds: Estimate Std. Error z value 1 1|2 -1.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.08266798008347264748 0.24926043418153945308 4.3435199999999998255 2 1|2 -1.00000000000000000000 0.00000000000000000000 NA 2 2|3 1.08266798008347264748 0.24926043418153945308 4.3435199999999998255 Pr(>|z|) 1 1|2 NA 1 2|3 1.4022e-05 *** 2 1|2 NA 2 2|3 1.4022e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.68834946142116071321 0.15128036741855890868 4.5501599999999999824 X2 1 -0.45406517655044392745 0.15704134440910905157 -2.8913700000000002177 Pr(>|z|) X1 1 5.3606e-06 *** X2 1 0.0038356 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.856153637803035327813 0.061822221469868911259 13.8486399999999996169 sigma 1 1.001934583868995254363 0.185187960683942831608 5.4103700000000003456 sigma 2 1.089828199315897139243 0.197593289723884180109 5.5155099999999999127 Pr(>|z|) corr 1 2 < 2.22e-16 *** sigma 1 6.2896e-08 *** sigma 2 3.4777e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.000000000000000000000, 1.082667980083374503764, -1.000000000000000000000, 1.082667980083374503764), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6883494614209317852271, -0.4540651765505133163892), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8561536378031743277361, 1.0019345838689188710191, 1.0898281993157663549709), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.0000000000000000000000, 0.2492604341815170820862, 0.0000000000000000000000, 0.2492604341815170820862), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1512803674185349001036, 0.1570413444091093568833), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06182222146981963123435, 0.18518796068392143205905, 0.19759328972385112321852), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.6391112878561102661, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.0441800225207202857, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 298.6729258905298252103, tolerance = tolerance)) > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_equi(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(1,1),c(1,2))) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_equi(~1), link = mvprobit(), coef.constraints = cbind(c(1, 1), c(1, 2)), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -134.84 282.45 299.08 35 Thresholds: Estimate Std. Error z value 1 1|2 -0.96275665235849350321 0.16703865743956156087 -5.7636799999999999145 1 2|3 1.03388029135981107665 0.15203091606548349568 6.8004600000000001714 2 1|2 -0.96275665235849350321 0.16703865743956156087 -5.7636799999999999145 2 2|3 1.03388029135981107665 0.15203091606548349568 6.8004600000000001714 Pr(>|z|) 1 1|2 8.2301e-09 *** 1 2|3 1.0429e-11 *** 2 1|2 8.2301e-09 *** 2 2|3 1.0429e-11 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.63820467410984904610 0.13670492809261164391 4.6684799999999997411 X2 1 -0.44676561119570956659 0.15900879662663833236 -2.8096899999999997988 X2 2 -0.40750155519148029137 0.13850979189698683913 -2.9420399999999999885 Pr(>|z|) X1 1 3.0343e-06 *** X2 1 0.0049589 ** X2 2 0.0032606 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value (Intercept) 1.272900571254562907 0.232216118479298822 5.4815300000000002356 Pr(>|z|) (Intercept) 4.2165e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.9627566523584676350112, 1.0338802913596250032668, -0.9627566523584676350112, 1.0338802913596247812222), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6382046741095841468905, -0.4467656111955374820255, -0.4075015551913261924177), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$Estimate, c(1.272900571254629964457), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1670386574395647250046, 0.1520309160654948199554, 0.1670386574395647250046, 0.1520309160654948199554), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1367049280926301846328, 0.1590087966266460206555, 0.1385097918969951935608), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.2322161184793045674013), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.8432321319771745038, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.4524217107628487611, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 299.0811675787719536856, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_equi(~1), + threshold.constraints = c(1,1), + coef.constraints = list(X2 = cbind(c(1,1,0,0), c(0,0,1,1)), + X1 = 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)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_ar1(~ 1 + X1), + threshold.constraints = c(1,1), + coef.constraints = c(1,1)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_ar1(~1 + X1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -133.94 280.64 297.27 35 Thresholds: Estimate Std. Error z value 1 1|2 -0.95722951152620627813 0.16558288168118384664 -5.7809699999999999420 1 2|3 1.03746793968351225246 0.15306952616694896596 6.7777599999999997848 2 1|2 -0.95722951152620627813 0.16558288168118384664 -5.7809699999999999420 2 2|3 1.03746793968351225246 0.15306952616694896596 6.7777599999999997848 Pr(>|z|) 1 1|2 7.4272e-09 *** 1 2|3 1.2206e-11 *** 2 1|2 7.4272e-09 *** 2 2|3 1.2206e-11 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.65304208674295927128 0.13584016202002618945 4.8074300000000000921 X2 1 -0.42273136793587207105 0.13820217716269161956 -3.0587900000000001199 Pr(>|z|) X1 1 1.5288e-06 *** X2 1 0.0022223 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error (Intercept) 1.29891554197069947207 0.24517466007549018614 X1 0.29350892362873459707 0.29416988646860059431 z value Pr(>|z|) (Intercept) 5.29792000000000040671 1.1713e-07 *** X1 0.99775000000000002576 0.3184 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.9572295115261755249492, 1.0374679396833161870717, -0.9572295115261755249492, 1.0374679396833161870717), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6530420867428219366957, -0.4227313679354475217664), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(1.298915541971320308789, 0.293508923629326790028), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1655828816811988069002, 0.1530695261669812456962, 0.1655828816811988069002, 0.1530695261669812456962), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1358401620200463122412, 0.1382021771627104100855), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.2451746600755327076815, 0.2941698864686516090572), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -133.938827675498004055, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 280.6436127978045078635, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 297.272358665813612788, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_ar1(~1 + X1), + 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)) > > ######################################################################################## > res <- mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + X2, + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(1,2),c(NA,1))) > > res.summary <- summary(res, short = FALSE) Call: mvord(formula = MMO2(Y1, Y2) ~ 0 + X1 + X2, data = data_toy_example, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = cbind(c(1, 2), c(NA, 1)), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO2(Y1, Y2) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -137.65 288.06 304.69 63 Thresholds: Estimate Std. Error z value Y1 1|2 -0.89892942527351460402 0.16246077762271260436 -5.5332100000000004059 Y1 2|3 0.98413365940588137804 0.15981657213961378283 6.1578900000000000858 Y2 1|2 -0.89892942527351460402 0.16246077762271260436 -5.5332100000000004059 Y2 2|3 0.98413365940588148906 0.15981657213961378283 6.1578900000000000858 Pr(>|z|) Y1 1|2 3.1442e-08 *** Y1 2|3 7.3718e-10 *** Y2 1|2 3.1442e-08 *** Y2 2|3 7.3718e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.681944859288770910410 0.174961892922592010535 3.89767999999999981142 X1 2 0.468376583108602972949 0.157106006693615907199 2.98127999999999993008 X2 1 -0.052179801987810067732 0.089798215416072579842 -0.58108000000000004093 Pr(>|z|) X1 1 9.712e-05 *** X1 2 0.0028705 ** X2 1 0.5611876 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr Y1 Y2 0.890390657144698227654 0.063175533024007315963 14.09392000000000067 Pr(>|z|) corr Y1 Y2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.8989294252736504953205, 0.9841336594057152886705, -0.8989294252736503842982, 0.9841336594057153996928), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.68194485928859438494953, 0.46837658310856356003171, -0.05217980198794509860694), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8903906571446290607597), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1624607776227008359982, 0.1598165721396140603883, 0.1624607776227008359982, 0.1598165721396140603883), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.17496189292260000414103, 0.15710600669362786985239, 0.08979821541610534529898), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.0631755330240382911855), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -137.6494615446075613363, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 288.064880536023622426, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 304.6936264040327273506, tolerance = tolerance)) > > > res2 <- mvord::mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + X2, + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)), + X2 = matrix(c(rep(0,2),rep(1,2)), ncol = 1))) > > mvord:::check(all.equal(res$beta, res2$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res2$sebeta, tolerance = tolerance)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + offset(X2), + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + offset(X2), data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = list(X1 = cbind(c(1, 1, 0, 0), c(0, 0, 1, 1))), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + offset(X2) link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -194.33 403.71 423.31 78 Thresholds: Estimate Std. Error z value 1 1|2 -0.76726526230223290881 0.12023341892342831461 -6.3814599999999996882 1 2|3 0.89190483009970544792 0.13058942975202555981 6.8298399999999999110 2 1|2 -0.79675344626816624327 0.11172347359918627374 -7.1314799999999998192 2 2|3 0.87294080476112090317 0.13662238116423594536 6.3894399999999995643 Pr(>|z|) 1 1|2 1.7540e-10 *** 1 2|3 8.5010e-12 *** 2 1|2 9.9297e-13 *** 2 2|3 1.6649e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.53370081959011461681 0.13636430505431412774 3.9137900000000001022 X1 2 0.34385576067169915104 0.10634167794017658493 3.2334999999999998188 Pr(>|z|) X1 1 9.086e-05 *** X1 2 0.0012228 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.940808527820523377017 0.033697206769472437538 27.919480000000000075 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.7672652623027305107684, 0.8919048301000485068357, -0.7967534462687086982413, 0.8729408047614937160574), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.5337008195901541407480, 0.3438557606717420056519), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9408085278204662005308), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1202334189234334493879, 0.1305894297520299174309, 0.1117234735991832761393, 0.1366223811642423013879), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1363643050543318635537, 0.1063416779401736012023), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.03369720676949919391241), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -194.3258468555947047207, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 403.705457152049632441, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 423.314265003572927526, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1, + offset = list(df$X2[1:100], df$X2[101:200]), + data = df, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > > mvord:::check(all.equal(res$beta, res2$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res2$sebeta, tolerance = tolerance)) > > res3 <- mvord::mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + offset(X2), + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > mvord:::check(all.equal(res$beta, res3$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res3$sebeta, tolerance = tolerance)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvlogit(), + #solver = "newuoa", + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(NA, NA), c(1,2)), + coef.values = cbind(c(1, 1), c(NA,NA))) > #rho <- res$rho > > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~1), link = mvlogit(), coef.constraints = cbind(c(NA, NA), c(1, 2)), coef.values = cbind(c(1, 1), c(NA, NA)), threshold.constraints = c(1, 1)) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvlogit flexible 100 2 -135.52 281.57 295.28 180 Thresholds: Estimate Std. Error z value 1 1|2 -1.58328853691710325080 0.25851087521015303494 -6.1246499999999999275 1 2|3 1.75864257978098414981 0.24251595835343375818 7.2516600000000002169 2 1|2 -1.58328853691710325080 0.25851087521015303494 -6.1246499999999999275 2 2|3 1.75864257978098414981 0.24251595835343375818 7.2516600000000002169 Pr(>|z|) 1 1|2 9.0883e-10 *** 1 2|3 4.1170e-13 *** 2 1|2 9.0883e-10 *** 2 2|3 4.1170e-13 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X2 1 -0.77306066201133261107 0.26732809962259085346 -2.8917999999999999261 X2 2 -0.72430296230010837721 0.24403985402359068546 -2.9679700000000002191 Pr(>|z|) X2 1 0.0038304 ** X2 2 0.0029977 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.855894580949125072244 0.060599146841922621465 14.123870000000000147 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > tolerance2 <- 1e-4 > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.583288915548024533564, 1.758642501421955106622, -1.583288915548024533564, 1.758642501421955106622), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(-0.7730608423417825170176, -0.7243032675736262859800), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8558944465934688050623), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2585108482987530376107, 0.2425159370850978601819, 0.2585108482987530376107, 0.2425159370850978601819), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.2673280928737744588375, 0.2440398419906193439033), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06059919526643173237623), tolerance = tolerance2)) > mvord:::check(all.equal(logLik(res)[[1]], -135.5210996495467554723, tolerance = tolerance2)) > mvord:::check(all.equal(AIC(res), 281.568515088567210114, tolerance = tolerance2)) > mvord:::check(all.equal(BIC(res), 295.2799371200834457341, tolerance = tolerance2)) > > # res1 <- mvord::mvord(formula = MMO(Y) ~ 1 + X1 + X2, > # data = df, > # index = c("i", "j"), > # link = mvprobit(), > # solver = "BFGS", > # se = TRUE, > # error.structure = cor_equi(~1), > # threshold.constraints = c(1,1), > # coef.constraints = list(Intercept = matrix(rep(1,6), ncol = 1), > # X2 = cbind(c(1,1,1,0,0,0), c(0,0,0,1,1,1)), X1 = matrix(rep(1,6), ncol = 1))) > > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X3, + 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)) > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X3, data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X3 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -136.05 284.87 301.5 34 Thresholds: Estimate Std. Error z value 1 1|2 -1.21270698725037129329 0.21131407873814866960 -5.7388799999999999812 1 2|3 0.75845153901176631805 0.18860790313554207098 4.0213099999999997181 2 1|2 -1.21270698725037129329 0.21131407873814866960 -5.7388799999999999812 2 2|3 0.75845153901176631805 0.18860790313554207098 4.0213099999999997181 Pr(>|z|) 1 1|2 9.5302e-09 *** 1 2|3 5.7874e-05 *** 2 1|2 9.5302e-09 *** 2 2|3 5.7874e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error X1 1 0.582346304092164257504 0.133874274950955496344 X3(-0.2,0.2] 1 0.065949564660296139396 0.394250784463485104414 X3(0.2, Inf] 1 -0.639867558058156649103 0.239596299509497845381 z value Pr(>|z|) X1 1 4.34994999999999976126 1.3617e-05 *** X3(-0.2,0.2] 1 0.16728000000000001202 0.8671512 X3(0.2, Inf] 1 -2.67060999999999992838 0.0075714 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.857975765661059597278 0.062391829886098891522 13.751409999999999911 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.212706987250618206886, 0.758451539011639419563, -1.212706987250618206886, 0.758451539011639419563), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.58234630409261545214150, 0.06594956465951176682871, -0.63986755805831896370961), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8579757656611409766256), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2113140787381464491546, 0.1886079031355630819533, 0.2113140787381464491546, 0.1886079031355630819533), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1338742749509412854891, 0.3942507844634823288565, 0.2395962995094961522913), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06239182988606906121731), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -136.0526219854373835005, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 284.8712014176832667545, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 301.499947285692371679, tolerance = tolerance)) > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 1 + 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), + threshold.values = list(c(-1,NA), + c(-1,NA)), + coef.constraints = c(1,1)) > res.summary <- summary(res, short = TRUE) Call: mvord::mvord(formula = MMO(Y) ~ 1 + X1 * X2, data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), threshold.values = list(c(-1, NA), c(-1, NA)), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 1 + X1 * X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit fix1first 100 2 -134.63 282.02 298.65 34 Thresholds: Estimate Std. Error z value 1 1|2 -1.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.00269513578732416548 0.22781659168150072969 4.4013299999999997425 Pr(>|z|) 1 1|2 NA 1 2|3 1.0759e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error (Intercept) 1 -0.021913582738025384755 0.167100624889530591233 X1 1 0.621621046245967145971 0.138540865251019801319 X2 1 -0.427624354284268537452 0.140667605271754703189 X1:X2 1 -0.102567255999721287929 0.150381573286269054623 z value Pr(>|z|) (Intercept) 1 -0.13114000000000000656 0.8956645 X1 1 4.48690999999999995396 7.2262e-06 *** X2 1 -3.03996000000000021757 0.0023661 ** X1:X2 1 -0.68205000000000004512 0.4952094 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.853574805224538435411 0.063090989221389948138 13.529270000000000351 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.000000000000000000000, 1.002695135787324165477), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(-0.02191358273802538475516, 0.62162104624596714597118, -0.42762435428426853745165, -0.10256725599972128792903), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8535748052245384354109), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.0000000000000000000000, 0.2278165916815008962271), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1671006248895306467439, 0.1385408652510198845853, 0.1406676052717547309445, 0.1503815732862690546234), tolerance = tolerance)) > #mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.063097735777156036), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06309098922138993426056), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.6255603757719541136, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.0170781983524079806, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 298.6458240663615129051, tolerance = tolerance)) > ######################################################################################## > df_NA <- df[-c(1,90:110),] > > > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_NA, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 99 2 -119.45 258.71 284.4 51 Thresholds: Estimate Std. Error z value 1 1|2 -1.02012637737389844084 0.19996641229614070534 -5.1014900000000000801 1 2|3 1.14180364925262156639 0.22379090693934000633 5.1021000000000000796 2 1|2 -0.90662822300351997296 0.19059651595704024674 -4.7567899999999996297 2 2|3 0.99945117269173178176 0.17403069740197851800 5.7429600000000000648 Pr(>|z|) 1 1|2 3.3699e-07 *** 1 2|3 3.3590e-07 *** 2 1|2 1.9669e-06 *** 2 2|3 9.3036e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.83733616646617137214 0.18898470050444338142 4.4307100000000003703 X1 2 0.49821075302607176205 0.16630384260854050305 2.9957899999999999530 X2 1 -0.44740279449456488159 0.18763575165139662060 -2.3844199999999999839 X2 2 -0.35390389963374180304 0.14489624593604932823 -2.4424600000000000755 Pr(>|z|) X1 1 9.3924e-06 *** X1 2 0.0027374 ** X2 1 0.0171060 * X2 2 0.0145874 * --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.910650307821128435215 0.070553566078478416324 12.907220000000000582 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.0201263773742383911269, 1.1418036492524186176212, -0.9066282230038859024646, 0.9994511726914282467860), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8373361664658567349306, 0.4982107530258053085248, -0.4474027944949834356692, -0.3539038996339812781500), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9106503078209118307029), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1999664122961394840949, 0.2237909069393826111405, 0.1905965159570501277209, 0.1740306974019930341679), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1889847005044749950198, 0.1663038426085674814647, 0.1876357516513920686840, 0.1448962459360401411335), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.07055356607861483497768), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -119.4526280916837492896, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 258.7052561833675099479, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 284.3969426996999345647, tolerance = tolerance)) > > #weights > df_NA$weights <- 0.5 > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + weights.name = "weights", + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_NA, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), weights.name = "weights") Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 99 2 -59.73 139.25 164.94 470 Thresholds: Estimate Std. Error z value 1 1|2 -1.02012812480871528642 0.39993316222628882972 -2.5507499999999998508 1 2|3 1.14180477101864741307 0.44758335787565117769 2.5510399999999999743 2 1|2 -0.90661610117580127000 0.38119353284182333486 -2.3783599999999998076 2 2|3 0.99945811052964006471 0.34806068555282732024 2.8715099999999997848 Pr(>|z|) 1 1|2 0.0107492 * 1 2|3 0.0107401 * 2 1|2 0.0173898 * 2 2|3 0.0040852 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.83733318754043106757 0.37797050239240559399 2.2153399999999998649 X1 2 0.49821357229097545938 0.33260837571971485493 1.4979000000000000092 X2 1 -0.44740660005602911342 0.37527222777998581194 -1.1922200000000000575 X2 2 -0.35390625839926942442 0.28979246676291725571 -1.2212400000000001032 Pr(>|z|) X1 1 0.026737 * X1 2 0.134160 X2 1 0.233175 X2 2 0.221995 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.91064682418431319721 0.14111087043920636508 6.4534099999999998687 Pr(>|z|) corr 1 2 1.0936e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.0201283793713198377873, 1.1418048707357395521456, -0.9066161533747665313143, 0.9994581570190742558779), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8373332969208180376341, 0.4982136050008418859392, -0.4474066175154422508875, -0.3539061566757252808024), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9106469196938988819312), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.3999331442401471981007, 0.4475833313547766811880, 0.3811935020996289336104, 0.3480606771313752845209), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.3779704499331774103510, 0.3326083385001772918521, 0.3752721890043577146479, 0.2897924558296670061175), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.1411107414052604758226), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -59.72631403934757088336, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 139.2526280786951531354, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 164.944314595027606174, tolerance = tolerance)) > ########################################################################################## > df_23 <- df > > ##For the first response (first 100 obs), replace the level 3 by 2. > ## Now the first response has 2 levels and the second one 3 levels > df_23$Y[which(df_23$Y[1:100] == 3)] <- 2 > > ## Must be converted to integer. Ordered factor is not OK, as we have diff number of responses. > df_23$Y <- as.integer(df_23$Y) > > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_23, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_23, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -109.15 235.69 258.34 52 Thresholds: Estimate Std. Error z value 1 1|2 -0.97243369041145588660 0.20101574846710046351 -4.8376000000000001222 2 1|2 -0.97734151029783122855 0.18730956260707903871 -5.2177899999999999281 2 2|3 1.01224642882576909564 0.15713428754508013130 6.4419199999999996464 Pr(>|z|) 1 1|2 1.3142e-06 *** 2 1|2 1.8107e-07 *** 2 2|3 1.1797e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.82969552084031761297 0.22409294296771067878 3.7024599999999998623 X1 2 0.53332636576341019286 0.14638351173003005812 3.6433499999999998664 X2 1 -0.39479319852757205345 0.18931396166552202920 -2.0853899999999998549 X2 2 -0.38625976505564324492 0.13976399874801781475 -2.7636599999999997834 Pr(>|z|) X1 1 0.00021352 *** X1 2 0.00026911 *** X2 1 0.03703403 * X2 2 0.00571576 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.85295804978384348605 0.10226978918638686411 8.3402700000000002944 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > > mvord:::check(all.equal(res.summary$thresholds$Estimate, + c(-0.9724336904108278334391, -0.9773415102989740921302, 1.0122464288213952610107), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8296955208405573101160, 0.5333263657626993170524, -0.3947931985275920929723, -0.3862597650564197349077), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8529580497839671648919), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2010157484670624383760, 0.1873095626070425123721, 0.1571342875452053644558), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.2240929429677874784588, 0.1463835117300714416810, 0.1893139616655838686210, 0.1397639987481304746364), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.1022697891863128538681), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -109.147957798495554016, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 235.6872199448172011671, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 258.3408737360180111864, tolerance = tolerance)) > > ########################################################################################## > ## make three responses > suppressWarnings(RNGversion("3.5.0")) > set.seed(100) > Y3 <- sample(1:3, nobs, replace = TRUE) > dat_3 <- cbind(Y3, data_toy_example) > res <- mvord::mvord(formula = MMO2(Y1, Y2, Y3) ~ 0, + data = dat_3, + link = mvprobit(), + error.structure = cor_general(~1), + control= mvord.control(solver="BFGS",se=TRUE)) Warning message: Responses are unordered. Natural ordering is used. > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO2(Y1, Y2, Y3) ~ 0, data = dat_3, error.structure = cor_general(~1), link = mvprobit(), control = mvord.control(solver = "BFGS", se = TRUE)) Formula: MMO2(Y1, Y2, Y3) ~ 0 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 3 -565.19 1163.2 1205.96 52 Thresholds: Estimate Std. Error z value Y1 1|2 -0.70654808839442972968 0.14413615638980573075 -4.9019500000000002515 Y1 2|3 0.84166389562761123599 0.15094934798831763367 5.5758000000000000895 Y2 1|2 -0.80564017944257926285 0.14777311388303038253 -5.4518700000000004380 Y2 2|3 0.87834342403448395498 0.15259796098861780345 5.7559300000000002129 Y3 1|2 -0.52550677773958742733 0.13805473124275705055 -3.8065099999999998381 Y3 2|3 0.43872841951737284738 0.13625729487946994234 3.2198500000000001009 Pr(>|z|) Y1 1|2 9.4890e-07 *** Y1 2|3 2.4639e-08 *** Y2 1|2 4.9842e-08 *** Y2 2|3 8.6165e-09 *** Y3 1|2 0.00014094 *** Y3 2|3 0.00128256 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value Pr(>|z|) Error Structure: Estimate Std. Error corr Y1 Y2 0.908534877536116503016 0.039421737990092485526 corr Y1 Y3 -0.068886066523438385656 0.133978933777760100821 corr Y2 Y3 -0.150586382344864100347 0.129319546675897428800 z value Pr(>|z|) corr Y1 Y2 23.0465499999999998693 < 2e-16 *** corr Y1 Y3 -0.5141599999999999504 0.60714 corr Y2 Y3 -1.1644499999999999851 0.24424 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > > mvord:::check(all.equal(res.summary$thresholds$Estimate, + c(-0.70654808839454852354, 0.84166389562778798350 ,-0.80564017944211274713, + 0.87834342403465937021, -0.52550677773899212575, 0.43872841951666374793), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, + c(0.908534877536098850470 , -0.068886066520331828977, -0.150586382347683067628), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, + c(0.14413615638981053246, 0.15094934798830694778, 0.14777311388303066009, + 0.15259796098859162994, 0.13805473124275577379, 0.13625729487947765839), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.039421737990101658744,0.133978933777893494117,0.129319546675785962409), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -565.1857975044365502981, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 1163.199625517649110407, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 1205.960928690734590418, tolerance = tolerance)) > ########################################## > ### fixed coefs fixed thresholds > ########################################### > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.values = list(c(-1,1), c(-1,1)), + coef.values = matrix(c(0.8,-0.5, 0.8,-0.5),ncol=2, byrow=TRUE), + control= mvord.control(solver="BFGS",se=TRUE)) We suggest to include an intercept in the model (formula = y ~ 1 + ...)Error in rho[["constraints_mat"]] %*% par_beta : non-conformable arguments Error in optimx.check(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower, : Cannot evaluate function at initial parameters Calls: <Anonymous> -> mvord.fit Execution halted Flavor: r-devel-linux-x86_64-fedora-clang

Version: 1.1.1
Check: tests
Result: ERROR Running ‘check_methods.R’ Running ‘check_mvord_data.R’ Running ‘check_mvord_errors.R’ Running ‘check_set_threshold_type.R’ Running ‘check_toy_example.R’ [41s/48s] Running ‘check_transf_sigmas.R’ Running ‘check_transf_thresholds.R’ 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 > suppressWarnings(RNGversion("3.5.0")) > 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 = FALSE), + "f2" = factor(rep(data_toy_example$Y1,2), ordered = FALSE), + w = rep(w,2)) > df$X3 <- cut(df$X2, c(-Inf, -0.2, 0.2, Inf)) > > > > # 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, + link = mvprobit(), + 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=TRUE)) 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. > options(digits = 22) > > 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 = TRUE)) 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 1 1|2 -0.96257386663499888702 0.16613952738603396386 -5.7937700000000003087 1 2|3 1.03347036873238828925 0.15004482537615168591 6.8877399999999999736 2 1|2 -0.96257386663499888702 0.16613952738603396386 -5.7937700000000003087 2 2|3 1.03347036873238828925 0.15004482537615168591 6.8877399999999999736 Pr(>|z|) 1 1|2 6.8825e-09 *** 1 2|3 5.6684e-12 *** 2 1|2 6.8825e-09 *** 2 2|3 5.6684e-12 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.63801035062442590373 0.13576747301354935571 4.6992900000000004113 X2 1 -0.42672524816265555714 0.13643665802445156809 -3.1276399999999999757 Pr(>|z|) X1 1 2.6107e-06 *** X2 1 0.0017621 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.854266728221043991631 0.062440889990424582046 13.681210000000000093 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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"), + 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, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + control= mvord.control(solver="BFGS",se=TRUE)) > 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 = TRUE)) 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 1 1|2 -0.75479706538162727458 0.13105603927552006427 -5.7593500000000004135 1 2|3 0.86086304364912058507 0.13360642334434574829 6.4432799999999996743 2 1|2 -0.75479706538162727458 0.13105603927552006427 -5.7593500000000004135 2 2|3 0.86086304364912058507 0.13360642334434574829 6.4432799999999996743 Pr(>|z|) 1 1|2 8.4440e-09 *** 1 2|3 1.1692e-10 *** 2 1|2 8.4440e-09 *** 2 2|3 1.1692e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value Pr(>|z|) Error Structure: Estimate Std. Error z value corr 1 2 0.905795171446388658332 0.038855435949046335242 23.311930000000000263 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + control= mvord.control(solver="BFGS",se=TRUE)) 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 = TRUE)) 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 1 1|2 0.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.61576075469784496974 0.15607113684416781818 10.3527199999999997 2 1|2 0.00000000000000000000 0.00000000000000000000 NA 2 2|3 1.61576075469784496974 0.15607113684416781818 10.3527199999999997 Pr(>|z|) 1 1|2 NA 1 2|3 < 2.22e-16 *** 2 1|2 NA 2 2|3 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error (Intercept) 1 0.73786225358709867095 0.13500906208906057748 (Intercept) 2 0.77255634837212872057 0.14063945843173736305 z value Pr(>|z|) (Intercept) 1 5.4652799999999999159 4.6218e-08 *** (Intercept) 2 5.4931700000000001083 3.9478e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.906373932662642656233 0.038916052675185490439 23.290489999999998361 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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 1 1|2 -0.90552506790495312927 0.18265647646917998470 -4.9575300000000002143 1 2|3 1.00420547521769010224 0.17467164336593621332 5.7491000000000003212 2 1|2 -0.90552506790495312927 0.18265647646917998470 -4.9575300000000002143 2 2|3 1.00420547521769010224 0.17467164336593621332 5.7491000000000003212 Pr(>|z|) 1 1|2 7.1395e-07 *** 1 2|3 8.9718e-09 *** 2 1|2 7.1395e-07 *** 2 2|3 8.9718e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.64793126338519113627 0.14153585035884308496 4.5778600000000002623 X2 1 -0.42893128334031871418 0.13989943737311180683 -3.0659999999999998366 Pr(>|z|) X1 1 4.6976e-06 *** X2 1 0.0021695 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error corr f21 1 2 0.736678597233847209935 0.178238394308690428769 corr f22 1 2 0.918298263052714447419 0.068858656199650286611 corr f23 1 2 0.837106119713037832852 0.131036082998424396884 z value Pr(>|z|) corr f21 1 2 4.1331100000000002836 3.5789e-05 *** corr f22 1 2 13.3359900000000006770 < 2.22e-16 *** corr f23 1 2 6.3883599999999995944 1.6767e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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, + link = mvlogit(df = 8L), + error.structure = cor_general(~1)) > #threshold.constraints = c(1,1), > #coef.constraints = c(1,1)) > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y, i, j) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~1), link = mvlogit(df = 8L)) Formula: MMO(Y, i, j) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvlogit flexible 100 2 -132.87 285.51 311.28 489 Thresholds: Estimate Std. Error z value 1 1|2 -1.61992919266584012306 0.33738755193354152961 -4.8013899999999996027 1 2|3 1.83247553193428514007 0.36742759194553598068 4.9873099999999999099 2 1|2 -1.61590358150649326952 0.33963206188857408829 -4.7578100000000000946 2 2|3 1.74613495493027071070 0.30112280645182398775 5.7987500000000000711 Pr(>|z|) 1 1|2 1.5757e-06 *** 1 2|3 6.1226e-07 *** 2 1|2 1.9571e-06 *** 2 2|3 6.6812e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 1.28924304054451899226 0.30395054778163360654 4.2416200000000001680 X1 2 0.88420478543597791354 0.29740834729385978719 2.9730300000000000615 X2 1 -0.84290995357526543597 0.30080364930704572846 -2.8021899999999999586 X2 2 -0.71568801844518059596 0.25697668743292467752 -2.7850299999999998946 Pr(>|z|) X1 1 2.2191e-05 *** X1 2 0.0029487 ** X2 1 0.0050756 ** X2 2 0.0053523 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.88389347246287641724 0.07117465756729765558 12.418649999999999523 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.6170817306633420, 1.7855897338762188, -1.6170817306633420, 1.7855897338762188), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$coefficients$Estimate, c(1.07242200717115987, 1.07242200717115987, -0.76715925377701732, -0.76715925377701732), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.85317690560688531), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.28997405649500174, 0.27427389826231802, 0.28997405649500174, 0.27427389826231802), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.24111402270822993, 0.24111402270822993, 0.24156664773225886, 0.24156664773225886), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.063316529381183581), tolerance = tolerance)) > # mvord:::check(all.equal(logLik(res), -135.41665313840898, tolerance = tolerance)) > # mvord:::check(all.equal(AIC(res), 281.35962206629165, tolerance = tolerance)) > # mvord:::check(all.equal(BIC(res), 295.07104409780789, tolerance = tolerance)) > > ################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cov_general(~1), + threshold.constraints = c(1,1), + threshold.values = list(c(-1,NA), + c(-1,NA)), + coef.constraints = c(1,1)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cov_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), threshold.values = list(c(-1, NA), c(-1, NA)), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit fix1first 100 2 -134.64 282.04 298.67 37 Thresholds: Estimate Std. Error z value 1 1|2 -1.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.08266798008347264748 0.24926043418153945308 4.3435199999999998255 2 1|2 -1.00000000000000000000 0.00000000000000000000 NA 2 2|3 1.08266798008347264748 0.24926043418153945308 4.3435199999999998255 Pr(>|z|) 1 1|2 NA 1 2|3 1.4022e-05 *** 2 1|2 NA 2 2|3 1.4022e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.68834946142116071321 0.15128036741855890868 4.5501599999999999824 X2 1 -0.45406517655044392745 0.15704134440910905157 -2.8913700000000002177 Pr(>|z|) X1 1 5.3606e-06 *** X2 1 0.0038356 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.856153637803035327813 0.061822221469868911259 13.8486399999999996169 sigma 1 1.001934583868995254363 0.185187960683942831608 5.4103700000000003456 sigma 2 1.089828199315897139243 0.197593289723884180109 5.5155099999999999127 Pr(>|z|) corr 1 2 < 2.22e-16 *** sigma 1 6.2896e-08 *** sigma 2 3.4777e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.000000000000000000000, 1.082667980083374503764, -1.000000000000000000000, 1.082667980083374503764), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6883494614209317852271, -0.4540651765505133163892), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8561536378031743277361, 1.0019345838689188710191, 1.0898281993157663549709), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.0000000000000000000000, 0.2492604341815170820862, 0.0000000000000000000000, 0.2492604341815170820862), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1512803674185349001036, 0.1570413444091093568833), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06182222146981963123435, 0.18518796068392143205905, 0.19759328972385112321852), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.6391112878561102661, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.0441800225207202857, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 298.6729258905298252103, tolerance = tolerance)) > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_equi(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(1,1),c(1,2))) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_equi(~1), link = mvprobit(), coef.constraints = cbind(c(1, 1), c(1, 2)), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -134.84 282.45 299.08 35 Thresholds: Estimate Std. Error z value 1 1|2 -0.96275665235849350321 0.16703865743956156087 -5.7636799999999999145 1 2|3 1.03388029135981107665 0.15203091606548349568 6.8004600000000001714 2 1|2 -0.96275665235849350321 0.16703865743956156087 -5.7636799999999999145 2 2|3 1.03388029135981107665 0.15203091606548349568 6.8004600000000001714 Pr(>|z|) 1 1|2 8.2301e-09 *** 1 2|3 1.0429e-11 *** 2 1|2 8.2301e-09 *** 2 2|3 1.0429e-11 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.63820467410984904610 0.13670492809261164391 4.6684799999999997411 X2 1 -0.44676561119570956659 0.15900879662663833236 -2.8096899999999997988 X2 2 -0.40750155519148029137 0.13850979189698683913 -2.9420399999999999885 Pr(>|z|) X1 1 3.0343e-06 *** X2 1 0.0049589 ** X2 2 0.0032606 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value (Intercept) 1.272900571254562907 0.232216118479298822 5.4815300000000002356 Pr(>|z|) (Intercept) 4.2165e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.9627566523584676350112, 1.0338802913596250032668, -0.9627566523584676350112, 1.0338802913596247812222), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6382046741095841468905, -0.4467656111955374820255, -0.4075015551913261924177), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$Estimate, c(1.272900571254629964457), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1670386574395647250046, 0.1520309160654948199554, 0.1670386574395647250046, 0.1520309160654948199554), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1367049280926301846328, 0.1590087966266460206555, 0.1385097918969951935608), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.2322161184793045674013), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.8432321319771745038, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.4524217107628487611, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 299.0811675787719536856, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_equi(~1), + threshold.constraints = c(1,1), + coef.constraints = list(X2 = cbind(c(1,1,0,0), c(0,0,1,1)), + X1 = 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)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_ar1(~ 1 + X1), + threshold.constraints = c(1,1), + coef.constraints = c(1,1)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_ar1(~1 + X1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -133.94 280.64 297.27 35 Thresholds: Estimate Std. Error z value 1 1|2 -0.95722951152620627813 0.16558288168118384664 -5.7809699999999999420 1 2|3 1.03746793968351225246 0.15306952616694896596 6.7777599999999997848 2 1|2 -0.95722951152620627813 0.16558288168118384664 -5.7809699999999999420 2 2|3 1.03746793968351225246 0.15306952616694896596 6.7777599999999997848 Pr(>|z|) 1 1|2 7.4272e-09 *** 1 2|3 1.2206e-11 *** 2 1|2 7.4272e-09 *** 2 2|3 1.2206e-11 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.65304208674295927128 0.13584016202002618945 4.8074300000000000921 X2 1 -0.42273136793587207105 0.13820217716269161956 -3.0587900000000001199 Pr(>|z|) X1 1 1.5288e-06 *** X2 1 0.0022223 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error (Intercept) 1.29891554197069947207 0.24517466007549018614 X1 0.29350892362873459707 0.29416988646860059431 z value Pr(>|z|) (Intercept) 5.29792000000000040671 1.1713e-07 *** X1 0.99775000000000002576 0.3184 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.9572295115261755249492, 1.0374679396833161870717, -0.9572295115261755249492, 1.0374679396833161870717), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6530420867428219366957, -0.4227313679354475217664), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(1.298915541971320308789, 0.293508923629326790028), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1655828816811988069002, 0.1530695261669812456962, 0.1655828816811988069002, 0.1530695261669812456962), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1358401620200463122412, 0.1382021771627104100855), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.2451746600755327076815, 0.2941698864686516090572), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -133.938827675498004055, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 280.6436127978045078635, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 297.272358665813612788, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_ar1(~1 + X1), + 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)) > > ######################################################################################## > res <- mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + X2, + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(1,2),c(NA,1))) > > res.summary <- summary(res, short = FALSE) Call: mvord(formula = MMO2(Y1, Y2) ~ 0 + X1 + X2, data = data_toy_example, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = cbind(c(1, 2), c(NA, 1)), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO2(Y1, Y2) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -137.65 288.06 304.69 63 Thresholds: Estimate Std. Error z value Y1 1|2 -0.89892942527351460402 0.16246077762271260436 -5.5332100000000004059 Y1 2|3 0.98413365940588137804 0.15981657213961378283 6.1578900000000000858 Y2 1|2 -0.89892942527351460402 0.16246077762271260436 -5.5332100000000004059 Y2 2|3 0.98413365940588148906 0.15981657213961378283 6.1578900000000000858 Pr(>|z|) Y1 1|2 3.1442e-08 *** Y1 2|3 7.3718e-10 *** Y2 1|2 3.1442e-08 *** Y2 2|3 7.3718e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.681944859288770910410 0.174961892922592010535 3.89767999999999981142 X1 2 0.468376583108602972949 0.157106006693615907199 2.98127999999999993008 X2 1 -0.052179801987810067732 0.089798215416072579842 -0.58108000000000004093 Pr(>|z|) X1 1 9.712e-05 *** X1 2 0.0028705 ** X2 1 0.5611876 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr Y1 Y2 0.890390657144698227654 0.063175533024007315963 14.09392000000000067 Pr(>|z|) corr Y1 Y2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.8989294252736504953205, 0.9841336594057152886705, -0.8989294252736503842982, 0.9841336594057153996928), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.68194485928859438494953, 0.46837658310856356003171, -0.05217980198794509860694), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8903906571446290607597), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1624607776227008359982, 0.1598165721396140603883, 0.1624607776227008359982, 0.1598165721396140603883), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.17496189292260000414103, 0.15710600669362786985239, 0.08979821541610534529898), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.0631755330240382911855), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -137.6494615446075613363, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 288.064880536023622426, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 304.6936264040327273506, tolerance = tolerance)) > > > res2 <- mvord::mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + X2, + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)), + X2 = matrix(c(rep(0,2),rep(1,2)), ncol = 1))) > > mvord:::check(all.equal(res$beta, res2$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res2$sebeta, tolerance = tolerance)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + offset(X2), + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + offset(X2), data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = list(X1 = cbind(c(1, 1, 0, 0), c(0, 0, 1, 1))), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + offset(X2) link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -194.33 403.71 423.31 78 Thresholds: Estimate Std. Error z value 1 1|2 -0.76726526230223290881 0.12023341892342831461 -6.3814599999999996882 1 2|3 0.89190483009970544792 0.13058942975202555981 6.8298399999999999110 2 1|2 -0.79675344626816624327 0.11172347359918627374 -7.1314799999999998192 2 2|3 0.87294080476112090317 0.13662238116423594536 6.3894399999999995643 Pr(>|z|) 1 1|2 1.7540e-10 *** 1 2|3 8.5010e-12 *** 2 1|2 9.9297e-13 *** 2 2|3 1.6649e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.53370081959011461681 0.13636430505431412774 3.9137900000000001022 X1 2 0.34385576067169915104 0.10634167794017658493 3.2334999999999998188 Pr(>|z|) X1 1 9.086e-05 *** X1 2 0.0012228 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.940808527820523377017 0.033697206769472437538 27.919480000000000075 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.7672652623027305107684, 0.8919048301000485068357, -0.7967534462687086982413, 0.8729408047614937160574), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.5337008195901541407480, 0.3438557606717420056519), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9408085278204662005308), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1202334189234334493879, 0.1305894297520299174309, 0.1117234735991832761393, 0.1366223811642423013879), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1363643050543318635537, 0.1063416779401736012023), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.03369720676949919391241), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -194.3258468555947047207, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 403.705457152049632441, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 423.314265003572927526, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1, + offset = list(df$X2[1:100], df$X2[101:200]), + data = df, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > > mvord:::check(all.equal(res$beta, res2$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res2$sebeta, tolerance = tolerance)) > > res3 <- mvord::mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + offset(X2), + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > mvord:::check(all.equal(res$beta, res3$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res3$sebeta, tolerance = tolerance)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvlogit(), + #solver = "newuoa", + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(NA, NA), c(1,2)), + coef.values = cbind(c(1, 1), c(NA,NA))) > #rho <- res$rho > > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~1), link = mvlogit(), coef.constraints = cbind(c(NA, NA), c(1, 2)), coef.values = cbind(c(1, 1), c(NA, NA)), threshold.constraints = c(1, 1)) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvlogit flexible 100 2 -135.52 281.57 295.28 180 Thresholds: Estimate Std. Error z value 1 1|2 -1.58328853691710325080 0.25851087521015303494 -6.1246499999999999275 1 2|3 1.75864257978098414981 0.24251595835343375818 7.2516600000000002169 2 1|2 -1.58328853691710325080 0.25851087521015303494 -6.1246499999999999275 2 2|3 1.75864257978098414981 0.24251595835343375818 7.2516600000000002169 Pr(>|z|) 1 1|2 9.0883e-10 *** 1 2|3 4.1170e-13 *** 2 1|2 9.0883e-10 *** 2 2|3 4.1170e-13 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X2 1 -0.77306066201133261107 0.26732809962259085346 -2.8917999999999999261 X2 2 -0.72430296230010837721 0.24403985402359068546 -2.9679700000000002191 Pr(>|z|) X2 1 0.0038304 ** X2 2 0.0029977 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.855894580949125072244 0.060599146841922621465 14.123870000000000147 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > tolerance2 <- 1e-4 > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.583288915548024533564, 1.758642501421955106622, -1.583288915548024533564, 1.758642501421955106622), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(-0.7730608423417825170176, -0.7243032675736262859800), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8558944465934688050623), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2585108482987530376107, 0.2425159370850978601819, 0.2585108482987530376107, 0.2425159370850978601819), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.2673280928737744588375, 0.2440398419906193439033), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06059919526643173237623), tolerance = tolerance2)) > mvord:::check(all.equal(logLik(res)[[1]], -135.5210996495467554723, tolerance = tolerance2)) > mvord:::check(all.equal(AIC(res), 281.568515088567210114, tolerance = tolerance2)) > mvord:::check(all.equal(BIC(res), 295.2799371200834457341, tolerance = tolerance2)) > > # res1 <- mvord::mvord(formula = MMO(Y) ~ 1 + X1 + X2, > # data = df, > # index = c("i", "j"), > # link = mvprobit(), > # solver = "BFGS", > # se = TRUE, > # error.structure = cor_equi(~1), > # threshold.constraints = c(1,1), > # coef.constraints = list(Intercept = matrix(rep(1,6), ncol = 1), > # X2 = cbind(c(1,1,1,0,0,0), c(0,0,0,1,1,1)), X1 = matrix(rep(1,6), ncol = 1))) > > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X3, + 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)) > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X3, data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X3 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -136.05 284.87 301.5 34 Thresholds: Estimate Std. Error z value 1 1|2 -1.21270698725037129329 0.21131407873814866960 -5.7388799999999999812 1 2|3 0.75845153901176631805 0.18860790313554207098 4.0213099999999997181 2 1|2 -1.21270698725037129329 0.21131407873814866960 -5.7388799999999999812 2 2|3 0.75845153901176631805 0.18860790313554207098 4.0213099999999997181 Pr(>|z|) 1 1|2 9.5302e-09 *** 1 2|3 5.7874e-05 *** 2 1|2 9.5302e-09 *** 2 2|3 5.7874e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error X1 1 0.582346304092164257504 0.133874274950955496344 X3(-0.2,0.2] 1 0.065949564660296139396 0.394250784463485104414 X3(0.2, Inf] 1 -0.639867558058156649103 0.239596299509497845381 z value Pr(>|z|) X1 1 4.34994999999999976126 1.3617e-05 *** X3(-0.2,0.2] 1 0.16728000000000001202 0.8671512 X3(0.2, Inf] 1 -2.67060999999999992838 0.0075714 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.857975765661059597278 0.062391829886098891522 13.751409999999999911 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.212706987250618206886, 0.758451539011639419563, -1.212706987250618206886, 0.758451539011639419563), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.58234630409261545214150, 0.06594956465951176682871, -0.63986755805831896370961), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8579757656611409766256), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2113140787381464491546, 0.1886079031355630819533, 0.2113140787381464491546, 0.1886079031355630819533), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1338742749509412854891, 0.3942507844634823288565, 0.2395962995094961522913), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06239182988606906121731), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -136.0526219854373835005, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 284.8712014176832667545, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 301.499947285692371679, tolerance = tolerance)) > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 1 + 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), + threshold.values = list(c(-1,NA), + c(-1,NA)), + coef.constraints = c(1,1)) > res.summary <- summary(res, short = TRUE) Call: mvord::mvord(formula = MMO(Y) ~ 1 + X1 * X2, data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), threshold.values = list(c(-1, NA), c(-1, NA)), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 1 + X1 * X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit fix1first 100 2 -134.63 282.02 298.65 34 Thresholds: Estimate Std. Error z value 1 1|2 -1.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.00269513578732416548 0.22781659168150072969 4.4013299999999997425 Pr(>|z|) 1 1|2 NA 1 2|3 1.0759e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error (Intercept) 1 -0.021913582738025384755 0.167100624889530591233 X1 1 0.621621046245967145971 0.138540865251019801319 X2 1 -0.427624354284268537452 0.140667605271754703189 X1:X2 1 -0.102567255999721287929 0.150381573286269054623 z value Pr(>|z|) (Intercept) 1 -0.13114000000000000656 0.8956645 X1 1 4.48690999999999995396 7.2262e-06 *** X2 1 -3.03996000000000021757 0.0023661 ** X1:X2 1 -0.68205000000000004512 0.4952094 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.853574805224538435411 0.063090989221389948138 13.529270000000000351 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.000000000000000000000, 1.002695135787324165477), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(-0.02191358273802538475516, 0.62162104624596714597118, -0.42762435428426853745165, -0.10256725599972128792903), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8535748052245384354109), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.0000000000000000000000, 0.2278165916815008962271), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1671006248895306467439, 0.1385408652510198845853, 0.1406676052717547309445, 0.1503815732862690546234), tolerance = tolerance)) > #mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.063097735777156036), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06309098922138993426056), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.6255603757719541136, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.0170781983524079806, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 298.6458240663615129051, tolerance = tolerance)) > ######################################################################################## > df_NA <- df[-c(1,90:110),] > > > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_NA, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 99 2 -119.45 258.71 284.4 51 Thresholds: Estimate Std. Error z value 1 1|2 -1.02012637737389844084 0.19996641229614070534 -5.1014900000000000801 1 2|3 1.14180364925262156639 0.22379090693934000633 5.1021000000000000796 2 1|2 -0.90662822300351997296 0.19059651595704024674 -4.7567899999999996297 2 2|3 0.99945117269173178176 0.17403069740197851800 5.7429600000000000648 Pr(>|z|) 1 1|2 3.3699e-07 *** 1 2|3 3.3590e-07 *** 2 1|2 1.9669e-06 *** 2 2|3 9.3036e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.83733616646617137214 0.18898470050444338142 4.4307100000000003703 X1 2 0.49821075302607176205 0.16630384260854050305 2.9957899999999999530 X2 1 -0.44740279449456488159 0.18763575165139662060 -2.3844199999999999839 X2 2 -0.35390389963374180304 0.14489624593604932823 -2.4424600000000000755 Pr(>|z|) X1 1 9.3924e-06 *** X1 2 0.0027374 ** X2 1 0.0171060 * X2 2 0.0145874 * --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.910650307821128435215 0.070553566078478416324 12.907220000000000582 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.0201263773742383911269, 1.1418036492524186176212, -0.9066282230038859024646, 0.9994511726914282467860), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8373361664658567349306, 0.4982107530258053085248, -0.4474027944949834356692, -0.3539038996339812781500), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9106503078209118307029), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1999664122961394840949, 0.2237909069393826111405, 0.1905965159570501277209, 0.1740306974019930341679), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1889847005044749950198, 0.1663038426085674814647, 0.1876357516513920686840, 0.1448962459360401411335), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.07055356607861483497768), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -119.4526280916837492896, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 258.7052561833675099479, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 284.3969426996999345647, tolerance = tolerance)) > > #weights > df_NA$weights <- 0.5 > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + weights.name = "weights", + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_NA, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), weights.name = "weights") Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 99 2 -59.73 139.25 164.94 470 Thresholds: Estimate Std. Error z value 1 1|2 -1.02012812480871528642 0.39993316222628882972 -2.5507499999999998508 1 2|3 1.14180477101864741307 0.44758335787565117769 2.5510399999999999743 2 1|2 -0.90661610117580127000 0.38119353284182333486 -2.3783599999999998076 2 2|3 0.99945811052964006471 0.34806068555282732024 2.8715099999999997848 Pr(>|z|) 1 1|2 0.0107492 * 1 2|3 0.0107401 * 2 1|2 0.0173898 * 2 2|3 0.0040852 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.83733318754043106757 0.37797050239240559399 2.2153399999999998649 X1 2 0.49821357229097545938 0.33260837571971485493 1.4979000000000000092 X2 1 -0.44740660005602911342 0.37527222777998581194 -1.1922200000000000575 X2 2 -0.35390625839926942442 0.28979246676291725571 -1.2212400000000001032 Pr(>|z|) X1 1 0.026737 * X1 2 0.134160 X2 1 0.233175 X2 2 0.221995 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.91064682418431319721 0.14111087043920636508 6.4534099999999998687 Pr(>|z|) corr 1 2 1.0936e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.0201283793713198377873, 1.1418048707357395521456, -0.9066161533747665313143, 0.9994581570190742558779), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8373332969208180376341, 0.4982136050008418859392, -0.4474066175154422508875, -0.3539061566757252808024), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9106469196938988819312), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.3999331442401471981007, 0.4475833313547766811880, 0.3811935020996289336104, 0.3480606771313752845209), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.3779704499331774103510, 0.3326083385001772918521, 0.3752721890043577146479, 0.2897924558296670061175), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.1411107414052604758226), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -59.72631403934757088336, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 139.2526280786951531354, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 164.944314595027606174, tolerance = tolerance)) > ########################################################################################## > df_23 <- df > > ##For the first response (first 100 obs), replace the level 3 by 2. > ## Now the first response has 2 levels and the second one 3 levels > df_23$Y[which(df_23$Y[1:100] == 3)] <- 2 > > ## Must be converted to integer. Ordered factor is not OK, as we have diff number of responses. > df_23$Y <- as.integer(df_23$Y) > > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_23, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_23, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -109.15 235.69 258.34 52 Thresholds: Estimate Std. Error z value 1 1|2 -0.97243369041145588660 0.20101574846710046351 -4.8376000000000001222 2 1|2 -0.97734151029783122855 0.18730956260707903871 -5.2177899999999999281 2 2|3 1.01224642882576909564 0.15713428754508013130 6.4419199999999996464 Pr(>|z|) 1 1|2 1.3142e-06 *** 2 1|2 1.8107e-07 *** 2 2|3 1.1797e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.82969552084031761297 0.22409294296771067878 3.7024599999999998623 X1 2 0.53332636576341019286 0.14638351173003005812 3.6433499999999998664 X2 1 -0.39479319852757205345 0.18931396166552202920 -2.0853899999999998549 X2 2 -0.38625976505564324492 0.13976399874801781475 -2.7636599999999997834 Pr(>|z|) X1 1 0.00021352 *** X1 2 0.00026911 *** X2 1 0.03703403 * X2 2 0.00571576 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.85295804978384348605 0.10226978918638686411 8.3402700000000002944 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > > mvord:::check(all.equal(res.summary$thresholds$Estimate, + c(-0.9724336904108278334391, -0.9773415102989740921302, 1.0122464288213952610107), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8296955208405573101160, 0.5333263657626993170524, -0.3947931985275920929723, -0.3862597650564197349077), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8529580497839671648919), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2010157484670624383760, 0.1873095626070425123721, 0.1571342875452053644558), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.2240929429677874784588, 0.1463835117300714416810, 0.1893139616655838686210, 0.1397639987481304746364), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.1022697891863128538681), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -109.147957798495554016, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 235.6872199448172011671, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 258.3408737360180111864, tolerance = tolerance)) > > ########################################################################################## > ## make three responses > suppressWarnings(RNGversion("3.5.0")) > set.seed(100) > Y3 <- sample(1:3, nobs, replace = TRUE) > dat_3 <- cbind(Y3, data_toy_example) > res <- mvord::mvord(formula = MMO2(Y1, Y2, Y3) ~ 0, + data = dat_3, + link = mvprobit(), + error.structure = cor_general(~1), + control= mvord.control(solver="BFGS",se=TRUE)) Warning message: Responses are unordered. Natural ordering is used. > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO2(Y1, Y2, Y3) ~ 0, data = dat_3, error.structure = cor_general(~1), link = mvprobit(), control = mvord.control(solver = "BFGS", se = TRUE)) Formula: MMO2(Y1, Y2, Y3) ~ 0 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 3 -565.19 1163.2 1205.96 52 Thresholds: Estimate Std. Error z value Y1 1|2 -0.70654808839442972968 0.14413615638980573075 -4.9019500000000002515 Y1 2|3 0.84166389562761123599 0.15094934798831763367 5.5758000000000000895 Y2 1|2 -0.80564017944257926285 0.14777311388303038253 -5.4518700000000004380 Y2 2|3 0.87834342403448395498 0.15259796098861780345 5.7559300000000002129 Y3 1|2 -0.52550677773958742733 0.13805473124275705055 -3.8065099999999998381 Y3 2|3 0.43872841951737284738 0.13625729487946994234 3.2198500000000001009 Pr(>|z|) Y1 1|2 9.4890e-07 *** Y1 2|3 2.4639e-08 *** Y2 1|2 4.9842e-08 *** Y2 2|3 8.6165e-09 *** Y3 1|2 0.00014094 *** Y3 2|3 0.00128256 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value Pr(>|z|) Error Structure: Estimate Std. Error corr Y1 Y2 0.908534877536116503016 0.039421737990092485526 corr Y1 Y3 -0.068886066523438385656 0.133978933777760100821 corr Y2 Y3 -0.150586382344864100347 0.129319546675897428800 z value Pr(>|z|) corr Y1 Y2 23.0465499999999998693 < 2e-16 *** corr Y1 Y3 -0.5141599999999999504 0.60714 corr Y2 Y3 -1.1644499999999999851 0.24424 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > > mvord:::check(all.equal(res.summary$thresholds$Estimate, + c(-0.70654808839454852354, 0.84166389562778798350 ,-0.80564017944211274713, + 0.87834342403465937021, -0.52550677773899212575, 0.43872841951666374793), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, + c(0.908534877536098850470 , -0.068886066520331828977, -0.150586382347683067628), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, + c(0.14413615638981053246, 0.15094934798830694778, 0.14777311388303066009, + 0.15259796098859162994, 0.13805473124275577379, 0.13625729487947765839), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.039421737990101658744,0.133978933777893494117,0.129319546675785962409), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -565.1857975044365502981, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 1163.199625517649110407, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 1205.960928690734590418, tolerance = tolerance)) > ########################################## > ### fixed coefs fixed thresholds > ########################################### > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.values = list(c(-1,1), c(-1,1)), + coef.values = matrix(c(0.8,-0.5, 0.8,-0.5),ncol=2, byrow=TRUE), + control= mvord.control(solver="BFGS",se=TRUE)) We suggest to include an intercept in the model (formula = y ~ 1 + ...)Error in rho[["constraints_mat"]] %*% par_beta : non-conformable arguments Error in optimx.check(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower, : Cannot evaluate function at initial parameters Calls: <Anonymous> -> mvord.fit Execution halted Flavor: r-devel-linux-x86_64-fedora-gcc

Version: 1.1.1
Check: tests
Result: ERROR Running 'check_methods.R' [4s] Running 'check_mvord_data.R' [2s] Running 'check_mvord_errors.R' [2s] Running 'check_set_threshold_type.R' [2s] Running 'check_toy_example.R' [24s] Running 'check_transf_sigmas.R' [2s] Running 'check_transf_thresholds.R' [2s] 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 > suppressWarnings(RNGversion("3.5.0")) > 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 = FALSE), + "f2" = factor(rep(data_toy_example$Y1,2), ordered = FALSE), + w = rep(w,2)) > df$X3 <- cut(df$X2, c(-Inf, -0.2, 0.2, Inf)) > > > > # 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, + link = mvprobit(), + 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=TRUE)) 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. > options(digits = 22) > > 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 = TRUE)) 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 1 1|2 -0.96257386663499888702 0.16613952738603396386 -5.7937700000000003087 1 2|3 1.03347036873238828925 0.15004482537615168591 6.8877399999999999736 2 1|2 -0.96257386663499888702 0.16613952738603396386 -5.7937700000000003087 2 2|3 1.03347036873238828925 0.15004482537615168591 6.8877399999999999736 Pr(>|z|) 1 1|2 6.8825e-09 *** 1 2|3 5.6684e-12 *** 2 1|2 6.8825e-09 *** 2 2|3 5.6684e-12 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.63801035062442590373 0.13576747301354935571 4.6992900000000004113 X2 1 -0.42672524816265555714 0.13643665802445156809 -3.1276399999999999757 Pr(>|z|) X1 1 2.6107e-06 *** X2 1 0.0017621 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.854266728221043991631 0.062440889990424582046 13.681210000000000093 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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"), + 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, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + control= mvord.control(solver="BFGS",se=TRUE)) > 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 = TRUE)) 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 1 1|2 -0.75479706538162727458 0.13105603927552006427 -5.7593500000000004135 1 2|3 0.86086304364912058507 0.13360642334434574829 6.4432799999999996743 2 1|2 -0.75479706538162727458 0.13105603927552006427 -5.7593500000000004135 2 2|3 0.86086304364912058507 0.13360642334434574829 6.4432799999999996743 Pr(>|z|) 1 1|2 8.4440e-09 *** 1 2|3 1.1692e-10 *** 2 1|2 8.4440e-09 *** 2 2|3 1.1692e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value Pr(>|z|) Error Structure: Estimate Std. Error z value corr 1 2 0.905795171446388658332 0.038855435949046335242 23.311930000000000263 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + control= mvord.control(solver="BFGS",se=TRUE)) 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 = TRUE)) Formula: MMO(Y) ~ 1 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit fix1first 100 2 -153.56 315.46 326.32 54 Thresholds: Estimate Std. Error z value 1 1|2 0.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.61576075463128843168 0.15607113685033857653 10.3527199999999997 2 1|2 0.00000000000000000000 0.00000000000000000000 NA 2 2|3 1.61576075463128843168 0.15607113685033857653 10.3527199999999997 Pr(>|z|) 1 1|2 NA 1 2|3 < 2.22e-16 *** 2 1|2 NA 2 2|3 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error (Intercept) 1 0.73786225415091910573 0.13500906210231616855 (Intercept) 2 0.77255634796640459960 0.14063945841907260492 z value Pr(>|z|) (Intercept) 1 5.4652799999999999159 4.6218e-08 *** (Intercept) 2 5.4931700000000001083 3.9478e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.906373932680408223028 0.038916052671567342991 23.290489999999998361 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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 1 1|2 -0.90552506790523046298 0.18265647646916075009 -4.9575300000000002143 1 2|3 1.00420547521799474744 0.17467164336592064244 5.7491000000000003212 2 1|2 -0.90552506790523046298 0.18265647646916075009 -4.9575300000000002143 2 2|3 1.00420547521799474744 0.17467164336592064244 5.7491000000000003212 Pr(>|z|) 1 1|2 7.1395e-07 *** 1 2|3 8.9718e-09 *** 2 1|2 7.1395e-07 *** 2 2|3 8.9718e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.64793126338544548837 0.14153585035878471499 4.5778600000000002623 X2 1 -0.42893128334062652351 0.13989943737307897198 -3.0659999999999998366 Pr(>|z|) X1 1 4.6976e-06 *** X2 1 0.0021695 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error corr f21 1 2 0.736678597233872745065 0.178238394308662423393 corr f22 1 2 0.918298263052335417278 0.068858656199963313993 corr f23 1 2 0.837106119713062812870 0.131036082998403219380 z value Pr(>|z|) corr f21 1 2 4.1331100000000002836 3.5789e-05 *** corr f22 1 2 13.3359900000000006770 < 2.22e-16 *** corr f23 1 2 6.3883599999999995944 1.6767e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 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, + link = mvlogit(df = 8L), + error.structure = cor_general(~1)) > #threshold.constraints = c(1,1), > #coef.constraints = c(1,1)) > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y, i, j) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~1), link = mvlogit(df = 8L)) Formula: MMO(Y, i, j) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvlogit flexible 100 2 -132.87 285.51 311.28 577 Thresholds: Estimate Std. Error z value 1 1|2 -1.61992737593234226168 0.33738755538628556474 -4.8013799999999999812 1 2|3 1.83247486840983819789 0.36742751710892490591 4.9873099999999999099 2 1|2 -1.61590134864211965038 0.33963204146806280637 -4.7577999999999995850 2 2|3 1.74613474535708190771 0.30112277657338160086 5.7987500000000000711 Pr(>|z|) 1 1|2 1.5757e-06 *** 1 2|3 6.1226e-07 *** 2 1|2 1.9571e-06 *** 2 2|3 6.6812e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 1.28924147226571261804 0.30395056000140890928 4.2416200000000001680 X1 2 0.88420331656816741894 0.29740832947245010587 2.9730300000000000615 X2 1 -0.84290937032158830267 0.30080366307813405369 -2.8021899999999999586 X2 2 -0.71568732513894184333 0.25697673972246015683 -2.7850299999999998946 Pr(>|z|) X1 1 2.2192e-05 *** X1 2 0.0029488 ** X2 1 0.0050757 ** X2 2 0.0053523 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.883893587017596016331 0.071174597846466347573 12.418670000000000542 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.6170817306633420, 1.7855897338762188, -1.6170817306633420, 1.7855897338762188), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$coefficients$Estimate, c(1.07242200717115987, 1.07242200717115987, -0.76715925377701732, -0.76715925377701732), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.85317690560688531), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.28997405649500174, 0.27427389826231802, 0.28997405649500174, 0.27427389826231802), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.24111402270822993, 0.24111402270822993, 0.24156664773225886, 0.24156664773225886), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.063316529381183581), tolerance = tolerance)) > # mvord:::check(all.equal(logLik(res), -135.41665313840898, tolerance = tolerance)) > # mvord:::check(all.equal(AIC(res), 281.35962206629165, tolerance = tolerance)) > # mvord:::check(all.equal(BIC(res), 295.07104409780789, tolerance = tolerance)) > > ################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cov_general(~1), + threshold.constraints = c(1,1), + threshold.values = list(c(-1,NA), + c(-1,NA)), + coef.constraints = c(1,1)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cov_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), threshold.values = list(c(-1, NA), c(-1, NA)), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit fix1first 100 2 -134.64 282.04 298.67 37 Thresholds: Estimate Std. Error z value 1 1|2 -1.0000000000000000000 0.0000000000000000000 NA 1 2|3 1.0826679800833745038 0.2492604341815171376 4.3435199999999998255 2 1|2 -1.0000000000000000000 0.0000000000000000000 NA 2 2|3 1.0826679800833745038 0.2492604341815171376 4.3435199999999998255 Pr(>|z|) 1 1|2 NA 1 2|3 1.4022e-05 *** 2 1|2 NA 2 2|3 1.4022e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.68834946142093178523 0.15128036741853495561 4.5501599999999999824 X2 1 -0.45406517655051331639 0.15704134440910930137 -2.8913700000000002177 Pr(>|z|) X1 1 5.3606e-06 *** X2 1 0.0038356 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.856153637803174327736 0.061822221469819631234 13.8486399999999996169 sigma 1 1.001934583868918871019 0.185187960683921543081 5.4103700000000003456 sigma 2 1.089828199315766354971 0.197593289723851150974 5.5155099999999999127 Pr(>|z|) corr 1 2 < 2.22e-16 *** sigma 1 6.2896e-08 *** sigma 2 3.4777e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.000000000000000000000, 1.082667980083374503764, -1.000000000000000000000, 1.082667980083374503764), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6883494614209317852271, -0.4540651765505133163892), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8561536378031743277361, 1.0019345838689188710191, 1.0898281993157663549709), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.0000000000000000000000, 0.2492604341815170820862, 0.0000000000000000000000, 0.2492604341815170820862), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1512803674185349001036, 0.1570413444091093568833), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06182222146981963123435, 0.18518796068392143205905, 0.19759328972385112321852), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.6391112878561102661, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.0441800225207202857, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 298.6729258905298252103, tolerance = tolerance)) > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_equi(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(1,1),c(1,2))) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_equi(~1), link = mvprobit(), coef.constraints = cbind(c(1, 1), c(1, 2)), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -134.84 282.45 299.08 35 Thresholds: Estimate Std. Error z value 1 1|2 -0.96275665235849350321 0.16703865743956156087 -5.7636799999999999145 1 2|3 1.03388029135981107665 0.15203091606548349568 6.8004600000000001714 2 1|2 -0.96275665235849350321 0.16703865743956156087 -5.7636799999999999145 2 2|3 1.03388029135981107665 0.15203091606548349568 6.8004600000000001714 Pr(>|z|) 1 1|2 8.2301e-09 *** 1 2|3 1.0429e-11 *** 2 1|2 8.2301e-09 *** 2 2|3 1.0429e-11 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.63820467410984904610 0.13670492809261164391 4.6684799999999997411 X2 1 -0.44676561119570956659 0.15900879662663833236 -2.8096899999999997988 X2 2 -0.40750155519148029137 0.13850979189698683913 -2.9420399999999999885 Pr(>|z|) X1 1 3.0343e-06 *** X2 1 0.0049589 ** X2 2 0.0032606 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value (Intercept) 1.272900571254562907 0.232216118479298822 5.4815300000000002356 Pr(>|z|) (Intercept) 4.2165e-08 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.9627566523584676350112, 1.0338802913596250032668, -0.9627566523584676350112, 1.0338802913596247812222), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6382046741095841468905, -0.4467656111955374820255, -0.4075015551913261924177), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$Estimate, c(1.272900571254629964457), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1670386574395647250046, 0.1520309160654948199554, 0.1670386574395647250046, 0.1520309160654948199554), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1367049280926301846328, 0.1590087966266460206555, 0.1385097918969951935608), tolerance = tolerance)) > # mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.2322161184793045674013), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.8432321319771745038, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.4524217107628487611, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 299.0811675787719536856, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_equi(~1), + threshold.constraints = c(1,1), + coef.constraints = list(X2 = cbind(c(1,1,0,0), c(0,0,1,1)), + X1 = 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)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_ar1(~ 1 + X1), + threshold.constraints = c(1,1), + coef.constraints = c(1,1)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_ar1(~1 + X1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -133.94 280.64 297.27 35 Thresholds: Estimate Std. Error z value 1 1|2 -0.95722951152657487217 0.16558288168119045247 -5.7809699999999999420 1 2|3 1.03746793968333328451 0.15306952616698060732 6.7777599999999997848 2 1|2 -0.95722951152657487217 0.16558288168119045247 -5.7809699999999999420 2 2|3 1.03746793968333328451 0.15306952616698060732 6.7777599999999997848 Pr(>|z|) 1 1|2 7.4272e-09 *** 1 2|3 1.2206e-11 *** 2 1|2 7.4272e-09 *** 2 2|3 1.2206e-11 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.65304208674288677372 0.13584016202004495222 4.8074300000000000921 X2 1 -0.42273136793570653680 0.13820217716269447839 -3.0587900000000001199 Pr(>|z|) X1 1 1.5288e-06 *** X2 1 0.0022223 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error (Intercept) 1.29891554197123726411 0.24517466007551522167 X1 0.29350892362879726916 0.29416988646864372647 z value Pr(>|z|) (Intercept) 5.29792000000000040671 1.1713e-07 *** X1 0.99775000000000002576 0.3184 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.9572295115261755249492, 1.0374679396833161870717, -0.9572295115261755249492, 1.0374679396833161870717), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.6530420867428219366957, -0.4227313679354475217664), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(1.298915541971320308789, 0.293508923629326790028), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1655828816811988069002, 0.1530695261669812456962, 0.1655828816811988069002, 0.1530695261669812456962), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1358401620200463122412, 0.1382021771627104100855), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.2451746600755327076815, 0.2941698864686516090572), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -133.938827675498004055, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 280.6436127978045078635, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 297.272358665813612788, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_ar1(~1 + X1), + 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)) > > ######################################################################################## > res <- mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + X2, + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(1,2),c(NA,1))) > > res.summary <- summary(res, short = FALSE) Call: mvord(formula = MMO2(Y1, Y2) ~ 0 + X1 + X2, data = data_toy_example, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = cbind(c(1, 2), c(NA, 1)), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO2(Y1, Y2) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -137.65 288.06 304.69 63 Thresholds: Estimate Std. Error z value Y1 1|2 -0.89892942527381680673 0.16246077762268909539 -5.5332100000000004059 Y1 2|3 0.98413365940576202906 0.15981657213961206199 6.1578900000000000858 Y2 1|2 -0.89892942527381691775 0.16246077762268909539 -5.5332100000000004059 Y2 2|3 0.98413365940576202906 0.15981657213961206199 6.1578900000000000858 Pr(>|z|) Y1 1|2 3.1442e-08 *** Y1 2|3 7.3718e-10 *** Y2 1|2 3.1442e-08 *** Y2 2|3 7.3718e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.681944859288887594850 0.174961892922583350796 3.89767999999999981142 X1 2 0.468376583108680188960 0.157106006693616268022 2.98127999999999993008 X2 1 -0.052179801987867542590 0.089798215416100737873 -0.58108000000000004093 Pr(>|z|) X1 1 9.712e-05 *** X1 2 0.0028705 ** X2 1 0.5611876 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr Y1 Y2 0.890390657144618291596 0.063175533024045271713 14.09392000000000067 Pr(>|z|) corr Y1 Y2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.8989294252736504953205, 0.9841336594057152886705, -0.8989294252736503842982, 0.9841336594057153996928), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.68194485928859438494953, 0.46837658310856356003171, -0.05217980198794509860694), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8903906571446290607597), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1624607776227008359982, 0.1598165721396140603883, 0.1624607776227008359982, 0.1598165721396140603883), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.17496189292260000414103, 0.15710600669362786985239, 0.08979821541610534529898), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.0631755330240382911855), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -137.6494615446075613363, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 288.064880536023622426, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 304.6936264040327273506, tolerance = tolerance)) > > > res2 <- mvord::mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + X2, + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)), + X2 = matrix(c(rep(0,2),rep(1,2)), ncol = 1))) > > mvord:::check(all.equal(res$beta, res2$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res2$sebeta, tolerance = tolerance)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + offset(X2), + data = df, + #index = c("i", "j"), + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + offset(X2), data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = list(X1 = cbind(c(1, 1, 0, 0), c(0, 0, 1, 1))), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + offset(X2) link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -194.33 403.71 423.31 78 Thresholds: Estimate Std. Error z value 1 1|2 -0.76726526230223290881 0.12023341892342831461 -6.3814599999999996882 1 2|3 0.89190483009970544792 0.13058942975202555981 6.8298399999999999110 2 1|2 -0.79675344626816624327 0.11172347359918627374 -7.1314799999999998192 2 2|3 0.87294080476112090317 0.13662238116423594536 6.3894399999999995643 Pr(>|z|) 1 1|2 1.7540e-10 *** 1 2|3 8.5010e-12 *** 2 1|2 9.9297e-13 *** 2 2|3 1.6649e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.53370081959011461681 0.13636430505431412774 3.9137900000000001022 X1 2 0.34385576067169915104 0.10634167794017658493 3.2334999999999998188 Pr(>|z|) X1 1 9.086e-05 *** X1 2 0.0012228 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.940808527820523377017 0.033697206769472437538 27.919480000000000075 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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.7672652623027305107684, 0.8919048301000485068357, -0.7967534462687086982413, 0.8729408047614937160574), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.5337008195901541407480, 0.3438557606717420056519), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9408085278204662005308), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1202334189234334493879, 0.1305894297520299174309, 0.1117234735991832761393, 0.1366223811642423013879), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1363643050543318635537, 0.1063416779401736012023), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.03369720676949919391241), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -194.3258468555947047207, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 403.705457152049632441, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 423.314265003572927526, tolerance = tolerance)) > > res2 <- mvord::mvord(formula = MMO(Y) ~ 0 + X1, + offset = list(df$X2[1:100], df$X2[101:200]), + data = df, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > > mvord:::check(all.equal(res$beta, res2$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res2$sebeta, tolerance = tolerance)) > > res3 <- mvord::mvord(formula = MMO2(Y1,Y2) ~ 0 + X1 + offset(X2), + data = data_toy_example, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,2), + coef.constraints = list(X1 = cbind(c(1,1,0,0), c(0,0,1,1)))) > mvord:::check(all.equal(res$beta, res3$beta, tolerance = tolerance)) > mvord:::check(all.equal(res$sebeta, res3$sebeta, tolerance = tolerance)) > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df, + #index = c("i", "j"), + link = mvlogit(), + #solver = "newuoa", + #se = TRUE, + error.structure = cor_general(~1), + threshold.constraints = c(1,1), + coef.constraints = cbind(c(NA, NA), c(1,2)), + coef.values = cbind(c(1, 1), c(NA,NA))) > #rho <- res$rho > > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df, error.structure = cor_general(~1), link = mvlogit(), coef.constraints = cbind(c(NA, NA), c(1, 2)), coef.values = cbind(c(1, 1), c(NA, NA)), threshold.constraints = c(1, 1)) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvlogit flexible 100 2 -135.52 281.57 295.28 150 Thresholds: Estimate Std. Error z value 1 1|2 -1.58328892697782519505 0.25851085233511844619 -6.1246499999999999275 1 2|3 1.75864250788365961142 0.24251594148065969136 7.2516600000000002169 2 1|2 -1.58328892697782519505 0.25851085233511844619 -6.1246499999999999275 2 2|3 1.75864250788365961142 0.24251594148065969136 7.2516600000000002169 Pr(>|z|) 1 1|2 9.0882e-10 *** 1 2|3 4.1170e-13 *** 2 1|2 9.0882e-10 *** 2 2|3 4.1170e-13 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X2 1 -0.77306097199511181195 0.26732809082944253287 -2.8918099999999999916 X2 2 -0.72430349472230626251 0.24403984874581674536 -2.9679700000000002191 Pr(>|z|) X2 1 0.0038303 ** X2 2 0.0029977 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.855894467973149053464 0.060599187425615069769 14.123860000000000525 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > tolerance2 <- 1e-4 > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.583288915548024533564, 1.758642501421955106622, -1.583288915548024533564, 1.758642501421955106622), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(-0.7730608423417825170176, -0.7243032675736262859800), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8558944465934688050623), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2585108482987530376107, 0.2425159370850978601819, 0.2585108482987530376107, 0.2425159370850978601819), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.2673280928737744588375, 0.2440398419906193439033), tolerance = tolerance2)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06059919526643173237623), tolerance = tolerance2)) > mvord:::check(all.equal(logLik(res)[[1]], -135.5210996495467554723, tolerance = tolerance2)) > mvord:::check(all.equal(AIC(res), 281.568515088567210114, tolerance = tolerance2)) > mvord:::check(all.equal(BIC(res), 295.2799371200834457341, tolerance = tolerance2)) > > # res1 <- mvord::mvord(formula = MMO(Y) ~ 1 + X1 + X2, > # data = df, > # index = c("i", "j"), > # link = mvprobit(), > # solver = "BFGS", > # se = TRUE, > # error.structure = cor_equi(~1), > # threshold.constraints = c(1,1), > # coef.constraints = list(Intercept = matrix(rep(1,6), ncol = 1), > # X2 = cbind(c(1,1,1,0,0,0), c(0,0,0,1,1,1)), X1 = matrix(rep(1,6), ncol = 1))) > > > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X3, + 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)) > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X3, data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X3 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -136.05 284.87 301.5 34 Thresholds: Estimate Std. Error z value 1 1|2 -1.21270698725037129329 0.21131407873814866960 -5.7388799999999999812 1 2|3 0.75845153901176631805 0.18860790313554207098 4.0213099999999997181 2 1|2 -1.21270698725037129329 0.21131407873814866960 -5.7388799999999999812 2 2|3 0.75845153901176631805 0.18860790313554207098 4.0213099999999997181 Pr(>|z|) 1 1|2 9.5302e-09 *** 1 2|3 5.7874e-05 *** 2 1|2 9.5302e-09 *** 2 2|3 5.7874e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error X1 1 0.582346304092164257504 0.133874274950955496344 X3(-0.2,0.2] 1 0.065949564660296139396 0.394250784463485104414 X3(0.2, Inf] 1 -0.639867558058156649103 0.239596299509497845381 z value Pr(>|z|) X1 1 4.34994999999999976126 1.3617e-05 *** X3(-0.2,0.2] 1 0.16728000000000001202 0.8671512 X3(0.2, Inf] 1 -2.67060999999999992838 0.0075714 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.857975765661059597278 0.062391829886098891522 13.751409999999999911 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.212706987250618206886, 0.758451539011639419563, -1.212706987250618206886, 0.758451539011639419563), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.58234630409261545214150, 0.06594956465951176682871, -0.63986755805831896370961), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8579757656611409766256), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2113140787381464491546, 0.1886079031355630819533, 0.2113140787381464491546, 0.1886079031355630819533), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1338742749509412854891, 0.3942507844634823288565, 0.2395962995094961522913), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06239182988606906121731), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -136.0526219854373835005, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 284.8712014176832667545, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 301.499947285692371679, tolerance = tolerance)) > ######################################################################################## > res <- mvord::mvord(formula = MMO(Y) ~ 1 + 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), + threshold.values = list(c(-1,NA), + c(-1,NA)), + coef.constraints = c(1,1)) > res.summary <- summary(res, short = TRUE) Call: mvord::mvord(formula = MMO(Y) ~ 1 + X1 * X2, data = df, error.structure = cor_general(~1), link = mvprobit(), coef.constraints = c(1, 1), threshold.constraints = c(1, 1), threshold.values = list(c(-1, NA), c(-1, NA)), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 1 + X1 * X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit fix1first 100 2 -134.63 282.02 298.65 34 Thresholds: Estimate Std. Error z value 1 1|2 -1.00000000000000000000 0.00000000000000000000 NA 1 2|3 1.00269513578732416548 0.22781659168150072969 4.4013299999999997425 Pr(>|z|) 1 1|2 NA 1 2|3 1.0759e-05 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error (Intercept) 1 -0.021913582738025384755 0.167100624889530507966 X1 1 0.621621046245967145971 0.138540865251019801319 X2 1 -0.427624354284268537452 0.140667605271754703189 X1:X2 1 -0.102567255999721287929 0.150381573286269054623 z value Pr(>|z|) (Intercept) 1 -0.13114000000000000656 0.8956645 X1 1 4.48690999999999995396 7.2262e-06 *** X2 1 -3.03996000000000021757 0.0023661 ** X1:X2 1 -0.68205000000000004512 0.4952094 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.853574805224538435411 0.063090989221389948138 13.529270000000000351 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > mvord:::check(all.equal(res.summary$thresholds$Estimate, c(-1.000000000000000000000, 1.002695135787324165477), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(-0.02191358273802538475516, 0.62162104624596714597118, -0.42762435428426853745165, -0.10256725599972128792903), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8535748052245384354109), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.0000000000000000000000, 0.2278165916815008962271), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1671006248895306467439, 0.1385408652510198845853, 0.1406676052717547309445, 0.1503815732862690546234), tolerance = tolerance)) > #mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.063097735777156036), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.06309098922138993426056), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -134.6255603757719541136, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 282.0170781983524079806, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 298.6458240663615129051, tolerance = tolerance)) > ######################################################################################## > df_NA <- df[-c(1,90:110),] > > > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_NA, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 99 2 -119.45 258.71 284.4 51 Thresholds: Estimate Std. Error z value 1 1|2 -1.02012637737351052891 0.19996641229615236268 -5.1014900000000000801 1 2|3 1.14180364925250188435 0.22379090693932096601 5.1021000000000000796 2 1|2 -0.90662822300298373523 0.19059651595704599214 -4.7567899999999996297 2 2|3 0.99945117269137251359 0.17403069740199664239 5.7429600000000000648 Pr(>|z|) 1 1|2 3.3699e-07 *** 1 2|3 3.3590e-07 *** 2 1|2 1.9669e-06 *** 2 2|3 9.3036e-09 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.83733616646579622778 0.18898470050446236623 4.4307100000000003703 X1 2 0.49821075302565920317 0.16630384260856054257 2.9957899999999999530 X2 1 -0.44740279449415937263 0.18763575165140966572 -2.3844199999999999839 X2 2 -0.35390389963325241673 0.14489624593607869363 -2.4424600000000000755 Pr(>|z|) X1 1 9.3924e-06 *** X1 2 0.0027374 ** X2 1 0.0171060 * X2 2 0.0145874 * --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.910650307821200821756 0.070553566078427734642 12.907220000000000582 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.0201263773742383911269, 1.1418036492524186176212, -0.9066282230038859024646, 0.9994511726914282467860), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8373361664658567349306, 0.4982107530258053085248, -0.4474027944949834356692, -0.3539038996339812781500), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9106503078209118307029), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.1999664122961394840949, 0.2237909069393826111405, 0.1905965159570501277209, 0.1740306974019930341679), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.1889847005044749950198, 0.1663038426085674814647, 0.1876357516513920686840, 0.1448962459360401411335), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.07055356607861483497768), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -119.4526280916837492896, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 258.7052561833675099479, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 284.3969426996999345647, tolerance = tolerance)) > > #weights > df_NA$weights <- 0.5 > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + weights.name = "weights", + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_NA, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), weights.name = "weights") Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 99 2 -59.73 139.25 164.94 472 Thresholds: Estimate Std. Error z value 1 1|2 -1.02012825054024824922 0.39993315330717621459 -2.5507499999999998508 1 2|3 1.14180477624979115348 0.44758333888939638712 2.5510399999999999743 2 1|2 -0.90661616506435449558 0.38119351435790660432 -2.3783599999999998076 2 2|3 0.99945807115822449251 0.34806068836082060258 2.8715099999999997848 Pr(>|z|) 1 1|2 0.0107492 * 1 2|3 0.0107401 * 2 1|2 0.0173897 * 2 2|3 0.0040852 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.83733313484785520942 0.37797048927211568392 2.2153399999999998649 X1 2 0.49821352561752080268 0.33260835741097843909 1.4979000000000000092 X2 1 -0.44740651027549038776 0.37527221427704604562 -1.1922200000000000575 X2 2 -0.35390613973431295225 0.28979246443025280522 -1.2212400000000001032 Pr(>|z|) X1 1 0.026737 * X1 2 0.134160 X2 1 0.233176 X2 2 0.221995 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.91064688734819310145 0.14111078549223804446 6.4534200000000003783 Pr(>|z|) corr 1 2 1.0936e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > options(digits = 22) > > # 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(-1.0201283793713198377873, 1.1418048707357395521456, -0.9066161533747665313143, 0.9994581570190742558779), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8373332969208180376341, 0.4982136050008418859392, -0.4474066175154422508875, -0.3539061566757252808024), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.9106469196938988819312), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.3999331442401471981007, 0.4475833313547766811880, 0.3811935020996289336104, 0.3480606771313752845209), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.3779704499331774103510, 0.3326083385001772918521, 0.3752721890043577146479, 0.2897924558296670061175), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.1411107414052604758226), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -59.72631403934757088336, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 139.2526280786951531354, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 164.944314595027606174, tolerance = tolerance)) > ########################################################################################## > df_23 <- df > > ##For the first response (first 100 obs), replace the level 3 by 2. > ## Now the first response has 2 levels and the second one 3 levels > df_23$Y[which(df_23$Y[1:100] == 3)] <- 2 > > ## Must be converted to integer. Ordered factor is not OK, as we have diff number of responses. > df_23$Y <- as.integer(df_23$Y) > > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_23, + link = mvprobit(), + control = mvord.control(solver = "BFGS"), + error.structure = cor_general(~1), + threshold.constraints = c(1,2)) > > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, data = df_23, error.structure = cor_general(~1), link = mvprobit(), threshold.constraints = c(1, 2), control = mvord.control(solver = "BFGS")) Formula: MMO(Y) ~ 0 + X1 + X2 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 2 -109.15 235.69 258.34 53 Thresholds: Estimate Std. Error z value 1 1|2 -0.97243369041066884950 0.20101574846708089583 -4.8376000000000001222 2 1|2 -0.97734151029870541816 0.18730956260704784144 -5.2177899999999999281 2 2|3 1.01224642882145121625 0.15713428754520597508 6.4419199999999996464 Pr(>|z|) 1 1|2 1.3142e-06 *** 2 1|2 1.8107e-07 *** 2 2|3 1.1797e-10 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value X1 1 0.82969552084045039564 0.22409294296782589218 3.7024599999999998623 X1 2 0.53332636576263858785 0.14638351173008076755 3.6433499999999998664 X2 1 -0.39479319852743410824 0.18931396166562203254 -2.0853899999999998549 X2 2 -0.38625976505626685720 0.13976399874813491553 -2.7636599999999997834 Pr(>|z|) X1 1 0.00021352 *** X1 2 0.00026911 *** X2 1 0.03703403 * X2 2 0.00571576 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Error Structure: Estimate Std. Error z value corr 1 2 0.85295804978378753081 0.10226978918641670135 8.3402700000000002944 Pr(>|z|) corr 1 2 < 2.22e-16 *** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > > mvord:::check(all.equal(res.summary$thresholds$Estimate, + c(-0.9724336904108278334391, -0.9773415102989740921302, 1.0122464288213952610107), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$Estimate, c(0.8296955208405573101160, 0.5333263657626993170524, -0.3947931985275920929723, -0.3862597650564197349077), + tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, c(0.8529580497839671648919), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, c(0.2010157484670624383760, 0.1873095626070425123721, 0.1571342875452053644558), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$coefficients$`Std. Error`, c(0.2240929429677874784588, 0.1463835117300714416810, 0.1893139616655838686210, 0.1397639987481304746364), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.1022697891863128538681), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -109.147957798495554016, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 235.6872199448172011671, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 258.3408737360180111864, tolerance = tolerance)) > > ########################################################################################## > ## make three responses > suppressWarnings(RNGversion("3.5.0")) > set.seed(100) > Y3 <- sample(1:3, nobs, replace = TRUE) > dat_3 <- cbind(Y3, data_toy_example) > res <- mvord::mvord(formula = MMO2(Y1, Y2, Y3) ~ 0, + data = dat_3, + link = mvprobit(), + error.structure = cor_general(~1), + control= mvord.control(solver="BFGS",se=TRUE)) Warning message: Responses are unordered. Natural ordering is used. > res.summary <- summary(res, short = FALSE) Call: mvord::mvord(formula = MMO2(Y1, Y2, Y3) ~ 0, data = dat_3, error.structure = cor_general(~1), link = mvprobit(), control = mvord.control(solver = "BFGS", se = TRUE)) Formula: MMO2(Y1, Y2, Y3) ~ 0 link threshold nsubjects ndim logPL CLAIC CLBIC fevals mvprobit flexible 100 3 -565.19 1163.2 1205.96 52 Thresholds: Estimate Std. Error z value Y1 1|2 -0.70654808839442972968 0.14413615638980573075 -4.9019500000000002515 Y1 2|3 0.84166389562761123599 0.15094934798831763367 5.5758000000000000895 Y2 1|2 -0.80564017944257926285 0.14777311388303038253 -5.4518700000000004380 Y2 2|3 0.87834342403448395498 0.15259796098861780345 5.7559300000000002129 Y3 1|2 -0.52550677773958742733 0.13805473124275705055 -3.8065099999999998381 Y3 2|3 0.43872841951737284738 0.13625729487946994234 3.2198500000000001009 Pr(>|z|) Y1 1|2 9.4890e-07 *** Y1 2|3 2.4639e-08 *** Y2 1|2 4.9842e-08 *** Y2 2|3 8.6165e-09 *** Y3 1|2 0.00014094 *** Y3 2|3 0.00128256 ** --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 Coefficients: Estimate Std. Error z value Pr(>|z|) Error Structure: Estimate Std. Error corr Y1 Y2 0.908534877536116503016 0.039421737990092485526 corr Y1 Y3 -0.068886066523438385656 0.133978933777760100821 corr Y2 Y3 -0.150586382344864100347 0.129319546675897428800 z value Pr(>|z|) corr Y1 Y2 23.0465499999999998693 < 2e-16 *** corr Y1 Y3 -0.5141599999999999504 0.60714 corr Y2 Y3 -1.1644499999999999851 0.24424 --- Signif. codes: 0 '***' 0.001000000000000000020817 '**' 0.01000000000000000020817 '*' 0.05000000000000000277556 '.' 0.1000000000000000055511 ' ' 1 > > > mvord:::check(all.equal(res.summary$thresholds$Estimate, + c(-0.70654808839454852354, 0.84166389562778798350 ,-0.80564017944211274713, + 0.87834342403465937021, -0.52550677773899212575, 0.43872841951666374793), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$Estimate, + c(0.908534877536098850470 , -0.068886066520331828977, -0.150586382347683067628), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$thresholds$`Std. Error`, + c(0.14413615638981053246, 0.15094934798830694778, 0.14777311388303066009, + 0.15259796098859162994, 0.13805473124275577379, 0.13625729487947765839), tolerance = tolerance)) > mvord:::check(all.equal(res.summary$error.structure$`Std. Error`, c(0.039421737990101658744,0.133978933777893494117,0.129319546675785962409), tolerance = tolerance)) > mvord:::check(all.equal(logLik(res)[[1]], -565.1857975044365502981, tolerance = tolerance)) > mvord:::check(all.equal(AIC(res), 1163.199625517649110407, tolerance = tolerance)) > mvord:::check(all.equal(BIC(res), 1205.960928690734590418, tolerance = tolerance)) > ########################################## > ### fixed coefs fixed thresholds > ########################################### > res <- mvord::mvord(formula = MMO(Y) ~ 0 + X1 + X2, + data = df_NA, + link = mvprobit(), + error.structure = cor_general(~1), + threshold.values = list(c(-1,1), c(-1,1)), + coef.values = matrix(c(0.8,-0.5, 0.8,-0.5),ncol=2, byrow=TRUE), + control= mvord.control(solver="BFGS",se=TRUE)) We suggest to include an intercept in the model (formula = y ~ 1 + ...)Error in rho[["constraints_mat"]] %*% par_beta : non-conformable arguments Error in optimx.check(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower, : Cannot evaluate function at initial parameters Calls: <Anonymous> -> mvord.fit Execution halted Flavor: r-devel-windows-x86_64

Version: 1.1.1
Check: re-building of vignette outputs
Result: NOTE Error(s) in re-building vignettes: ... --- re-building ‘vignette_mvord2.Rmd’ using rmarkdown --- finished re-building ‘vignette_mvord2.Rmd’ --- re-building ‘vignette_mvord.Rnw’ using Sweave Loading required package: minqa Loading required package: BB Loading required package: ucminf Loading required package: dfoptim Error: processing vignette 'vignette_mvord.Rnw' failed with diagnostics: Running 'texi2dvi' on 'vignette_mvord.tex' failed. LaTeX errors: !pdfTeX error: pdflatex (file bbm10): Font bbm10 at 657 not found ==> Fatal error occurred, no output PDF file produced! --- failed re-building 'vignette_mvord.Rnw' SUMMARY: processing the following file failed: ‘vignette_mvord.Rnw’ Error: Vignette re-building failed. Execution halted Flavor: r-release-macos-arm64

Version: 1.1.1
Check: re-building of vignette outputs
Result: NOTE Error(s) in re-building vignettes: --- re-building ‘vignette_mvord2.Rmd’ using rmarkdown Pandoc is required to build R Markdown vignettes but not available. Please make sure it is installed. --- finished re-building ‘vignette_mvord2.Rmd’ --- re-building ‘vignette_mvord.Rnw’ using Sweave Loading required package: minqa Loading required package: BB Loading required package: ucminf Loading required package: dfoptim Error: processing vignette 'vignette_mvord.Rnw' failed with diagnostics: Running 'texi2dvi' on 'vignette_mvord.tex' failed. LaTeX errors: ! Font U/bbm/m/n/10.95=bbm10 at 10.95pt not loadable: Metric (TFM) file not found. <to be read again> relax l.544 \end{align} ! Emergency stop. <to be read again> relax l.544 \end{align} ! ==> Fatal error occurred, no output PDF file produced! --- failed re-building 'vignette_mvord.Rnw' SUMMARY: processing the following file failed: ‘vignette_mvord.Rnw’ Error: Vignette re-building failed. Execution halted Flavor: r-release-macos-x86_64