Re: VFP and Least Squared Regression

Author: Gérard Lochon

Posted: 2011-11-30 at 00:01:35

> 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

_______________________________________________

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/ACECCE2BB9F54325A2C2392C37B2F87A@MuriellePC

** 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érard Lochon