Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need VFP callable routine for calc of least squares/regr
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00493813
Message ID:
00494128
Vues:
21
>A couple thoughts:
>
>1. Excel is setup to handle that type of analysis. Import and run!
>
>2. A book on stats would give you the algorithms you need if you want to perform this in VFP. It shouldn't be that difficult to translate.
>
>Jay

The following website explains it:
http://www.shodor.org/succeed/compchem/tools/llsalg.html

y = m*x + b

All you need to do is accumualate five variables as each data point is entered:

n = number of values
nSumX = sum of the x values
nSumY = sum of the y values
nSumXY = sum of the (x*y) values
nSumX2 = sum of the x^2 values


m = (n*nSumXY - nSumX*nSumY)/(n*nSumX2 - nSumX*nSumX)
b = (nSumX2*nSumY - nSumXY*nSumX)/(n*nSumX2 - nSumX*nSumX)

As each data point is entered the counter, n, is incremented and the other sums accumulated. A data point is removed by decrementing n and subtracting the appropriate values from the sums.

Very easy to do.
JLK
Nebraska Dept of Revenue
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform