Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

TTest_t with alternate state

Can someone assist me on how to group TTest_t function with alternate state?

if(ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1)),TTest_t({Cardiology}, (GENERAL_LOS)),TTest_t({Cardiology}, (GENERAL_LOS), 0))

4 Replies
whiteline
Master II
Master II

Hi.

The using of Alternate states in the expression imply correct set analysis syntax.

You don't need commas after the state name.

Refer to the QV help 'set analysis'.

Not applicable
Author

Hi whiteline,

I removed the comma but ended up in an error also. The above function forces me to specify a group as well as an expression. I don't know if qlikview can perform what is requested by my organization. Basically the requirement is the following:

We need to calculate the p-value for an attending length of stay versus his peers. For all the other requested indicators, i was able to generate data using set analysis and alternate state, however for p-value regardless what I try no data is being generated.

whiteline
Master II
Master II

TTest_t ([set_expression][ total [<fld {,fld}>] group, value [, eq_var = true])

returns the aggregated t value for two independent series of values iterated over the chart dimension(s). The values should be returned by value and be logically grouped via exactly two values in group. If eq_var is specified as false, separate variances of the two samples will be assumed, else equal variances between the samples will be assumed. Text values, null values and missing values in value will result in the function returning null.

So you need to set up two parameters correctly regardless of using set analysis.

Not applicable
Author

Hi Whiteline,

Sorry for the late reply.

My report currently works based on two alternate states:

  1. Group 1 that includes Doctor Specialty and Doctor Name
  2. Group 2 that includes  Doctor Specialty and Doctor Name

The user selects Doctor Specialty and one doctor from the first group, then from the second group selects the same Doctor Specialty and all the doctors in that specialty excluding the doctor chosen in group1.

As you mentioned above, in order for ttest to work, when the user chooses {Group1} Doctor name, the doctor has to be flagged as 1 and then when {Group2} Doctor names are clicked they all have to be flagged as 2. To do that, I created a variable called Doctor that on select takes the value of  {Group1} Doctor name and the formula became as below:

if(ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1)),TTest_sig(

if( [Doctor Name] =(Doctor) ,'1',COUNT(distinct {Group2} ATTENDING_NAME)), Length_Of_Stay),

TTest_sig(if( [Doctor Name] = (Doctor) ,'1',COUNT(distinct {Group2} ATTENDING_NAME)), Length_Of_Stay, 0))

However the above is not returning any values.

Kindly assist.