Running examples in ‘mitml-Ex.R’ failed
The error most likely occurred in:

> ### Name: with.mitml.list
> ### Title: Evaluate an expression in a list of imputed data sets
> ### Aliases: with.mitml.list within.mitml.list
> ### Keywords: methods
> 
> ### ** Examples
> 
> data(studentratings)
> 
> fml <- ReadDis + SES ~ ReadAchiev + (1|ID)
> imp <- panImpute(studentratings, formula = fml, n.burn = 1000, n.iter = 100, m = 5)
Running burn-in phase ...
Creating imputed data set ( 1 / 5 ) ...
Creating imputed data set ( 2 / 5 ) ...
Creating imputed data set ( 3 / 5 ) ...
Creating imputed data set ( 4 / 5 ) ...
Creating imputed data set ( 5 / 5 ) ...
Done!
> 
> implist <- mitmlComplete(imp)
> 
> # * Example 1: data transformation
> 
> # calculate and save cluster means
> new1.implist <- within(implist, Means.ReadAchiev <- clusterMeans(ReadAchiev, ID))
> 
> # center variables, calculate interaction terms, ignore byproducts
> new2.implist <- within(implist, {
+   M.SES <- mean(SES)
+   M.CognAbility <- mean(CognAbility)
+   C.SES <- SES - M.SES
+   C.CognAbility <- CognAbility - M.CognAbility
+   SES.CognAbility <- C.SES * C.CognAbility
+ }, ignore = c("M.SES", "M.CognAbility"))
> 
> # * Example 2: fitting statistical models
> 
> # fit regression model
> fit.lm <- with(implist, lm(ReadAchiev ~ ReadDis))
> 
> # fit multilevel model with lme4
> require(lme4)
Loading required package: lme4
Loading required package: Matrix
> fit.lmer <- with(implist, lmer(ReadAchiev ~ ReadDis + (1|ID)))
> 
> # fit structural equation model with lavaan (requires include.data = TRUE)
> require(lavaan)
Loading required package: lavaan
This is lavaan 0.6-7
lavaan is BETA software! Please report any bugs.
> mod <- "ReadAchiev ~ ReadDis"
> fit.sem <- with(implist,
+                 sem(model = mod, cluster = "ID", estimator = "MLR"),
+                 include.data = TRUE)
           name idx nobs    type exo user       mean       var nlev lnam
1*** ReadAchiev   8  750 numeric   0    0 489.865088       NaN    0     
2       ReadDis   2  750 numeric   1    0   2.580389 0.4613882    0     
Error in lav_data_full(data = data, group = group, cluster = cluster,  : 
  lavaan ERROR: some variables have only 1 observation or no finite variance
Calls: with ... eval -> eval -> <Anonymous> -> lavData -> lav_data_full
Execution halted