Hi, Can someone tell me how to normalize a data set so that the mean of the set is 0 and the variance is 1. As I understand, when you calculate the principle components of a data set through correlation as < princomp( dataset, cor=T ) > then a similar calculation is performed. I would like to know how I can perform such a calulation directly. Any help would be greatly appreciated. Many Thanks Rishabh -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Martin Hoyle, School of Life and Environmental Sciences, University of Nottingham, University Park, Nottingham, NG7 2RD, UK Webpage: http://myprofile.cos.com/martinhoyle>>> "Rishabh Gupta" <rg117 at ohm.york.ac.uk> 10/14/02 05:19PM >>>Hi, Can someone tell me how to normalize a data set so that the mean of the set is 0 and the variance is 1. As I understand, when you calculate the principle components of a data set through correlation as < princomp( dataset, cor=T ) > then a similar calculation is performed. I would like to know how I can perform such a calulation directly. Any help would be greatly appreciated. Many Thanks Rishabh Dear Rishabh, Suppose your data was in variable x, with the following values; x<-c(5,4,6,8,6,9,2,7,6,8) Then create the variable xtransformed; xtransformed<-(x-mean(x))/sd(x) Then xtransformed has mean of 0 and variance of 1 as required; mean(xtransformed) = 0, var(xtransformed) = 1, Regards, Martin. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
?scale (by the way, that's "principal" components analysis ...) On Mon, 14 Oct 2002, Rishabh Gupta wrote:> Hi, > Can someone tell me how to normalize a data set so that the mean of the set is 0 and the variance is 1. As I understand, when you > calculate the principle components of a data set through correlation as > < princomp( dataset, cor=T ) > > then a similar calculation is performed. I would like to know how I can perform such a calulation directly. Any help would be > greatly appreciated. > > Many Thanks > > Rishabh > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi, Thanks for all your replies. You have solved my problem. Many Thanks Rishabh ----- Original Message ----- From: "Rishabh Gupta" <rg117 at ohm.york.ac.uk> To: <r-help at stat.math.ethz.ch> Sent: Monday, October 14, 2002 5:19 PM Subject: [R] normalizing data sets | Hi, | Can someone tell me how to normalize a data set so that the mean of the set is 0 and the variance is 1. As I understand, when you | calculate the principle components of a data set through correlation as | < princomp( dataset, cor=T ) > | then a similar calculation is performed. I would like to know how I can perform such a calulation directly. Any help would be | greatly appreciated. | | Many Thanks | | Rishabh | | -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- | r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html | Send "info", "help", or "[un]subscribe" | (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch | _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ | -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._