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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: hlme
> ### Title: Estimation of latent class linear mixed models
> ### Aliases: hlme
> 
> ### ** Examples
> 
> 
> 
> ##### Example of a latent class model estimated for a varying number
> # of latent classes: 
> # The model includes a subject- (ID) and class-specific linear 
> # trend (intercept and Time in fixed, random and mixture components)
> # and a common effect of X1 and its interaction with time over classes 
> # (in fixed). 
> # The variance of the random intercept and slope are assumed to be equal 
> # over classes (nwg=F).
> # The covariate X3 predicts the class membership (in classmb).
> #
> # !CAUTION: initialization of mixed models with latent classes is 
> # of most importance because of the problem of multimodality of the likelihood.
> # Calls m2a-m2d illustrate the different implementations for the 
> # initial values.
> 
> ### homogeneous linear mixed model (standard linear mixed model) 
> ### with correlated random-effects
> m1<-hlme(Y~Time*X1,random=~Time,subject='ID',ng=1,data=data_hlme)
Be patient, hlme is running ... 
The program took 0.1 seconds 
> summary(m1)
Heterogenous linear mixed model 
     fitted by maximum likelihood method 
 
hlme(fixed = Y ~ Time * X1, random = ~Time, subject = "ID", ng = 1, 
    data = data_hlme)
 
Statistical Model: 
     Dataset: data_hlme 
     Number of subjects: 100 
     Number of observations: 326 
     Number of latent classes: 1 
     Number of parameters: 8  
 
Iteration process: 
     Convergence criteria satisfied 
     Number of iterations:  9 
     Convergence criteria: parameters= 2e-05 
                         : likelihood= 7.5e-05 
                         : second derivatives= 5.5e-11 
 
Goodness-of-fit statistics: 
     maximum log-likelihood: -790.51  
     AIC: 1597.02  
     BIC: 1617.86  
 
 
Maximum Likelihood Estimates: 
 
Fixed effects in the longitudinal model:

              coef      Se   Wald p-value
intercept 25.86094 0.77175 33.510 0.00000
Time      -0.32877 0.17120 -1.920 0.05482
X1         1.69459 1.00507  1.686 0.09179
Time:X1   -0.39409 0.22293 -1.768 0.07710


Variance-covariance matrix of the random-effects:
          intercept    Time
intercept  23.13774        
Time        2.79712 1.10558

                             coef      Se
Residual standard error:  0.96892 0.06095

> 
> ### latent class linear mixed model with 2 classes
> 
> # a. automatic specification from G=1 model estimates:
> m2a<-hlme(Y~Time*X1,mixture=~Time,random=~Time,classmb=~X2+X3,subject='ID',
+          ng=2,data=data_hlme,B=m1)
Be patient, hlme is running ... 
Error in hlme(Y ~ Time * X1, mixture = ~Time, random = ~Time, classmb = ~X2 +  : 
  Vector B should be of length 13
Execution halted