[R] how to solve a power series linear coefficient equation

From: e-letter <inpost_at_gmail.com>
Date: Tue, 29 Apr 2008 16:22:53 +0100


Readers,

I am having difficulty understanding how to enter commands into r.

I have data arranged as:

100, 200, 300
5.6, 6.7, 7.8
8.9, 9.0, 0.1
1.2, 2.3, 3.4

The data is saved in csv format and I use the command 'read.table' to import into r.

The values 5.6...3.4 are a function of values 100,...300, i.e. 100,...300 are independent variables (x). The function is a power series:

y=a+bx+cx^2

How do I obtain the values of a,b,c by minimisation of the sum of squares of deviations?

So far looking at the documentation 'r-intro' section 10, I tried the following:

functionname<-function(a,b,c){
+ a<-sum(a)
+ b<-sum(b)
+ c<-sum(c)
+ y<-(a+bx+cx^2)
+ x<-(x)
+ }

The documentation states: "...using a call such as...". What does this mean?

Yours,

rhelp_at_conference.jabber.org

gnu/linux mandriva 2008
r 251 (27-06-07)



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 29 Apr 2008 - 17:05:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Apr 2008 - 22:30:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive