R statistics package

From NoskeWiki
Jump to navigation Jump to search

About R

The R is a statistics package and programming language. It was recommended to me by Nick Hamilton because it runs on multiple platforms, and it's free open source under GNU.

On Windows it has its own GUI and console window where you run commands.

Download R for Windows here


Functions

There many functions (there is a PDF manual for all of them)

So far I have only looked at: t.test() and plot() (which can generate graphs)


Student t-test

Nick gave me instructions on how to run a Student t test on two uneven samples (in Excel you can only do it for even sample sizes).

First I created two file "r1.txt" and "r2.txt" in the root install directory (C:\Program Files\R\R-2.5.0), and in them put m two lists of numbers one per line.

Then I ran this:

r1=as.matrix(read.table("r1_maturegrans.txt",sep="\n"));
r2=as.matrix(read.table("r2_maturegrans.txt",sep="\n"));
t.test(r1,r2,paired = FALSE,var.equal = TRUE)

And the output should look like this:

   Two Sample t-test

data:  r1 and r2
t = 3.875, df = 462, p-value = 0.0001220
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 269.6892 824.6654
sample estimates:
mean of x mean of y
 2368.618  1821.440

... p-value = 0.0001220 indicate that the mean of the two set of results is very unlikely to be the same (the smaller the number the more likely they are different.... but it's very much affected by how large the sample sizes are).


Algebra Solving

I actually haven't figured out how to do this with R yet. Instead I use Mathomatic - it's a lot easier & more lightweight for this.


Links