Sunday, May 17, 2020

var

Variance. A measure of spread. It's the expectation of the squared deviation of a random variable from its mean.

In the R docs, var is listed on the same page as cor (correlation) and cov (covariance).

sd is the square root of var. You need to use sum of squares to calculate variance, because if you use simple deviation, the values will cancel out to zero, because the deviations of the values vary plus or minus the mean, which is a calculation on the same values.

All three have the same six possible parameters. Along with the X and Y, you can opt to remove NA values. The 'use' and 'method' parameters allow you to choose computing methods. There's a 'v' method I don’t understand yet.

R Example

> var(rivers)
[1] 243908.4

I may need to look into the utility for variance. Up to this point it's been the standard deviation I make most use of.

No comments:

Post a Comment

Please help to combat malicious use of the Internet.