Expandir minha barra de realizações na Comunidade.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

Esta conversa foi bloqueada devido à inatividade. Crie uma nova publicação.

SOLUCIONADO

Is there a function in FormCalc for Standard Deviation (Excel StdDev)

Avatar

Level 5
 
1 Solução aceita

Avatar

Resposta correta de
Employee

Thanks, I checked that. SD can be calculated for sample and population. I was using the Population's formula. Now, I have used the sample's and it is working as per your expectations. Fixed Form.

 

For this, the following script is being used:

 

var rows = this.resolveNodes("tblTestData.repeatingRow[*]");
var sm=0; 
var cm=0;
for(var i=0;i<rows.length;i++)
{ if(rows.item(i).airVoids1.rawValue)
{
sm+= Math.pow(rows.item(i).airVoids1.rawValue - form1.page1.tblTestData.row2.amountMeanX.rawValue,2);
cm=cm+1;
}
}
form1.page1.tblTestData.row2.amountDeviation.rawValue = Math.sqrt(sm/(cm-1));

 

Ver solução na publicação original

12 Respostas

Avatar

Employee

Let's assume you have the mean stored in a variable called 'mean' and the values are in an array called 'values' of length n. Then the way to calculate SD in FormCalc is:

 

sum=0;
for i=0 upto n step 2 do
sum=sum + Math.pow(values[i]-mean,2);
endfor
SD = Math.sqrt(sum/(n));

 in Javascript

 

 

sum=0;
for (i=0; i<n; i++)
{sum+=Math.pow(values[i]-mean,2);}
SD = Math.sqrt(sum/(n);

 

 

 

 

Avatar

Level 5

I'm missing something.  Here's a copy of my form.  The Standard Deviation field is under 1. Test Data.

Avatar

Employee

Sorry, but I can't access the form's link. can you please share via Google Drive?

Avatar

Level 5

Avatar

Employee

Do you want to calculate the SD of Air Voids column?

Also, in the Mean (X) field, you are calculating the sum of Air Voids. shouldn't it be the average instead of sum?

Avatar

Level 5

The calculation for Mean is sum of AirVoids divided by the number of Station.

 

Yes, formula for ST of Air Voids column is what I need 

 

 

 

Avatar

Employee

I have fixed your form for both Mean and SD. I have added the following JavaScript code on the calculate event of SD field:

 

var rows = this.resolveNodes("tblTestData.repeatingRow[*]");
var sm=0; 
var cm=0;
for(var i=0;i<rows.length;i++)
{ if(rows.item(i).airVoids1.rawValue)
{
sm+= Math.pow(rows.item(i).airVoids1.rawValue - form1.page1.tblTestData.row2.amountMeanX.rawValue,2);
cm=cm+1;
}
}
form1.page1.tblTestData.row2.amountDeviation.rawValue = Math.sqrt(sm/cm);

And following code to calculate the Mean:

 

Avg(repeatingRow[*].airVoids1);

This is the fixed form.

Avatar

Level 5

The StdDev does not provide the same outcome in the "fixed form" as in the original Excel....see here

Avatar

Employee

Can you give me edit access to the excel sheet?

You should have it.  Please try again

 

Avatar

Resposta correta de
Employee

Thanks, I checked that. SD can be calculated for sample and population. I was using the Population's formula. Now, I have used the sample's and it is working as per your expectations. Fixed Form.

 

For this, the following script is being used:

 

var rows = this.resolveNodes("tblTestData.repeatingRow[*]");
var sm=0; 
var cm=0;
for(var i=0;i<rows.length;i++)
{ if(rows.item(i).airVoids1.rawValue)
{
sm+= Math.pow(rows.item(i).airVoids1.rawValue - form1.page1.tblTestData.row2.amountMeanX.rawValue,2);
cm=cm+1;
}
}
form1.page1.tblTestData.row2.amountDeviation.rawValue = Math.sqrt(sm/(cm-1));

 

Avatar

Level 5

Perfect!  Thank you so much!