# transfmatcat: Transforming a matrix of continuous values into a matrix of... In ForImp: Imputation of Missing Values Through a Forward Imputation Algorithm

## Description

The function transforms a matrix of continuous numerical values into a matrix of integer (ordinal) values, with uniform marginal distributions and the desired number of categories

## Usage

 `1` ```transfmatcat(mat, cat = 3) ```

## Arguments

 `mat` a matrix or a dataframe `cat` the number of categories, one for each column/variable of the matrix/dataframe

## Details

The function converts the matrix in input, containing continuous numerical values, into a matrix of ordinal values (1,2,3,... i.e.: Likert scale) according to the `cat`-1 normal quantiles corresponding to each variable (column) of `mat`.

## Value

the matrix of ordinal values

## Author(s)

Alessandro Barbiero, Giancarlo Manzi, Pier Alda Ferrari

## References

Ferrari P.A., Barbiero A., Manzi G.: Handling missing data in presence of ordinal variables: a new imputation procedure. In "New Perspectives in Statistical Modeling and Data Analysis", S. Ingrassia, R. Rocci, M. Vichi, Eds., Springer, 2011

Ferrari P.A., Annoni P., Barbiero A., Manzi G. (2011) An imputation method for categorical variables with application to nonlinear principal component analysis, Computational Statistics & Data Analysis, vol. 55, issue 7, pages 2410-2420, http://www.sciencedirect.com/science/article/pii/S0167947311000521

`rancatmat`
 ```1 2 3 4 5``` ```# generate a 40*3 matrix from a multivariate normal r.v. # whose independent components have mean 10 and standard deviation 4 mat<-matrix(rnorm(40,3),10,4) # transform the matrix of normal data into a matrix of ordinal data transfmatcat(mat, cat=c(2,3,4,3)) ```