Running 'tests_for_lav2nlsem.R' [1s]
  Running 'tests_for_model.R' [150s]
  Running 'tests_for_semm.R' [159s]
Running the tests in 'tests/tests_for_model.R' failed.
Complete output:
  > # =====================
  > # Tests for specify_sem
  > # =====================
  > 
  > library(nlsem)
  Loading required package: orthopolynom
  > 
  > # ordinary lms
  > # ============
  > lms_model <- specify_sem(num.x=6, num.y=3, num.xi=2, num.eta=1,
  +                          xi="x1-x3,x4-x6", eta="y1-y3", num.classes=1,
  +                          interaction="xi1:xi2")
  > as.data.frame(lms_model)
          label class1
  1   Lambda.x1      1
  2   Lambda.x2     NA
  3   Lambda.x3     NA
  4   Lambda.x4      0
  5   Lambda.x5      0
  6   Lambda.x6      0
  7   Lambda.x7      0
  8   Lambda.x8      0
  9   Lambda.x9      0
  10 Lambda.x10      1
  11 Lambda.x11     NA
  12 Lambda.x12     NA
  13  Lambda.y1      1
  14  Lambda.y2     NA
  15  Lambda.y3     NA
  16     Gamma1     NA
  17     Gamma2     NA
  18       Beta      1
  19   Theta.d1     NA
  20   Theta.d2      0
  21   Theta.d3      0
  22   Theta.d4      0
  23   Theta.d5      0
  24   Theta.d6      0
  25   Theta.d7      0
  26   Theta.d8     NA
  27   Theta.d9      0
  28  Theta.d10      0
  29  Theta.d11      0
  30  Theta.d12      0
  31  Theta.d13      0
  32  Theta.d14      0
  33  Theta.d15     NA
  34  Theta.d16      0
  35  Theta.d17      0
  36  Theta.d18      0
  37  Theta.d19      0
  38  Theta.d20      0
  39  Theta.d21      0
  40  Theta.d22     NA
  41  Theta.d23      0
  42  Theta.d24      0
  43  Theta.d25      0
  44  Theta.d26      0
  45  Theta.d27      0
  46  Theta.d28      0
  47  Theta.d29     NA
  48  Theta.d30      0
  49  Theta.d31      0
  50  Theta.d32      0
  51  Theta.d33      0
  52  Theta.d34      0
  53  Theta.d35      0
  54  Theta.d36     NA
  55   Theta.e1     NA
  56   Theta.e2      0
  57   Theta.e3      0
  58   Theta.e4      0
  59   Theta.e5     NA
  60   Theta.e6      0
  61   Theta.e7      0
  62   Theta.e8      0
  63   Theta.e9     NA
  64        Psi     NA
  65       Phi1     NA
  66       Phi2     NA
  67       Phi3      0
  68       Phi4     NA
  69      nu.x1      0
  70      nu.x2     NA
  71      nu.x3     NA
  72      nu.x4      0
  73      nu.x5     NA
  74      nu.x6     NA
  75      nu.y1      0
  76      nu.y2     NA
  77      nu.y3     NA
  78      alpha     NA
  79       tau1     NA
  80       tau2     NA
  81     Omega1      0
  82     Omega2      0
  83     Omega3     NA
  84     Omega4      0
  > 
  > # ordinary lms with different inputs for interaction
  > # =================================================
  > # "none"
  > # --
  > lms_model <- specify_sem(num.x=6, num.y=3, num.xi=2, num.eta=1,
  +                          xi="x1-x3,x4-x6", eta="y1-y3", num.classes=1,
  +                          interaction="none")
  > 
  > # not all interactions with xi defined
  > # ------------------------------------
  > lms_model <- specify_sem(num.x=8, num.y=6, num.xi=4, num.eta=3,
  +                          xi="x1-x2,x3-x4,x5-x6,x7-x8", eta="y1-y2,y3-y4,y5-y6",
  +                          num.classes=1, interaction="eta1~xi1:xi2,eta1~xi1:xi1")
  > 
  > # semm model
  > # ===========
  > semm_model <- specify_sem(num.x=6, num.y=3, num.xi=2, num.eta=1,
  +                          xi="x1-x3,x4-x6", eta="y1-y3", num.classes=3,
  +                          interaction="none")
  > 
  > # ===============================
  > # Tests for count_free_parameters
  > # ===============================
  > 
  > # lms
  > # ---
  > lms_model <- specify_sem(num.x=6, num.y=3, num.xi=2, num.eta=1,
  +                          xi="x1-x3,x4-x6", eta="y1-y3", num.classes=1,
  +                          interaction="xi1:xi2")
  > class(lms_model)
  [1] "singleClass"
  > count_free_parameters(lms_model)
  [1] 31
  > parameters <- 1:count_free_parameters(lms_model)
  > rm(parameters, lms_model)
  > 
  > # semm
  > # -----
  > semm_model <- specify_sem(num.x=6, num.y=3, num.xi=2, num.eta=1,
  +                          xi="x1-x3,x4-x6", eta="y1-y3", num.classes=3,
  +                          interaction="none")
  > class(semm_model)
  [1] "semm"
  > count_free_parameters(semm_model)
  [1] 40
  > parameters <- 1:count_free_parameters(semm_model)
  > rm(parameters, semm_model)
  > 
  > # semm with rel.lat
  > # =======================
  > semm_model <- specify_sem(num.x=8, num.y=6, num.xi=4, num.eta=3,
  +                          xi="x1-x2,x3-x4,x5-x6,x7-x8", eta="y1-y2,y3-y4,y5-y6",
  +                          num.classes=3, interaction="none",
  +                          rel.lat="eta1~xi1,eta2~xi2,eta3~xi3+xi4,eta2~eta1+eta3")
  > 
  > # nsemm
  > # -----
  > nsemm_model <- specify_sem(num.x=6, num.y=3, num.xi=2, num.eta=1,
  +                          xi="x1-x3,x4-x6", eta="y1-y3", num.classes=3,
  +                          interaction="xi1:xi2")
  > class(nsemm_model)
  [1] "nsemm"
  > count_free_parameters(nsemm_model)
  [1] 41
  > parameters <- 1:count_free_parameters(nsemm_model)
  > rm(parameters, nsemm_model)
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.35    0.15    0.50 
Running the tests in 'tests/tests_for_semm.R' failed.
Complete output:
  > # Testing functions for semm
  > # ===========================
  > 
  > library(nlsem)
  Loading required package: orthopolynom
  > 
  > # SEMM model for structural equation models
  > # ==========================================
  > 
  > # create model
  > mod <- specify_sem(num.x=4, num.y=4, num.xi=2, num.eta=2,
  +                      xi="x1-x2,x3-x4", eta="y1-y2,y3-y4",
  +                      constraints="direct1", num.classes=2,
  +                      interaction="none",
  +                      rel.lat="eta1~xi1,eta2~xi2,eta2~eta1,eta1~eta2")
  > 
  > dat <- as.data.frame(mod)
  > 
  > dat[c(2,8,10,16),2:3]   <- 1    # Lambda.x.21 & 42 and Lambda.y.21 & 42
  > dat[c(58,62),2:3]       <- 0    # psi.21 and phi.21
  > dat[65:72,2:3]          <- 1    # nu.x and nu.y
  > 
  > model <- create_sem(dat)
  > 
  > # simulate data
  > parameters <- c(
  +                 # class 1
  +                 rep(0.5, 2),    # Gamma
  +                 c(-0.3, 0.7),   # Beta
  +                 rep(0.5, 10),   # Theta.d, Theta.e, Psi
  +                 rep(1, 2),      # Phi
  +                 rep(1, 2),      # alpha
  +                 rep(1, 2),      # tau
  +                 # class 2
  +                 rep(-0.5, 2),   # Gamma
  +                 c(0.7, -0.3),   # Beta
  +                 rep(0.5, 10),   # Theta.d, Theta.e, Psi
  +                 rep(1, 2),      # Phi
  +                 rep(1, 2),      # alpha
  +                 rep(4, 2)       # tau
  + )
  > data <- simulate(model, seed=7, parameters=parameters)
  > 
  > # estimate model
  > 
  > set.seed(8)
  > parameters <- runif(count_free_parameters(model), 0.1, 1.5)
  > 
  > # system.time(
  > #     res <- em(model, data, parameters, verbose=TRUE)
  > # )
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.23    0.23    0.45