Simulated Example

library(MAP)
## Loading required package: flexmix
## Loading required package: lattice
## Loading required package: Matrix

simulate data to test the algorithm

set.seed(123)
n = 400
ICD = c(rpois(n / 4, 10), rpois(n / 4, 1), rep(0, n / 2))
NLP = c(rpois(n / 4, 10), rpois(n / 4, 1), rep(0, n / 2))
mat = Matrix(data = cbind(ICD, NLP), sparse = TRUE)
note = Matrix(rpois(n, 10) + 5, ncol = 1, sparse = TRUE)
res = MAP(mat = mat, note = note)
## ####################### 
## MAP only considers patients who have note count data and
##         at least one non-missing variable
## ####
## Here is a summary of the input data:
## Total number of patients: 400 
##   ICD NLP note Freq
## 1 YES YES  YES  400
## ####
head(res$scores)
## 6 x 1 sparse Matrix of class "dgCMatrix"
##               
## [1,] 0.9989973
## [2,] 0.9999445
## [3,] 1.0000000
## [4,] 0.9999906
## [5,] 0.9993466
## [6,] 0.9999966
res$cut.MAP
## [1] 0.1252229