Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I calculate z-score with R? [duplicate]

Possible Duplicate:
R, correlation: is there a func that converts a vector of nums to a vector of standard units

By reading stackoverflow's comments, I found z-score maybe calculated with Python or perl, but I did not comes across any for R yet. Did I miss it? Is it possible to be done with R?

As (http://en.wikipedia.org/wiki/Standard_score.)

z-score = (x-μ)/σ  x is a raw score to be standardized;  μ is the mean of the population;  σ is the standard deviation of the population.  

I believe there are R packages designed for this? Where can we found them? Or similar package for normalization?

like image 402
a83 Avatar asked Jun 07 '11 09:06

a83


People also ask

Is there a Zscore function in R?

zscore works for any distribution for which a cumulative distribution function (like pnorm ) exists in R. The argument distribution is the name of the cumulative distribution function with the "p" removed.

How do you find the z-score of two values?

The z-score of a value is the count of the number of standard deviations between the value and the mean of the set. You can find it by subtracting the value from the mean, and dividing the result by the standard deviation.

Can z-scores be calculated from nominal data?

z-scores make no sense for nominal data; the negative part of the definition of nominal data is that numerical coding is completely arbitrary so long as distinct values are coded distinctly.


1 Answers

if x is a vector with raw scores then scale(x) is a vector with standardized scores.

Or manually: (x-mean(x))/sd(x)

like image 94
Sacha Epskamp Avatar answered Sep 28 '22 18:09

Sacha Epskamp