Running examples in 'miceMNAR-Ex.R' failed
The error most likely occurred in:

> ### Name: MNARargument
> ### Title: Function providing modified arguments for imputation of Missing
> ###   Not At Random (MNAR) outcomes using 'mice()' function of the "mice"
> ###   package
> ### Aliases: MNARargument
> 
> ### ** Examples
> 
> 
> require(GJRM)
Loading required package: GJRM
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-24. For overview type 'help("mgcv-package")'.

This is GJRM 0.1-4.
For overview type 'help("GJRM-package")'.

> require(mvtnorm)
Loading required package: mvtnorm
> require(pbivnorm)
Loading required package: pbivnorm
> require(sampleSelection)
Loading required package: sampleSelection
Loading required package: maxLik
Loading required package: miscTools

Please cite the 'maxLik' package as:
Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI 10.1007/s00180-010-0217-1.

If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's R-Forge site:
https://r-forge.r-project.org/projects/maxlik/
> 
> # Import dataset with a suspected MNAR mechanism
> data("hiv") 
> 
> # We select only one region (lusuka) and 5 variables
> lusuka <- hiv[hiv$region==5,c("hiv", "age", "marital", "condom", "smoke")]
> 
> # Categorical variables have to be recoded as factor
> lusuka$hiv <- as.factor(lusuka$hiv)
> 
> #############################################
> #### Missing data only on a binary outcome ##
> #############################################
> 
> # Specify a selection (missing data mechanism) and an outcome equation (analyse model)
> 
> # Generate an empty matrix
> 
> JointModelEq <- generate_JointModelEq(data=lusuka,varMNAR = "hiv")
> 
> # Fill in with 1 for variable included in equations
> JointModelEq[,"hiv_var_sel"] <- c(0,1,1,1,1)
> JointModelEq[,"hiv_var_out"] <- c(0,1,1,1,0)
> 
> # Generation of argument for MNAR imputation model in "mice()" function
> arg <- MNARargument(data=lusuka,varMNAR="hiv",JointModelEq=JointModelEq)
> 
> # Imputation using mice() function
> # Values returned have to be included in the "mice()" function as argument:
> 
> imputation <- mice(data = arg$data_mod,
+                  method = arg$method,
+                  predictorMatrix = arg$predictorMatrix,
+                  JointModelEq=arg$JointModelEq,
+                  control=arg$control,
+                  maxit=1,m=5)

 iter imp variable
  1   1  hivError in `[<-.data.frame`(`*tmp*`, is.na(data[, v1[1]]), v1[1], value = 0) : 
  replacement has 1 row, data has 0
Calls: mice ... mice.impute.heckprob -> SemiParBIV -> [<- -> [<-.data.frame
Execution halted