Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculate STD() vs. Excel STDEV() function
Message
De
02/09/2002 10:11:13
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
02/09/2002 09:56:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00695910
Message ID:
00695940
Vues:
17
>>>I don't know a native command. I could probably write you a func... if you ever need it. I was reading somewhere that fox is quite good for developing mathematical functions (amongst other things) etc
>>
>>OK, thanks.
>
>Couldn't resist the challenge...
>
>FUNCTION MyStDev
>LPARAMETERS tcfieldName, tcAlias
>LOCAL lnReccount, lnSum, lnSquare
>LOCAL lcTalk
>
>lcTalk = SET( "TALK")
>SET TALK OFF
>
>lnReccount = RECCOUNT( tcAlias)
>
>CALCULATE SUM( EVALUATE( tcFieldName)) TO lnSum
>
>CALCULATE SUM( EVALUATE( tcFieldName)^2) TO lnSquare
>
>SET TALK &lcTalk
>
>RETURN SQRT((( lnReccount*lnSquare) - ( lnSum^2))/ (lnReccount*(lnReccount-1)))

OK.

Are you aware that you calculate more than one expression in the CALCULATE command? This would probably be slightly faster.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform