Standard deviation in abap

Dear Freinds,
I want to calculate standard deviation of my internal table columns  in abap code , please help me how to calculate it  .
Thanks,
Naveen

hi,
try this code for calculating it:-
REPORT abc.
DATA : BEGIN OF itab OCCURS 0,
num TYPE i,
END OF itab.
data : std type p decimals 2.
itab-num = 8. APPEND itab.
itab-num = 25. APPEND itab.
itab-num = 7. APPEND itab.
itab-num = 5. APPEND itab.
itab-num = 8. APPEND itab.
itab-num = 3. APPEND itab.
itab-num = 10. APPEND itab.
itab-num = 12. APPEND itab.
itab-num = 9. APPEND itab.
PERFORM stdev changing std..
write :/ std.
FORM stdev CHANGING std.
DATA : mn TYPE p DECIMALS 2.
DATA : sm TYPE i.
DATA : sm2 TYPE i.
DATA : dev TYPE p DECIMALS 2.
DATA : cnt TYPE i.
LOOP AT itab.
sm = sm + itab-num.
cnt = cnt + 1.
sm2 = sm2 + ( itab-num * itab-num ).
ENDLOOP.
mn = sm / cnt.
dev = ( sm2 - ( ( ( sm * sm ) / cnt ) ) ) / ( cnt - 1 ) .
dev = SQRT( dev ).
std = dev.
ENDFORM. "stdev
Edited by: ricx .s on May 2, 2009 1:50 PM
Edited by: ricx .s on May 2, 2009 1:51 PM

Similar Messages

  • I need to chart a standard deviation of a moving average in Numbers

    In order to complete my statistical analysis of a large ammount of performance data- I was to graph a +/- 2 standard deviation of a moving average AS A SHADED region on my charts.  I tried to do this today for Four hours.  HELP!  PLEASE and thank you SO Much! 

    You stated:
    I have the above charted with the $ values of gains
    BUT IT LOOKS LIKE THIS. "
    implying it is not correct.  Since I don't understand what you are trying to do in general terms I don't know what the problem is.
    Can you post some of the data (at least the set you are showing) so we have something to work with?
    I made a graph like this:
    But since I don't really understand what you want I don't know if this is correct or not.
    Wayne

  • ABAP Development standards for HR- ABAP

    Hi ALL
    Does any body has any document for Programming standards in HR ABAP programming.
    Thanking in advance for you support.
    cheers
    AJ

    Hi,
    Check out this thread.
    ABAP-HR
    Cheers,
    Swamy Kunche

  • How to calculate standard deviation of a certain number of points?

    Hi, I have an application that I acquire force signals and pu then on a array.
    I need to calculate the standard deviation and the mean each a certain number of points, 1000 for example.
    I'm having problems with this, if you can help me I'd be thankful.
    Thanks
    Douglas
    Solved!
    Go to Solution.

    So you need something like this?
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Std_Deviation.png ‏12 KB

  • Help on standard deviation please

    I am writing a program to find standard deviation. Below is what I have so far "not much I know" but I have tried so don't get flame happy. It errors out and I have tried to fix it. I know the formula for standard deviaition but I can't seem to program it right. I also need to program the code to have three methods the main, an Average method, and a standard deviation method. I know how to make a method but I am having trouble on how to call them. Any help would be appreciated. I am not asking anyone to do my work for me just give me some tips. I would rather take a 0 on the assignement and learn later than turn in someone else's work becaue I will never pass my final if I do that.
    import java.text.*;
    import javax.swing.*;
    class StandardDeviation{
         public static void main(String [] args){
         DecimalFormat df = new DecimalFormat("0.00");
         //Average Code Segment
              double [] values = {10,20,30,4,2}; //Assigns numbers to values
              double valueAverage,square, sum = 0;
              for(int i = 0; i < values.length; i ++){
                   sum += values;
              valueAverage = sum / 5; //Computes Average
              System.out.println("Average is: " +valueAverage); //Displays average of values to test to see if it worked     
    //Deviation Code Segment
    for (int i = 0; i < values.length; ++i)
    double diff = values - valueAverage;
    sum+= diff*diff;
    System.out.println(+ Math.sqrt(sum/(values.length - 1))); // here I was trying to test to see if my formula worked          
    I get the following error
    java:20: operator - cannot be applied to double[],double
    double diff = values - valueAverage;

    Okay this code works. Duffymo can you give me some pointers of writing this code using multiple methods? I can write the methods. I just have a hard time grasping the concept of calling them. I have had a hard time learning this in java. I also looked at some of your past posts on Standard Deviation I see what you are saying about the multiple methods. I know that I need a main method that would probably include the values. Then I would have a average method which would call the values to compute the average. Then I would have the StdDev method to compute the Standard deviation method. Any tips on where to begin on this?
    mport java.text.*;
    import javax.swing.*;
    class StandardDeviation{
         public static void main(String [] args){
         DecimalFormat df = new DecimalFormat("0.00");
         //Average Code Segment
              double [] values = {10,20,30,4,2}; //Assigns numbers to values
              double valueAverage,square, sum = 0;
              for(int i = 0; i < values.length; i ++){
                   sum += values;
              valueAverage = sum / 5; //Computes Average
              System.out.println("Average is: " +valueAverage); //Displays average of values     
              //return valueAverage;
         //Deviation Code Segment
    for (int i = 0; i < values.length; ++i)
    double diff = values[i]- valueAverage;
    sum+= diff*diff;
    System.out.println("The Standard deviation is: "+ df.format(Math.sqrt(sum/(values.length - 1))));

  • Customizing the standard web dynpro ABAP travel application

    Dear All,
    Scenario :
    We want to modify the existing travel application------> Create Travel Request should open an interactive adobe form
    which will capture all the data and update the backend table , instead of the web dynpro screen and similarly for plan trip .
    I wanted to know what is the best practice or approach for this and how to go about it.
    Regards,
    Geet

    Hi All,
    Need your valuable inputs on this.Also when I was trying to replace the standard web dynpro abap screen for create travel request...coudnt find the view.I mean on the overview of Trips and Expenses there is a button for Create Request but I am unable to find the view where this button is placed....I think its getting created dynamically.
    My concern is how to call my interactive form when the button for create request is clicked...dont know where to place it.
    Regards,
    Geet Bijlani

  • Standard deviation in graph (bar chart)

    Dear Community,
    I am looking for a solution for my measurement analysis software, programmed in LabVIEW 8.5:
    I have an array (1D, double) with some data. This data is shown in an graph as a bar chart (attachment 1 & 2).
    Aditionally, there is an other array (also 1D, double) with the standard deviation of my data in the upper array (both calculated via standard deviation and variance VI)
    How can I integrate this standard deviation in my graph to be shown as (colored) error bars (attachment 3)
    Thanks for your help!
    Best regards,
    Iwo
    Attachments:
    Graph_in_vi.jpg ‏38 KB
    Bar_chart_without_std_dev.jpg ‏853 KB
    Bar_chart_std_dev.jpg ‏54 KB

    Dear lwo,
    You can add two more channels.
    One with mittelwert+standardabweichung/2
    and one with mittelwert-standardabweichung/2 .
    Then configure them to show only symbols and no line.
    Color them red and choose a cross as symbol.
    Be sure, the mittelwert channel is the first one in the array,
    or the bars will hide the crosses.
    Best regards,
    Stefan Heinzl
    Message Edited by Stefan Heinzl on 03-09-2009 09:56 AM
    Attachments:
    Block Diagram.jpg ‏17 KB
    Front Panel.jpg ‏40 KB

  • Standard Deviation

    I was wondering how you get the standard deviation to show up on the graph. I know where the button is to activate the standard deviation for a simple bar chart, however it doesn't show the actual deviation, it gave me uniform for each bar in the chart. How can I fix this? Also I know that the standard deviation isn't the same because I have seen what the chart I am making is supposed to look like.

    cgord wrote:
    ... I know that the standard deviation isn't the same because I have seen what the chart I am making is supposed to look like.
    cgord,
    The problem is that Numbers doesn't know what your chart is supposed to look like. It's doing the best it can. There is no such thing as a standard deviation for a single point. Numbers considers that your series is a data set and calculates a mean and standard deviation for the set. It then applies this mean and deviation to the error bars, in a proper way, the same for each member of the set.
    If your data set is actually a collection of dataset averages, each with a standard deviation of its own, then it might be appropriate to show each bar with it's own custom error bar, calculated elsewhere.
    To make this work, you would display each bar's corresponding StdDev in the same row as the mean you are charting and then you would indicate to Numbers which column this custom error bar data is located.
    Hope this helps.
    Jerry

  • Standard Deviation in Graph

    Does anyone know how insert standard deviation into a bar graph??
    Thanks.

    Ah. The key point that I was missing was that this works (for points or bars) only when the series is selected in the graph. Otherwise the boxes are not enabled.
    See also http://discussions.apple.com/thread.jspa?messageID=9256703 for related info.

  • Adding standard deviation bars to graphs

    I have composed a bar graph on numbers, and have already calculated the standard deviation of my data. How do I add the standard deviation lines to each bar on my graph? Thank you.

    Details available in *_Numbers User Guide_*, page #148 in the English version.
    Yvan KOENIG (VALLAURIS, France) lundi 6 décembre 2010 16:44:20

  • Display of standard deviation in graphs

    Hello,
    I am trying desperately to find out how to present standard deviation within adobe illustrator generated graphs. Can anyone please help me with this problem?
    p.s
    I am using adobe-illustrator CS2 and winXP
    tnx

    Dear lwo,
    You can add two more channels.
    One with mittelwert+standardabweichung/2
    and one with mittelwert-standardabweichung/2 .
    Then configure them to show only symbols and no line.
    Color them red and choose a cross as symbol.
    Be sure, the mittelwert channel is the first one in the array,
    or the bars will hide the crosses.
    Best regards,
    Stefan Heinzl
    Message Edited by Stefan Heinzl on 03-09-2009 09:56 AM
    Attachments:
    Block Diagram.jpg ‏17 KB
    Front Panel.jpg ‏40 KB

  • Making a Bell Curve in Numbers or MS Office for MAC: I already have mean and standard deviation

    I hope my question is a simple one with a simple answer: I have the results of a mid-term and the professor gave us the mean and standard deviation of the results of the exam from which he based our grades. I am a visual person and (to be honest) without having to put forth a lot of effort, I would like to see visually where I fall on this, admittedly, artificial curve. I have both Numbers and MS Office on my MacBook Pro. Is there an easy way to create a bell curve using these numbers? It seems like there should be since those are usually the only numbers needed. I just, honestly, don't want to do the tedious work myself.

    Statistical functions including several which deal with normal distribution, are discussed in Chapter 10, Statistical Functions, of the iWork Formulas and Functions User Guide. This useful guide may be downloaded via the Help menu in Numbers '09. Go to chapter 10, or for a direct route, search 'normal distribution'
    For what it's worth, you can find the formula  for calculating the coordinates for the bell curve here: The-Normal-Distribution-Or-Bell-Curve
    Regards,
    Barry

  • Is there a way to find a rolling standard deviation?

    Hello,
    I am currently taking a large amount of data points, and recording 1 out of every 1000 points to a spreadsheet, and saving the latest 1000 points taken to record to a spreadsheet when the program has finished.  I would like to be able to know the overall standard deviation of all the points (approximately 36000000 data points, of which I will only record 36000), but I will not be saving all the data points.  Is there a way to approximate the standard deviation (of all the points, not just the ones I record)?
    I know that I can find the exact mean by continuously summing and then dividing by the number of points taken.  I also know that if the mean remains constant, I can start with a standard deviation, find the sum of the residuals squared, and add the new residual for each data point.  The problem is that the mean is changing, so each time a new data point is added, the residuals for all the earlier points are also changed. 
    I'm sorry if this is more of a math problem than a coding issue, but I thought perhaps there would be a way to approximate it in LabVIEW.
    Thanks
    Solved!
    Go to Solution.

    Broken Arrow wrote:
    What about the Point by Point SD VI?
    Well, that's exactly what the OP did not want...
    (quote: I would like to be able to know the overall standard deviation of all the points (approximately 36000000 data points, of which I will only record 36000), but I will not be saving all the data points.  Is there a way to approximate the standard deviation (of all the points, not just the ones I record)?)
    However, you can use the standard_deviation_ptbypt to get the global value without much memory impact by setting the sample lenght to zero.
    Of course my example can be futher simplified as attached. (The earlier version was a verbatim translation of the article). Modify as needed. I also added the ptbypt version. You can look at the code of the ptbypt version, it's quite similar (look for the "infinite horizon" case). Personally, I prefer to use a size=3 array instead of multiple scalar shift registers.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    RunningSD1.vi ‏31 KB

  • How to wire input to "Standard deviation & Variance VI"

    The data that is being read is an I16 file in a 2 dim array. I need to compute to mean and standard deviation for all the numbers in the array. If I wire this 2 dim array to the input of the "Standard Deviation and Variance" vi function I get a broken wire. I've tried numerous functions to convert the data into a format but I get incorrect answers. I believe I need to convert all the rows and comumns into a series of numbers. There are 128 rows and 128 columns all with different numbers.

    I'd suggest you use reshape array, to reshape the 2D array into a 1D array. See the attached LV 7 example.
    I basically find the array size of the 2D array, multiply those dimensions sizes together and call reshape array. So, a 128x128 2D array becomes a 16K 1D array.
    Brian
    Attachments:
    2D_Mean.vi ‏26 KB

  • Curve fitting: Taking standard deviation into account

    Hi,
    Using LabView and Curvefitting. Following situation:
    I have 15points including their standard deviation. I also have set up my curvefitting with my individual gaussian fitting. Basically the fitting looks good.
    But how can i tell labview to take care about my already calculated standard deviation.
    I always compare it with my OriginPro fitting (same gaussian equation). If I only take my data X and Y I get the same results.
    But when I also indicate my standard deviation (in Origin), meaning X, Y and +-Y I get a more realistic result.
    And that is what I would like to do with LabView aswell but there is no possibility to take my +-Y in account, isn't it?
    (And no, the Origin VIs for LabView do not offer me this aswell. At least I don't see it )
    Anyone a hint?
    Thanks in advance
    Solved!
    Go to Solution.

    altenbach wrote:
    What is the "CurveFitting SubVi"?
    sorry, meaning CurveFitting Express.vi
    I have an equation like: a+b*10^(-c*(x-x0)^2)
    a, b are offsets. x0 is the center of my gaussian curve. and i'm interested in c which describes the width of the gaussian function.
    please have a look to the attached file:
    - the red dots are mmy data plus the standard deviation (white dots)
    - the green fitting curve is labview using the CurveFittingExpress
    - the yellow fitting curve is using LabView Non-Linear Fitting with weigthing
    - the blue fitting curve is the output I get using OriginPro. As you could see Origin is the only one taking care about the points at the edge (fitting inside the standard deviation)
    that means in terms of c:
    labview: 0.089
    origin: 0.053
    x0 is kinda similar. a,b, are different.
    that's it.
    Attachments:
    Capture.PNG ‏58 KB

Maybe you are looking for

  • Satellite L500/013 - How to make dual boot of Windows 7 and XP?

    Hi I just bougth my first Toshiba laptop, it comes with Windows 7 Professional pre-installed. Before I start spending hours on this, I am just wondering if this can be done: 1) I would like to use the Windows 7 Professional in 64 bit mode and then 2)

  • BP Report

    Dear All, Please if anyone know transaction for BP report and also how to Know who is the user that created the BP. Best Regards, Khairy Soliman

  • What is Microsoft.VisualStudio.Diagnostics.ServiceModelSink.Behavior doing in Azure web role

    Shortly after what seemed to be a successful web role deployment for one of our cloud service just now, these suddenly exploded for our WCF web site. Log Name:      Application Source:        System.ServiceModel 4.0.0.0 Date:          11/13/2014 8:40

  • How to change status icons in Kopete?

    Default icons are really bad. There is an option to change smilies, but I can't find the option how to change status icons (online, offline, etc.).

  • Where sued list ---- script?

    hi experts, just want to ask, is there any way i can trace or find a sapscript form is used by a programs? thanks in advance..