e-letter
2008-Apr-29 15:22 UTC
[R] how to solve a power series linear coefficient equation
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)
stephen sefick
2008-Apr-29 19:33 UTC
[R] how to solve a power series linear coefficient equation
I am not entirely sure what it is that you want to do. functionname<-function(a,b,c){ + a<-sum(a) + b<-sum(b) + c<-sum(c) + y<-(a+bx+cx^2) + x<-(x) + } for each <- your are defining and object. it doesn't make much sense to sum(a) unless you have made a something etc. Look at packages- type CRAN into search engine and go to the main site - go to search. And figure out what it is that you want to do and try to find people that have had the same issues that you are having. If you look into the literature and find what you want to do it is probable that there is a contributed package that can get you going. On Tue, Apr 29, 2008 at 11:22 AM, e-letter <inpost@gmail.com> wrote:> 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@conference.jabber.org > > gnu/linux mandriva 2008 > r 251 (27-06-07) > > ______________________________________________ > R-help@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. >-- Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis [[alternative HTML version deleted]]
Maybe Matching Threads
- solve the quadratic equation ax^2+bx+c=0
- solving non-linear system of equations
- [LLVMdev] strange behaviour after extracting optimization pass code
- [LLVMdev] strange behaviour after extracting optimization pass code
- fit a non-linear equation with several dependent variables