[R] Variance is different in R vs. Excel?

Karl Fetter karl.fetter at gmail.com
Mon Feb 9 22:32:55 CET 2015


Hello everyone, I have a simple question. when I use the var() function in
R to find a variance, it differs greatly from the variance found in excel
using the =VAR.S function. Any explanations on what those two functions are
actually doing?

Here is the data and the results:

dat<-matrix(c(402,908,553,522,627,1040,756,679,806,711,713,734,683,790,597,872,476,1026,423,476,419,591,376,640,550,601,588,499,646,693,351,730,632,707,779,838,814,771,533,818),
nrow=20, ncol=2, byrow=T)

var(dat[,1])
#21290.8

var(dat[,2])
#24748.75

#in Excel, the variance of dat[,1] = 44763.91; for dat[,2] = 52034.2

Thanks,

Karl

	[[alternative HTML version deleted]]



More information about the R-help mailing list