Skip to content

[newbie] Want to perform some simple regressions.

2 messages · Sean O'Riordain, Duncan Murdoch

#
Hi Thomas,
I'm not an expert - so I might use incorrect terminology, but
hopefully you'll get the picture!

Assuming that you've got your data in a .CSV file, you'd first read in
your data, where the first three lines might look like...

x,y
0,2.205954909440447
1,8.150580118785099

# load the info into a data.frame called mydata
mydata <- read.csv("mycsvfile.csv",header=TRUE)
# now "attach" to this data.frame, so that the internal
attach(mydata)
# now do the regression and store it in the object "myregr"
myregr <- lm(y~x)
# print out the info from myregr
myregr
# to get more info from myregr use the summary() method...
summary(myregr)

There is an enormous quantity of documentation available, though it
takes a little while to learn to use it properly and get the full
effectiveness from it...

I strongly recommend that you read the "Posting Guide"
http://www.R-project.org/posting-guide.html
which will help you.

For more information, have a look at the introduction to R; which is a
tad terse in places - so read it slowly :-)

Have a look also at the other documentation 
http://www.r-project.org/other-docs.html

In particular I'd recommend John Maindonalds online book at
http://cran.r-project.org/other-docs.html

cheers!
Sean
On 28/08/05, Thomas Baruchel <archaiesteron at laposte.net> wrote:
#
Sean O'Riordain wrote:
Thomas's model was

y = (a*x + b) * ln (c*x + d) + error

which is not a linear model.  He'll need to use nonlinear regression 
(the nls function), which is a little more complicated.  I'd recommend 
geting local help from a statistician to get it right.

Duncan Murdoch