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
> 
> 
> # Import dataset with a suspected MNAR mechanism
> require("GJRM")
Loading required package: GJRM
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-23. 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
> data("hiv") 
> 
> # We select only one region (lusuka) and 5 variables
> lusuka <- hiv[hiv$region==5,c("hiv", "age", "highhiv", "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 model.frame.default(formula = "ry ~ ry + age + highhiv.1 + condom.1 + smoke.1 + y",  : 
  'data' must be a data.frame, not a matrix or an array
Calls: mice ... SemiParBIV -> eval -> eval -> model.frame -> model.frame.default
Execution halted