Running 'invariance.R' [4s/5s]
  Running 'lavaan.R' [45s/50s]
  Running 'tree.R' [3s/4s]
  Running 'vim.R' [4s/4s]
Running the tests in 'tests/invariance.R' failed.
Complete output:
  > #
  > # testing invariance 
  > #
  > 
  > # simulation:
  > # factor structure holds over SES but not over age
  > # both SES and age predict a mean difference in cognitive outcome
  > 
  > set.seed(123)
  > 
  > require("semtree")
  Loading required package: semtree
  Loading required package: OpenMx
  > require("lavaan")
  Loading required package: lavaan
  This is lavaan 0.6-7
  lavaan is BETA software! Please report any bugs.
  
  Attaching package: 'lavaan'
  
  The following object is masked from 'package:OpenMx':
  
      vech
  
  > #
  > lambda <- list()
  > age <- c(0,0,1,1) # 0=young, 1 =old
  > ses <- c(0,1,0,1) # 0=low, 1=high
  > lambda[[1]] <- c(1,0.9,0.8,0.8)
  > lambda[[2]] <- c(1,0.9,0.8,0.8)
  > lambda[[3]] <- c(1,0.4,0.2,0.9)
  > lambda[[4]] <- c(1,0.4,0.2,0.9)
  > cogmean <- 80-age*30 + ses*20
  > cogsd <- 1
  > errsd <- 1
  > 
  > Nsub <- 200 # persons per agexSES group
  > 
  > cbind(age,ses,cogmean)
       age ses cogmean
  [1,]   0   0      80
  [2,]   0   1     100
  [3,]   1   0      50
  [4,]   1   1      70
  > 
  > # simulate data from 4 groups
  > data <- c()
  > for (i in 1:4) {
  +   cogsim <- rnorm(n = Nsub,mean = cogmean[i],cogsd)
  +   scores <- as.matrix(t(outer(lambda[[i]],cogsim))) + rnorm(Nsub*4,0,errsd)
  +   data <- rbind(data,scores)
  + }
  > data <- data.frame(data)
  > names(data) <- paste0("x",1:4)
  > 
  > fulldata <- cbind(data, age=rep(age,each=Nsub),ses=rep(ses,each=Nsub))
  > #
  > model<-"
  + ! regressions 
  + F=~1.0*x1
  + F=~l2*x2
  + F=~l3*x3
  + F=~l4*x4
  + ! residuals, variances and covariances
  + x1 ~~ VAR_x1*x1
  + x2 ~~ VAR_x2*x2
  + x3 ~~ VAR_x3*x3
  + x4 ~~ VAR_x4*x4
  + F ~~ 1.0*F
  + ! means
  + F~1
  + x1~0*1;
  + x2~0*1;
  + x3~0*1;
  + x4~0*1;
  + ";
  > result<-lavaan(model, data=data, fixed.x=FALSE, missing="FIML");
  Warning message:
  In lav_object_post_check(object) :
    lavaan WARNING: some estimated ov variances are negative
  > 
  > manifests<-c("x1","x2","x3","x4")
  > latents<-c("F")
  > model <- mxModel("Unnamed_Model", 
  +                  type="RAM",
  +                  manifestVars = manifests,
  +                  latentVars = latents,
  +                  mxPath(from="F",to=c("x1","x2","x3","x4"), free=c(FALSE,TRUE,TRUE,TRUE),
  +                         value=c(1.0,1.0,1.0,1.0) , arrows=1, label=c("F__x1","l2","l3","l4") ),
  +                  mxPath(from="one",to=c("F"), free=c(TRUE), value=c(1.0) , arrows=1, label=c("const__F") ),
  +                  mxPath(from="one",to=c("x2","x3","x4"), free=c(TRUE,TRUE,TRUE), value=c(1.0,1.0,1.0) , arrows=1, label=c("const__x2","const__x3","const__x4") ),
  +                  mxPath(from="x1",to=c("x1"), free=c(TRUE), value=c(1.0) , arrows=2, label=c("VAR_x1") ),
  +                  mxPath(from="x2",to=c("x2"), free=c(TRUE), value=c(1.0) , arrows=2, label=c("VAR_x2") ),
  +                  mxPath(from="x3",to=c("x3"), free=c(TRUE), value=c(1.0) , arrows=2, label=c("VAR_x3") ),
  +                  mxPath(from="x4",to=c("x4"), free=c(TRUE), value=c(1.0) , arrows=2, label=c("VAR_x4") ),
  +                  mxPath(from="F",to=c("F"), free=c(FALSE), value=c(1.0) , arrows=2, label=c("VAR_F") ),
  +                  mxPath(from="one",to=c("x1"), free=F, value=0, arrows=1),
  +                  mxData(data[1:50,], type = "raw")
  + );
  > 
  > result <- mxTryHard(model)
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
  Beginning initial fit attempt
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
   Fit attempt generated errors
  
  Beginning fit attempt 1 of at maximum 10 extra tries
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
   Fit attempt generated errors
  
  Beginning fit attempt 2 of at maximum 10 extra tries
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
   Fit attempt generated errors
  
  Beginning fit attempt 3 of at maximum 10 extra tries
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
   Fit attempt generated errors
  
  Beginning fit attempt 4 of at maximum 10 extra tries
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
   Fit attempt generated errors
  
  Beginning fit attempt 5 of at maximum 10 extra tries
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
   Fit attempt generated errors
  
  Beginning fit attempt 6 of at maximum 10 extra tries
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
   Fit attempt generated errors
  
  Beginning fit attempt 7 of at maximum 10 extra tries
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
   Fit attempt generated errors
  
  Beginning fit attempt 8 of at maximum 10 extra tries
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
   Fit attempt generated errors
  
  Beginning fit attempt 9 of at maximum 10 extra tries
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
   Fit attempt generated errors
  
  Beginning fit attempt 10 of at maximum 10 extra tries
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
   Fit attempt generated errors
  
  Retry limit reached
  
  
  
   All fit attempts resulted in errors - check starting values or model specification
  
  Warning message:
  In mxTryHard(model) : Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  
  > summary(result)
     Length     Class      Mode 
          1 try-error character 
  > 
  > subset <- data[1:50, ]
  > 
  > 
  > ctr <- semtree.control(verbose=TRUE)
  > ctr$exclude.heywood <- FALSE
  > # naive tree should find both effects, age & ses, with age having the stronger effect 
  > tree <- semtree(model = result, data=fulldata, control=ctr )
  Error in semtree(model = result, data = fulldata, control = ctr) : 
    Unknown model type selected. Use OpenMx or lavaanified lavaan models!
  Execution halted
Running the tests in 'tests/tree.R' failed.
Complete output:
  > set.seed(789)
  > require("semtree")
  Loading required package: semtree
  Loading required package: OpenMx
  > data(lgcm)
  > 
  > lgcm$agegroup <- as.ordered(lgcm$agegroup)
  > lgcm$training <- as.factor(lgcm$training)
  > lgcm$noise <- as.numeric(lgcm$noise)
  > 
  > # LOAD IN OPENMX MODEL.
  > # A SIMPLE LINEAR GROWTH MODEL WITH 5 TIME POINTS FROM SIMULATED DATA
  > 
  > manifests <- names(lgcm)[1:5]
  > lgcModel <- mxModel("Linear Growth Curve Model Path Specification",
  +                             type="RAM",
  +                             manifestVars=manifests,
  +                             latentVars=c("intercept","slope"),
  +                             # residual variances
  +                             mxPath(
  +                               from=manifests,
  +                               arrows=2,
  +                               free=TRUE,
  +                               values = c(1, 1, 1, 1, 1),
  +                               labels=c("residual1","residual2","residual3","residual4","residual5")
  +                             ),
  +                             # latent variances and covariance
  +                             mxPath(
  +                               from=c("intercept","slope"),
  +                               connect="unique.pairs",
  +                               arrows=2,
  +                               free=TRUE,
  +                               values=c(1, 1, 1),
  +                               labels=c("vari", "cov", "vars")
  +                             ),
  +                             # intercept loadings
  +                             mxPath(
  +                               from="intercept",
  +                               to=manifests,
  +                               arrows=1,
  +                               free=FALSE,
  +                               values=c(1, 1, 1, 1, 1)
  +                             ),
  +                             # slope loadings
  +                             mxPath(
  +                               from="slope",
  +                               to=manifests,
  +                               arrows=1,
  +                               free=FALSE,
  +                               values=c(0, 1, 2, 3, 4)
  +                             ),
  +                             # manifest means
  +                             mxPath(
  +                               from="one",
  +                               to=manifests,
  +                               arrows=1,
  +                               free=FALSE,
  +                               values=c(0, 0, 0, 0, 0)
  +                             ),
  +                             # latent means
  +                             mxPath(
  +                               from="one",
  +                               to=c("intercept", "slope"),
  +                               arrows=1,
  +                               free=TRUE,
  +                               values=c(1, 1),
  +                               labels=c("meani", "means")
  +                             ),
  +                     mxData(lgcm,type="raw")
  +                     )
  > 
  > 
  > # TREE CONTROL OPTIONS.
  > # TO OBTAIN BASIC/DEFAULT SMETREE OPTIONS, SIMPLY TPYE THE FOLLOWING:
  > 
  > controlOptions <- semtree.control(method = "naive")
  > controlOptions$alpha <- 0.05
  > 
  > # RUN TREE.
  > 
  > tree <- semtree(model=lgcModel, data=lgcm, control = controlOptions)
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  > 
  > # RERUN TREE WITH MODEL CONSTRAINTS.
  > # MODEL CONSTRAINTS CAN BE ADDED BY IDENTIFYING THE PARAMETERS TO BE
  > # CONSTRAINED IN EVERY NODE. ONLY UNCONSTRAINED PARAMETERS ARE THEN
  > # TESTED AT EACH NODE FOR GROUP DIFFERENCES. IN THIS EXAMPLE THE MODEL 
  > # RESIDUALS ARE CONSTRAINED OVER THE NODES.
  > 
  > constraints <- semtree.constraints(global.invariance = names(omxGetParameters(lgcModel))[1:5])
  > 
  > treeConstrained <- semtree(model=lgcModel, data=lgcm, control = controlOptions,
  +                            constraints=constraints)
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Calls: semtree ... runHelper -> generateMatrixList -> generateMatrixReferences
  Execution halted
Running the tests in 'tests/vim.R' failed.
Complete output:
  > set.seed(789)
  > require("semtree")
  Loading required package: semtree
  Loading required package: OpenMx
  > data(lgcm)
  > 
  > lgcm$agegroup <- as.ordered(lgcm$agegroup)
  > lgcm$training <- as.factor(lgcm$training)
  > lgcm$noise <- as.numeric(lgcm$noise)
  > 
  > # LOAD IN OPENMX MODEL.
  > # A SIMPLE LINEAR GROWTH MODEL WITH 5 TIME POINTS FROM SIMULATED DATA
  > 
  > manifests <- names(lgcm)[1:5]
  > lgcModel <- mxModel("Linear Growth Curve Model Path Specification",
  +                             type="RAM",
  +                             manifestVars=manifests,
  +                             latentVars=c("intercept","slope"),
  +                             # residual variances
  +                             mxPath(
  +                               from=manifests,
  +                               arrows=2,
  +                               free=TRUE,
  +                               values = c(1, 1, 1, 1, 1),
  +                               labels=c("residual1","residual2","residual3","residual4","residual5")
  +                             ),
  +                             # latent variances and covariance
  +                             mxPath(
  +                               from=c("intercept","slope"),
  +                               connect="unique.pairs",
  +                               arrows=2,
  +                               free=TRUE,
  +                               values=c(1, 1, 1),
  +                               labels=c("vari", "cov", "vars")
  +                             ),
  +                             # intercept loadings
  +                             mxPath(
  +                               from="intercept",
  +                               to=manifests,
  +                               arrows=1,
  +                               free=FALSE,
  +                               values=c(1, 1, 1, 1, 1)
  +                             ),
  +                             # slope loadings
  +                             mxPath(
  +                               from="slope",
  +                               to=manifests,
  +                               arrows=1,
  +                               free=FALSE,
  +                               values=c(0, 1, 2, 3, 4)
  +                             ),
  +                             # manifest means
  +                             mxPath(
  +                               from="one",
  +                               to=manifests,
  +                               arrows=1,
  +                               free=FALSE,
  +                               values=c(0, 0, 0, 0, 0)
  +                             ),
  +                             # latent means
  +                             mxPath(
  +                               from="one",
  +                               to=c("intercept", "slope"),
  +                               arrows=1,
  +                               free=TRUE,
  +                               values=c(1, 1),
  +                               labels=c("meani", "means")
  +                             ),
  +                     mxData(lgcm,type="raw")
  +                     )
  > 
  > 
  > fr <- semforest(lgcModel, lgcm,control = semforest.control(num.trees = 15))
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  Error in names(retval) <- matnames : 
    'names' attribute [4] must be the same length as the vector [0]
  Model had a run error.
  > 
  >   
  > vimp <- varimp(fr)
  Error in t.default(tree$params) : argument is not a matrix
  Calls: varimp ... eval.fun -> getIdParameterMapping -> cbind -> t -> t.default
  Execution halted