Cheap Wholesale NFL Jerseys - Standard Scores in R

By Joseph Schmuller

The R function for calculating standard scores is called scale(). Supply a vector of scores, and scale() returns a vector of z-scores along with, helpfully, the mean and the standard deviation.

To show scale() in action, isolate a subset of the Cars93 data frame. (It’s in the MASS package. On the Packages tab, check the box next to MASS if it’s unchecked.)

Specifically, create a vector of the horsepowers of 8-cylinder cars from the USA:

> Horsepower.USA.Eight <- Cars93$Horsepower[Origin == "USA" &amp; Cylinders == 8]

> Horsepower.USA.Eight

[1] 200 295 170 300 190 210

And now for the z-scores:

> scale(Horsepower.USA.Eight)

[,1]

[1,] -0.4925263

[2,] 1.2089283

[3,] -1.0298278

[4,] 1.2984785

[5,] -0.6716268

[6,] -0.3134259

attr(,"scaled:center")

[1] 227.5

attr(,"scaled:scale")

[1] 55.83458

That last value is s, not Σ. If you have to base your z-scores on Σ, divide each element in the vector by the square root of (N-1)/N:

> N <- length(Horsepower.USA.Eight)

> scale(Horsepower.USA.Eight)/sqrt((N-1)/N)

[,1]

[1,] -0.5395356

[2,] 1.3243146

[3,] -1.1281198

[4,] 1.4224120

[5,] -0.7357303

[6,] -0.3433408

attr(,"scaled:center")

[1] 227.5

attr(,"scaled:scale")

[1] 55.83458

Notice that scale() still returns s.

<tr id="WQFImOv"></tr>
<tr id="WQFImOv"><optgroup id="WQFImOv"></optgroup></tr>
<acronym id="WQFImOv"></acronym><acronym id="WQFImOv"></acronym>
<acronym id="WQFImOv"><small id="WQFImOv"></small></acronym>
<sup id="WQFImOv"><center id="WQFImOv"></center></sup>
<rt id="WQFImOv"><optgroup id="WQFImOv"></optgroup></rt>
<rt id="WQFImOv"></rt>
<acronym id="WQFImOv"></acronym><rt id="WQFImOv"><optgroup id="WQFImOv"></optgroup></rt><acronym id="WQFImOv"></acronym>
<acronym id="WQFImOv"><optgroup id="WQFImOv"></optgroup></acronym>
  • 6308961962 2018-02-25
  • 3055971961 2018-02-25
  • 7451961960 2018-02-25
  • 2458921959 2018-02-25
  • 1955001958 2018-02-25
  • 6433701957 2018-02-25
  • 744321956 2018-02-25
  • 3545931955 2018-02-24
  • 4244531954 2018-02-24
  • 7574311953 2018-02-24
  • 5343791952 2018-02-24
  • 3464581951 2018-02-24
  • 5317271950 2018-02-24
  • 7054671949 2018-02-24
  • 2122831948 2018-02-24
  • 9863161947 2018-02-24
  • 3003541946 2018-02-24
  • 700921945 2018-02-24
  • 635621944 2018-02-23
  • 501801943 2018-02-23
  • cheap jerseys | wholesale jerseys |