Re: [amibroker] Standard deviation of matrix elements

 

Hello.
Me too i was playing 3 days ago and i went up to this code
The output is correct, but i dont know is there is a sorter version.  have a fun and i hope it helps.

Panos

EnableTextOutput( 0 );
X = MxFromString( "{{88.5,94.7,84.3,90.1,89,89.8,91.6,90.3,90,91.5,89.9,98.8,88.3,90.4,91.2,90.6,92.2,87.7,91.1,86.7,93.4,96.1,89.6,90.4,91.6,90.7,88.6,88.3,94.2}}" );
printf( MxToString( X ) );

col = MxGetSize( x, 1 );  

sumX =  sXsq= 0;
for( i = 0; i < col; i++ ) {
   sumX += x[ 0 ][i ];         // sum of Row Χ
    // variance Of X
   sXsq +=  x[ 0 ][i ] ^2 ;     // sum of square Χ
   //    printf( "\n sXsq X   =\t" + sXsq );
}

MeanX=sumX/col;   
VarianceOfX = (sXsq/col)-MeanX^2;
// Standard Deviation is a measure of how spread out numbers are
StandardDeviation = sqrt(varianceOfX);   // Population Standard Deviation= The formula is the square root of the Variance
SampleVariance = sqrt(sumX/col-1);       // Sample Standard Deviation= divide by N-1 when calculating Sample Variance


printf( "\n Sum X= \t%g", sumX );
printf( "\n Mean Of X = \t%g", MeanX ); 
printf( "\n sum of square = %g", sXsq );
printf( "\n Variance Of X = \t%g", varianceOfX );
printf( "\n Standard Deviation \t"+ StandardDeviation  );
printf( "\n Sample Data \t"+ SampleVariance  );

Panos


On 09-07-16 9:44 PM, 'TA' tagroups@sbcglobal.net [amibroker] wrote:

 

Does anybody know how to calculate Standard deviation of matrix elements in AB? TIA


__._,_.___

Posted by: Panos Boufardeas <panosbouf@gmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/


.

__,_._,___


EmoticonEmoticon