# modeimp: Mode imputation In ForImp: Imputation of Missing Values Through a Forward Imputation Algorithm

Mode imputation

## Usage

 `1` ```modeimp(mat) ```

## Arguments

 `mat` A matrix of categorical or ordinal values, coded as integer values (1, 2, 3, ...)

## Details

The function implements the mode imputation on a matrix of categorical or ordinal data with missing values. The function substitutes to each missing value the mode of the corresponding variable.

## Value

The imputed matrix

## Author(s)

Alessandro barbiero, Giancarlo Manzi, Pier Alda Ferrari

`medianimp`, `modeimp`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```set.seed(1) n<-10 m<-3 mat<-matrix(ceiling(runif(n*m)*4),n,m) matm<-mat matm[1,3]<-NA matm[9:10,1]<-NA # matrix with missing values matm # imputed matrix modeimp(mat) # original matrix with no missing values mat ```

### Example output

```Loading required package: homals
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE
call: fun(...)
[,1] [,2] [,3]
[1,]    2    1   NA
[2,]    2    1    1
[3,]    3    3    3
[4,]    4    2    1
[5,]    1    4    2
[6,]    4    2    2
[7,]    4    3    1
[8,]    3    4    2
[9,]   NA    2    4
[10,]   NA    4    2
[,1] [,2] [,3]
[1,]    2    1    4
[2,]    2    1    1
[3,]    3    3    3
[4,]    4    2    1
[5,]    1    4    2
[6,]    4    2    2
[7,]    4    3    1
[8,]    3    4    2
[9,]    3    2    4
[10,]    1    4    2
[,1] [,2] [,3]
[1,]    2    1    4
[2,]    2    1    1
[3,]    3    3    3
[4,]    4    2    1
[5,]    1    4    2
[6,]    4    2    2
[7,]    4    3    1
[8,]    3    4    2
[9,]    3    2    4
[10,]    1    4    2
```

ForImp documentation built on May 2, 2019, 8:17 a.m.