Difference between revisions of "R1"

From SourceWiki
Jump to navigation Jump to search
(Created page with 'category:Pragmatic Programming '''Open Source Statistics with R''' =Why Bother with R?= =Linear Regression= <source lang="r"> plot(cars) res=lm(dist ~ speed, data=cars) a…')
 
Line 7: Line 7:
 
=Linear Regression=
 
=Linear Regression=
  
<source lang="r">
+
<source>
plot(cars)
+
> plot(cars)
res=lm(dist ~ speed, data=cars)
+
> res=lm(dist ~ speed, data=cars)
abline(res)
+
> abline(res)
 
</source>
 
</source>
  
 
=Significance Testing=
 
=Significance Testing=
  
<source lang="r">
+
<source>
 
> boys_2=c(90.2, 91.4, 86.4, 87.6, 86.7, 88.1, 82.2, 83.8, 91, 87.4)
 
> boys_2=c(90.2, 91.4, 86.4, 87.6, 86.7, 88.1, 82.2, 83.8, 91, 87.4)
 
> girls_2=c(83.8, 86.2, 85.1, 88.6, 83, 88.9, 89.7, 81.3, 88.7, 88.4)
 
> girls_2=c(83.8, 86.2, 85.1, 88.6, 83, 88.9, 89.7, 81.3, 88.7, 88.4)

Revision as of 16:20, 19 June 2013

Open Source Statistics with R

Why Bother with R?

Linear Regression

> plot(cars)
> res=lm(dist ~ speed, data=cars)
> abline(res)

Significance Testing

> boys_2=c(90.2, 91.4, 86.4, 87.6, 86.7, 88.1, 82.2, 83.8, 91, 87.4)
> girls_2=c(83.8, 86.2, 85.1, 88.6, 83, 88.9, 89.7, 81.3, 88.7, 88.4)
> res=var.test(boys_2,girls_2)
> res=t.test(boys_2, girls_2, var.equal=TRUE, paired=FALSE)