Re: Generating best-fit line formula for arbitrary list
- To: mathgroup at smc.vnet.net
- Subject: [mg103386] Re: [mg103370] Generating best-fit line formula for arbitrary list
- From: Matthias Bode <lvsaba at hotmail.com>
- Date: Sat, 19 Sep 2009 05:27:15 -0400 (EDT)
- References: <200909180938.FAA09149@smc.vnet.net>
Hello Kelly: Perhaps you are looking for http://mathworld.wolfram.com/LeastSquaresFitting.html as "the best-fit line for a given List". Best regards, MATTHIAS BODE COCHABAMBA/BOLIVIA > Date: Fri, 18 Sep 2009 05:38:02 -0400 > From: kelly.terry.jones at gmail.com > Subject: [mg103370] Generating best-fit line formula for arbitrary list > To: mathgroup at smc.vnet.net > > Mathematica's Fit function can find the best-fit line for a given List: > > Fit[Table[Prime[n],{n,1,20}],{1,x},x] > > I want Mathematica to spit out the formula for linear regression for > an arbitrary list. This fails: > > Fit[s,{1,x},x] > > since "First argument s in Fit is not a list or a rectangular array". > > This works: > > t = Table[s[n],{n,1,20}] > Fit[t,{1,x},x] > > but is ugly and unhelpful, since it mentions each of the 20 terms > individually, and doesn't generalize to an arbitrary-size list. > > I'm looking for things like Mean[t] or Apply[Plus,t^2] in the answer. > > Can I make Mathematica give me the general formula here? > > -- > We're just a Bunch Of Regular Guys, a collective group that's trying > to understand and assimilate technology. We feel that resistance to > new ideas and technology is unwise and ultimately futile. >
- References:
- Generating best-fit line formula for arbitrary list
- From: Kelly Jones <kelly.terry.jones@gmail.com>
- Generating best-fit line formula for arbitrary list