Standard deviation

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
Jojo
Posts: 5
Joined: Monday 12 August, 2013 - 13:06

Standard deviation

Post by Jojo »

Hi,

I have measured the runtime of each product on one server. I have added the runtimes to calculate the average runtime of all products on this server.

Code: Select all

RuntimeSumM1 := RuntimeSumM1 + i.runtimeM1
RuntimeAvgM1 := RuntimeSumM1/Prodcount
Now I want to calculate the standard deviation. I think, i can use the 4DScript-Expression "StDev(e1,e2)" to calculate this. But in this case I don't know which variables, expressions or values I should use for e1 and e2.

Hop you guys can help me. Thanks.
Kind regards
menno
Posts: 45
Joined: Tuesday 29 March, 2011 - 16:01

Re: Standard deviation

Post by menno »

Hello Jojo,

The standard deviation depends on the different values of runtimeM1. If you want to use the ED function StDev(e1,e2), every time you get a new runtimeM1, you need all previous values of runtimeM1 to recalculate StDev. This is needed because the average keeps changing, and therefore the deviations of each measured runtimeM1 to this average will be different.

In the help section, the parameters e1 and e2 are explained. E1 is the number of times you want to execute expression e2.

If you really want to know the standard deviation after each product is passing the server, you therefore need to collect each individual value of runtimeM1. In a table for instance. Then you can loop over the table with the StDev(e1,e2) function like this:

Code: Select all

StDev(nrows(refStDevTable, cell(count, 1, refStDevTable, 1))
I hope this will help!

Kind regards,
Menno
Post Reply