# meanimp: Mean imputation In ForImp: Imputation of Missing Values Through a Forward Imputation Algorithm

Mean imputation

## Usage

 `1` ```meanimp(mat) ```

## Arguments

 `mat` A numerical matrix

## Details

The function implements the unconditional mean imputation on a numerical matrix with missing values, substituting to each missing value the arithmetic mean of the corresponding variable

## Value

The imputed matrix

## Author(s)

Alessandro Barbiero, Giancarlo Manzi, Pier Alda Ferrari

`modeimp`, `medianimp`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```set.seed(1) n<-10 m<-3 mat<-matrix(rnorm(n*m),n,m) matm<-mat matm[1,1]<-NA matm[2,2:3]<-NA # matrix with missing values matm # imputed matrix meanimp(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,]         NA  1.51178117  0.91897737
[2,]  0.1836433          NA          NA
[3,] -0.8356286 -0.62124058  0.07456498
[4,]  1.5952808 -2.21469989 -1.98935170
[5,]  0.3295078  1.12493092  0.61982575
[6,] -0.8204684 -0.04493361 -0.05612874
[7,]  0.4874291 -0.01619026 -0.15579551
[8,]  0.7383247  0.94383621 -1.47075238
[9,]  0.5757814  0.82122120 -0.47815006
[10,] -0.3053884  0.59390132  0.41794156
[,1]        [,2]        [,3]
[1,] -0.6264538  1.51178117  0.91897737
[2,]  0.1836433  0.38984324  0.78213630
[3,] -0.8356286 -0.62124058  0.07456498
[4,]  1.5952808 -2.21469989 -1.98935170
[5,]  0.3295078  1.12493092  0.61982575
[6,] -0.8204684 -0.04493361 -0.05612874
[7,]  0.4874291 -0.01619026 -0.15579551
[8,]  0.7383247  0.94383621 -1.47075238
[9,]  0.5757814  0.82122120 -0.47815006
[10,] -0.3053884  0.59390132  0.41794156
[,1]        [,2]        [,3]
[1,] -0.6264538  1.51178117  0.91897737
[2,]  0.1836433  0.38984324  0.78213630
[3,] -0.8356286 -0.62124058  0.07456498
[4,]  1.5952808 -2.21469989 -1.98935170
[5,]  0.3295078  1.12493092  0.61982575
[6,] -0.8204684 -0.04493361 -0.05612874
[7,]  0.4874291 -0.01619026 -0.15579551
[8,]  0.7383247  0.94383621 -1.47075238
[9,]  0.5757814  0.82122120 -0.47815006
[10,] -0.3053884  0.59390132  0.41794156
```

ForImp documentation built on May 29, 2017, 9:48 p.m.