[R] [newbie] Want to perform some simple regressions.
Sean O'Riordain
sean.oriordain at gmail.com
Sun Aug 28 10:16:42 CEST 2005
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:
> On Sun, Aug 28, 2005 at 09:48:15AM +0200, Thomas Baruchel wrote:
> > Is R the right choice ? Please, could you step by step show me
> > how you would do on this example (data below) in order to let me
>
> I forgot my data :-(
>
> 0 2.205954909440447
> 1 8.150580118785099
> 2 15.851323727378597
> 3 22.442795956953574
> 4 29.358579800271354
> 5 36.46060528847214
> 6 43.7516923268591
> 7 51.223688311610026
> 8 58.86610205087116
> 9 66.66821956399055
> 10 74.61990268453171
> 11 82.71184423952718
> 12 90.93560520053082
> 13 99.28356700194489
> 14 107.74885489906521
> 15 116.3252559311549
> 16 125.00714110112291
> 17 133.78939523822717
> 18 142.6673553086964
> 19 151.63675679510055
> 20 160.69368733376777
> 21 169.834546691509
> 22 179.05601219606618
> 23 188.35500882314003
> 24 197.72868324657364
> 25 207.17438125936408
> 26 216.68962806440814
> 27 226.2721110130965
> 28 235.9196644372003
> 29 245.63025627606442
> 30 255.40197624835042
> 31 265.23302535689197
> 32 275.12170654792556
> 33 285.06641637317705
> 34 295.0656375259694
> 35 305.1179321414606
> 36 315.2219357669857
> 37 325.3763519217964
> 38 335.5799471767038
> 39 345.8315466936063
> 40 356.13003017290697
> 41 366.4743281636434
> 42 376.8634186969678
> 43 387.2963242085816
> 44 397.77210871999046
> 45 408.2898752521091
> 46 418.8487634479048
> 47 429.44794738349896
> 48 440.08663354951693
> 49 450.76405898653184
> 50 461.479489560246
> 51 472.2322183636179
> 52 483.02156423451737
> 53 493.84687037869463
> 54 504.707503088911
> 55 515.6028505520102
> 56 526.5323217365377
> 57 537.4953453542455
> 58 548.4913688894654
> 59 559.5198576909147
> 60 570.5802941210067
> 61 581.6721767581994
> 62 592.7950196483222
> 63 603.9483516011882
> 64 615.1317155291274
> 65 626.3446678243708
> 66 637.5867777724806
> 67 648.8576269992603
> 68 660.1568089487967
> 69 671.4839283904737
> 70 682.838600952985
> 71 694.2204526835204
> 72 705.6291196304554
> 73 717.0642474479981
> 74 728.5254910213728
> 75 740.0125141112243
> 76 751.5249890160294
> 77 763.062596251391
> 78 774.6250242451752
> 79 786.2119690475241
> 80 797.8231340548524
> 81 809.4582297469931
> 82 821.1169734367211
> 83 832.7990890309349
> 84 844.5043068028273
> 85 856.2323631744205
>
> Regards,
>
> --
> Thomas Baruchel
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list