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

e-letter inpost at gmail.com
Tue Apr 29 17:22:53 CEST 2008


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)



More information about the R-help mailing list