Wednesday, 5 March 2014

Mean, SD and T-tests

Reading:
http://cran.r-project.org/doc/manuals/R-intro.html

Short reference card:
http://cran.r-project.org/doc/contrib/Short-refcard.pdf

35 values

Need to slice the values as the N/A make life difficult - square brackets do that.

> sd(grades$Grade_Pres[1:35])
[1] 5.55366
> mean(grades$Grade_Pres[1:35])
[1] 66.75429

I couldn't get the two groups compared with a T-test so I did it in Excel.

Found a way to do it.

Pretty easy really:

> t.test(grades$Grade_Dig, grades$Grade_Pres[1:35])

output

Welch Two Sample t-test

data:  grades$Grade_Dig and grades$Grade_Pres[1:35]

t = 0.7833, df = 54.334, p-value = 0.4369

alternative hypothesis: true difference in means is not equal to 0

95 percent confidence interval:
 -1.301562  2.971073

sample estimates:
mean of x          mean of y
 67.58904          66.75429

P-value not the same as Excel as I chose to do it for equal variance in Excel.


> t.test(grades$Grade_Dig, grades$Grade_Pres[1:35], var.equal=TRUE)

Two Sample t-test

data:  grades$Grade_Dig and grades$Grade_Pres[1:35]

t = 0.8557, df = 106, p-value = 0.3941

alternative hypothesis: true difference in means is not equal to 0

95 percent confidence interval:
 -1.099278  2.768789

sample estimates:
mean of x           mean of y
 67.58904           66.75429






No comments:

Post a Comment