need a script to custom calculation to calculate the standard deviation

need a calculation script customized to calculate the standard deviation of 8 rows, it is a form .pdf variable data entry points will be users using this model as a form.

I can get the average of simple calculation, but struggling with the script for the standard deviation. Any help would be appreciated.

Header 1 Header 2 Header 3 Header 4 Header 5 Heading 6 Heading 7 8 header Header 9 Header 11
sample1Row1sample2Row1sample3Row1sample4Row1sample5Row1sample6Row1sample7Row1sample8Row1AveragestdDeviation

If the formula is not:

StdDev = sqrt (sum (sampleXRow1 - average) ^ 2 / (n-1))

But:

StdDev = sqrt (sum ((sampleXRow1-average) ^ 2) / (n-1))

If the code should be something like this:

var avg = Number(this.getField("AverageRow1").valueAsString);
var sum = 0;
var n = 0;
for (var i=1; i<=8; i++) {
    var v = this.getField("sample"+i+"Row1").valueAsString;
    if (v!="") {
        sum+=Math.pow((Number(v)-avg),2);
        n++;
    }
}
if (n==0 || n==1) event.value = "";
else event.value = Math.sqrt(sum / (n-1));

Tags: Acrobat

Similar Questions

  • Aggregator customized to calculate the standard deviation

    Hello
    This is probably already available or easy to implement, but I find it difficult to find samples for writing a custom aggregation and ParallelAwareAggregator.

    I'm figuring the difference type of a variable in my item being cached in a real-time system. I want to aggregate the result sum [(X-X') ^ 2] where I spend X' (average) of the client. Can someone help me with an example?

    Thank you
    Sairam

    Hi Sairam,

    in fact, you probably have better use the single-pass approach to calculate the standard deviation, as the average of the values may change before you calculate the number of entries and the average gap.

    You can use the following formula to calculate the standard deviation in one pass: sqrt (N * sum (sqr (Xi)) - sqr (sum (Xi))) / N, where the sqr function is the square of a value, the square root function is the square root of the value, N is the number of entries and Xi is the value to calculate the gap type from the entry of the i - th.

    You can do something like this:

    public static class StdDeviation implements ParallelAwareAggregator {
    
      public static class PartialResult implements Serializable {
    
          private long numberOfElements;
          private BigDecimal sum;
          private BigDecimal sumSquare;
    
          public PartialResult(long numberOfElements, BigDecimal sum, BigDecimal sumSquare) {
              this.numberOfElements = numberOfElements;
              this.sum = sum;
              this.sumSquare = sumSquare;
          }
      }
    
      public static class ParallelPart extends StdDeviation implements EntryAggregator {
    
         private ParallelPart(ValueExtractor extractor) {
            super(extractor);
         }
      }
    
      private ValueExtractor extractor;
    
      private transient boolean notParallel;
    
      public StdDeviation(ValueExtractor extractor) {
        this.extractor = extractor;
        this.notParallel = true;
      }
    
      public Object aggregate(Set entries) {
         ValueExtractor extractor = this.extractor;
         BigDecimal sum = 0;
         BigDecimal sumSquare = 0;
         long num = 0;
         for (InvocableMap.Entry entry : (Set) partialResults) {
            sum = sum.add(partialResult.sum);
            sumSquare = sumSquare.add(partialResult.sumSquare);
            num += partialResult.numberOfElements;
         }
    
         return calculateStdDeviation(num, sum, sumSquare);
      }
    
      public EntryAggregator getParallelAggregator() {
    
         // you could return this, instead of ParallelPart
         //
         // return this;
    
         return new ParallelPart(extractor);
      }
    
      private static Number calculateStdDeviation(long num, BigDecimal sum, BigDecimal sumSquare) {
         BigDecimal partRes = sumSquare.multiply(new BigDecimal(num)).subtract(sum.multiply(sum));
    
         // you can replace the square rooting of a double value with a proper implementation of square root for BigDecimals,
         // which I omitted for the sake of brevity, and then you can do BigDecimal division (make sure you provide a MathContext)
         return Math.sqrt(partRes.doubleValue())/num;
      }
    
      public static Number execute(NamedCache cache, ValueExtractor extractor) {
         return (Number) cache.aggregateAll(AlwaysFilter.INSTANCE, new StdDeviation(extractor));
      }
    }
    

    There is actually no reason for the class ParallelPart to exist. I put it here to illustrate that there can be a different aggregator instance to the ParallelAware aggregator optimized to run on the side of the storage, but you could just "this" return of the getParallelAggregator() method, it wouldn't make a difference for this implementation of the aggregator.

    You can replace the rooting square a double value with a good implementation of the square root of BigDecimals, which I omitted for brevity, and then you can make division BigDecimal (make sure that you provide a MathContext)

    I also omitted the ExternalizableLite and PortableObject implementations (and necessary parameterless constructors) for brevity of the ParallelPart and PartialResult classes.

    In addition, you may need some mojo if you want to use a PofExtractor instead of a regular Value Extractor to avoid the deserialization of the cached value.

    You can perform the aggregation with the execute method, passing the cache altogether on the Extractor which extracts the value as a BigDecimal value cached.

    Best regards

    Robert

    Published by: robvarga on March 12, 2010 11:36

    Published by: robvarga on March 12, 2010 11:43

  • calculate the standard deviation

    Hello

    as a pdf, I want to calculate the standard deviation of 5 named fields (F1, F2, F3, F4, F5) which is digital and I think that this can be done through a... custom calculation script can you help me please a code for this calculation...

    Thank you

    Here is a link that is tested in the fall zone file. You do not need to join, just click "continue to display" and download the form to use the form.

    Calculate the standard deviation

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

    Hi, I have a request that I acquire signals of strength and Pu, then on a table.

    I need to calculate the standard deviation and the mean each a number of points, 1000 for example.

    I have problems with this, if you can help me I would be grateful.

    Thank you

    Douglas

    If you need something like this?

  • Help! Need a script to automatically open files with the same name but in another location.

    Good morning friends,

    So for my work, I need a script to open files with the same name but located in a different folder. But since I'm a total noob when it comes to programming, I can't understand how do. That's what I have in mind:

    -J' I manually open an image.

    -The script will look for a file with the same name in another folder that I've specified.

    -The script will then select the channel CMYK of the second file and copy and paste it into the first file.

    -The second file is then closed without saving the changes.

    I have problems with the part where the script searches for a file with the same name as the opened file. I would really appreciate help. Thanks in advance.

    If (app.documents.length > 0) {}

    myDocument var = app.activeDocument;

    var Nomdoc = myDocument.name;

    try {var basename = docName.match (/(.*)-.)} [ ^\.] +$/)[1]}

    catch (e) {var basename = thedoc.name};

    var path = / * path of folder to insert as a string here * / + ' / ' + base name + / * insert file extension, including the period as a string here * /;

    If (queue (path) .exists == true) {var otherDocument = app.open (File (path))};

    };

  • Process of calculation to calculate the value after submit after all validations

    Hello

    Please help with a possible approach or suggestions for the calculation process.

    I have a calculation process after submit I want to calculate its value after that all validations are handled. Because this process of calculating trim is off of the first part of the input string of the user for the P3_USES element. Thus, for example consider; the user selects a value for P3_USES (point list manager) to be "TAC"... BCA... BCA... BCA... 0.CA BC... "CA IT BC. So my calculation process just stripes off the coast of the first portion of the string and computes the value will be "BCA"... BCA... BCA... 0.CA BC... "CA IT BC. It works fine when all postings on the page are placed without cooking.

    The problem occurs, then the validation fails on the form. Once the validation fails, the calculation process; already calculates the value and the P3_USES value form element is set to "BCA"... BCA... BCA... 0.CA BC... "CA IT BC. So, here the user solves the problem of validation and sends it again the form, but at this point the value is calculated again but this time that my string is "BCA"... BCA... BCA... 0.CA BC... CA IT BC"which is not correct, because my initial user string entry was"TAC"... BCA... BCA... BCA... 0.CA BC... "CA IT BC.

    So my question is how they treat the value of my calculation after all validations. While I can keep the original value of the P3_USES element. I'm using the version of Oracle APEX 4.0 and Oracle 10 g R2 database.

    Thank you

    Rambeau

    Hello

    Combine code of calculation and validation?

    Perform the calculations in the process?

    Use another element to contain the value 'real '?

    Kind regards

    Jari

  • need a script to create multiple tables as the other columns in tables

    I need script to create multiple tables as the other columns of tables respectively.

    lets consider I want to create tables from table1... table99 like tablex1... .tablex99 columns (without data) respectively (i.e table1 as tablex1, table99 as tablex99).
    declare
    
    cursor c is select object_name from all_objects where object_type='TABLE';
    
    begin
    
    for i in c loop
    
    execute immediate 'create table '||i.object_name||'_x as select * from '||i.object_name||' where 1=2';
    
    end loop;
    
    end;
    
    use can use this and put your user names accordingly.
    If you get any error please post the error.
    
  • Custom templates other than the standard in online store Modules?

    To all the gurus of BC...

    I came across this Web page today during a search and I'm curious. Can I really get a customizable individual produced large screen in addition to the standard in models of Module of Shopping? Which means, I can be operational with one product with one and another product using it?

    http://Knowledgebase.BusinessCatalyst.com/kb#/KB/layouts/custom-templates

    Thank you

    Chuck

    Hi Chuck,

    It seems that you hope to have possible several layouts for specific products which unfortunately is not available at this stage.  There are only 2 small product dedicated page and 1 presentation of great details.

    So eager to pack the product article to another model, you can assign the product element to a specific catalogue for the single model, but available would be consistent with what I noted above.

    Kind regards

    -Sidney

  • Need a script CS4 - reissue of bonds of the illustrator files

    I have a 7 100 pagemaker document pages that contain the same layout of tables, each table that is bound to a different illustrator file.  I used to run a simple script that ran through all the pages and relinked each file.  How do I do this in InDesign CS4?

    Old writing looked like this... (I use a loop in VB to print the text of this script)

    Page 1

    textSelect (4.8)

    create a link to C:\\filename\Alabama\graphic1

    textSelect (4,10)

    create a link to C:\\filename\Alabama\graphic2

    page 2

    textSelect (4.8)

    create a link to C:\\filename\Alaska\graphic1

    textSelect (4,10)

    create a link to C:\\filename\Alaska\graphic2

    ....

    The States don't want nothing to say I just used as an example to illustrate what I'm doing.

    I need to know how exactly the same way in CS4.  I've looked everywhere and can't find what I'm looking for.  JavaScript is better.

    Thanks for any help!

    You searched for a hotel anywhere - have - you read all these messages?

    http://forums.Adobe.com/search.jspa?communityID=3331&resultTypes=message&q=relink

  • Need to create a derived metric to calculate the amount of memory in GB

    Hi team,

    We would like to know how we can create a Derived metric to determine the usage of the memory of a specific host in the UK, I have a host who, as 80 GB memory and I need to create an alert when usage exceeds 40 GB...

    I saw the Option for the used memory capacity but it shows in Mo... How to convert the same into GB

    Concerning

    Sriram S

    You need not create a metric derived to do what you want.  Who would try too hard.

    Memory is usually stored in Foglight in megabytes.

    Just write the rule to create the alert when it exceeds (40 * 1024) MB.

  • Mileage reimbursement form (custom calculation)

    I am trying to create a script to custom calculation for a mileage reimbursement form. I have a box titled 'engine miles' and I would like to only by the amount of 2014 de.56 IRS for a refund 'total '. If someone has a formula for this it would be greatly appreciated!

    Create a hidden field with this value (remember to use it as default), and then simply use the built-in function of product in the tab calculate to get the result of the multiplication of these two fields. This will make much easier to edit the file in the future, if need be.

  • Custom calculation - multiple if statements

    Hi guys

    I'm stuck with a simple If statement. New to JavaScript.

    I have a text field, drop-down "Gender" field "field" and the text field 'risk '.

    In the 'risk' text field, I need to have a custom calculation script to know if 'Male' > = 45 or female > = 55, risk + 1.

    I currently have the use of this:

    Event.Value = "";

    var a = + this.getField ("Age") .value

    var b = this.getField ("Gender") .value +


    If (a > = 45 & & b = "Male") event. Value = '+ 1'

    ElseIf (a< = 45 & & b = "Male") event. Value = '0'

    If (a > = 55 & & b = 'Female') event. Value = '+ 1'

    ElseIf (a< = 55 & & b = 'Female') event. Value = '0'

    Any help will be appreciated.

    I notice another error. You are attempting to convert the value of sex together with the sign, even if it is not. This generates an error and prevents your working code.

    Here is the fixed code:


    var a = +this.getField("Age").value;
    var b = this.getField("Gender").value;
    
    if (a>=45 && b=="Male") event.Value = "+1";
    else if (a<=45 && b=="Male") event.Value = "0";
    else if (a>=55 && b=="Female") event.Value = "+1";
    else if (a<=55 && b=="Female") event.Value = "0";
    else event.value = "";
    


  • Calculation based on the checkbox is enabled?

    I have a form that sub total a group of field. Based on this subtotal I need to calculate a tax of 5% finance, if the box is checked, otherwise the financing costs are zero. Any help would be appreciated. Thank you

    You can use this script to custom calculation for the field of cost of funding. Of course, you will need to adjust the field names in the code to match those of your file.

    if (this.getField("CheckBox1").value=="Off") {
        event.value = 0;
    } else {
        event.value = Number(this.getField("SubTotal").value) * 0.05;
    }
    
  • Calculate the (age) years between two dates

    Nice day!

    I have not been able to find an answer, that I was able to use in the archives or online and would be very grateful for the help.  I'm working with Adobe Acrobat Pro XI (not LiveCycle) and I have very little experience with programming (for the most part, copy / paste).

    I need to create a text box that calculates the number of years between two dates entered, i.e. the age when the date of birth and death are given.  Also, would be nice if she was a Virgin until the two were provided.  Anyone would be able to give me the code I need to put in the custom calculation script?

    Once again, any help would be much appreciated!  Thank you and have a wonderful day!

    For the fields for Date of birth DOB and DOD for the Date of death and age in complete years both by using a'd-mmm-yyyy' date format you can use a custom calculation to the JavaScript for the field of age as:

    function GetField (cName) {}
    get the field with error trapping object;
    oField var = this.getField (cName);
    test error;
    if(oField == null) app.alert ("error during the" + cName, 1, 0);
    Returns the field object;
    return oField;
    } / / end GetField function;

    function {Scand (cFormat, cString)
    using date string format convert object date;
    convert string to date using format;
    Kai var = util.scand (cFormat, cString);
    the value null is an error of conversion;
    if(oDate == null) app.alert ("Conversion error" cString "by using the format" + cFormat, 1, 0);
    date of return;
    Return to oDate;
    } / / end Scand function;

    clear the value of the field;

    Event.Value ="";
    get data dob and dod;
    var oDOB = GetField ("DOB");
    Var o = GetField ("DOD");

    treat only if DOB and DOD have value and are not null;
    If (oDOB! = null & o! = null & oDOB.value! = "" & oDOD.value!) = "") {}

    convert the DOB and DOD to date objects.
    oDOB var = util.scand ("d-mmm-yyyy", oDOB.value);
    O var = util.scand ("d-mmm-yyyy", oDOD.value);

    get the difference over the years;
    var Age = oDOD.getFullYear () - oDOB.getFullYear ();

    adjust for month of previous DOD DOB;
    If (oDOD.GetMonth)< odob.getmonth())="">

    adjust the DOD before DOB date in the month of birth;

    If (oDOD.GetMonth () == oDOB.getMonth () & oDOD.getDate ())< odob.getdate())="">
    Set the value of the field;

    Event.Value = Age;
    }

  • Creation of calculation based on the result of the drop-down list

    Hello. I hope that someone will be kind enough to help me with some Javascript because it seems that I am too blonde and middle ages to figure out by myself.

    I have a drop-down list box 'Member '. The Yes value is 0. The value is 10.

    Then I have three check boxes. "Day 1" value is 35. "Day2" value is 25. 'Dinner' value is 65.

    If this option is enabled, I want the sum of the check boxes, if they are checked. (for example, total if all checked = 125)

    If no is selected, the value of each check box rose 10. (for example, total if all checked = 155)

    I use Acrobat X.

    Thanks in advance.

    Due to the fact that you want to add a constant number of values if a given condition is met then you will need to use a custom calculation script.

    get the value of the fields

    var cMember = Number (this.getField("Member").value);

    var nDay1 = this.getField("Day1").value;

    var nDay2 = this.getField("Day2").value;

    var nDinner = this.getField("Dinner").value;

    define a varaiable for the sum

    var sum = 0;

    day 1 more SETTINGS

    If (nDay1! = "Off") the sum += (nDay1) Number + cMember;

    day 2 more SETTINGS

    If (Day2! = "Off") the sum += (nDay2) Number + cMember;

    more dinner SETTINGS

    If (nDinner! = "Off") the sum += (nDinner) Number + cMember;

    Event.Value = sum;

    Excel is easy if you would see Microsoft calculations.

Maybe you are looking for

  • Y at - it an indicator to show how much my mac started from?

    I just cloned my internal hard drive, so I should have 2 bootable volumes now.  I went to test (to ensure that the cloned disk works and is able to start properly my iMac).  I restarted the iMac using the down option. I chose the clone of startup, bu

  • Satalite Pro A60 overheating and crashing

    My satalite Satalite A60 Pro keeps overheating and crashing. It says something about an ati driver. I downloaded a bios between bios-190trad of this Web site.I burned the iso to the disk, but I can't get the laptop to boot from the disk in the read m

  • Satellite L505 - cannot delete files

    Hi all I received my new laptop and was quite happy with it, but it is a problem that I can't solve.There are files on my laptop (I installed myself) I can't remove it, the system tells me that the files are currently open or used by another system,

  • Report of D2TabNumFormat table

    Hi all! I have some difficulties to use D2TabNumFormat in a report. Is it possible to dynamically color a cell, using a channel property (minimum/maximum) value, with the D2TabNumFormat function? Knowing that I already use a command requiring user of

  • Can not burn on movie maker

    "I get this message when I try to burn the disc," there is not enough space in the folder, or you don't have permission to save files to the folder. 'Free space on your hard drive' I thought I erased the space on my hard drive. What should I do now?