mean-centering case

65 Views Asked by At

I have some data in matrix format, with one variable for every column. One categorical variable (column 2, say) specifies some feature of the remaining numerical variables. I want to remove the mean of all the numerical values that belong to one category of the forhmentioned categorical variable. That is to say, I want the mean of those values to be 0, whilst retaining all the information in the data. It is a kind of mean centering but for only a given set of values in the matrix, not single rows or single columns, which could be done by multiplying the data by the adequate centering matrix. What are some ways of performing this kind of matrix-manipulation to preprocess the data?