Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Standard Deviation (With Set Analysis)

Hi,

Please help!

I have the following data set:

I am looking calculate the standard deviation on just the cases where the flag is 1 through set analysis:

Any assistance would be appreciated,

Thanks

Case

DurationFlag
1151
2101
3121
420
530
690
7 Replies
Not applicable
Author

Hi Jeremy.

You may try this:

sqrt((pow(Duration-avg({<Flag={1}>}Duration),2))/(Count({<Flag={1}>}Duration)))

Hope it works

Regards

Eduardo.

Clever_Anjos
Employee
Employee

use stddev({<Flag={"1"}>}Duration)

Not applicable
Author

This works for me.  However, I have a similar case where flag is an expression, not a field.  It is a somewhat complicated expression, including user input from several input boxes (so I cannot add it to the LOAD statement).

In that case, stddev({$<Flag={"1"}>}Duration) does not work.  I guess this is because an expression can't be used in Set Analysis?  Any suggestions for this?

Clever_Anjos
Employee
Employee

Can you set your expression to a variable? If yes, you can use a variable into Set Analysis

stddev({$<Flag={"$(variable)"}>}Duration)

Not applicable
Author

I think perhaps I am not following.  In fact, my column "Flag" is an expression.  I need to find the stddev(Duration) of all rows where Flag = 1.

The problem is that Flag is an expression that uses user inputs (basically an adjustable filter), and set analysis does not seem to work that way.  Does that make sense?  Am I missing something?

Clever_Anjos
Employee
Employee

Sorry, I really misunderstand you.

Could you give us more detail? What kind of expression is Flag?

Not applicable
Author

Thanks for the suggestions!