medianimp: Median imputation

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/medianimp.R

Description

Median imputation

Usage

1
medianimp(mat)

Arguments

mat

A matrix of ordinal values , ordered according to the Likert scale (1, 2, 3,...)

Details

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

Value

The imputed matrix

Author(s)

Alessandro Barbiero, Giancarlo Manzi, Pier Alda Ferrari

See Also

modeimp, meanimp

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
medianimp(matm)
# original matrix with no missing values
mat

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