Hi

> I made some design matrix X(in linear regression model)
>
> I there any method to normalize X?

You can normalize a matrix column-wise like this:

# m is a matrix
apply(m, 2, function(x) x / max(x) )

Or normalize row-wise like this:
t(apply(m, 1, function(x) x / max(x) ))

I'm sure there are more elegant ways to do it but those work for me.

Michael

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to