Re: VFP and Least Squared Regression

Author: G Gambill

Posted: 2011-11-30 at 09:48:59

This looks good. Thanks.

On Tue, Nov 29, 2011 at 10:01 PM, Gérard Lochon <g-lochon@wanadoo.fr> wrote:

>

>

>

> > Anyone know of a VFP friendly Least Square Regression Routine? Free is

> > good.

> >

>

>

> If you want the coefficients of a regression line :

>

> CREATE CURSOR test (xi n(4),yi n(4))

> INSERT INTO test VALUES (1,180)

> INSERT INTO test VALUES (2,182)

> INSERT INTO test VALUES (3,187)

> INSERT INTO test VALUES (4,188)

>

> ***

>

> SELECT ;

> AVG(xi),;

> AVG(yi),;

> SUM( (xi-(select AVG(xi) FROM test as hihi))* (yi-(select AVG(yi) FROM

> test as haha))),;

> SUM((xi-(select AVG(xi) FROM test as hihi))**2) ;

> FROM test ;

> INTO ARRAY atest

>

> ca = atest(3)/atest(4)

> cb = atest(2) - ca*atest(1)

>

> ***

>

> ?"Y = ca.X + cb"

> ?"ca = ",ca

> ?"cb = ",cb

>

>

>

>

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/CAPpp0hU9H6GBwvZcJ=fqU+C+7px9b3zNj9aw5w4tKDkae084Gw@mail.gmail.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 G Gambill