Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products.
All content is subject to change and is provided without warranty.
Skip to main content Skip to complementary content

Creating a typical t-test report

A typical student t-test report can include tables with Group Statistics and Independent Samples Test results.

In the following sections we will build these tables using Qlik Senset-test functions applied to two independent groups of samples, Observation and Comparison. The corresponding tables for these samples would look like this:

Group statistics
Type N Mean Standard Deviation Standard Error Mean
Comparison 20 11.95 14.61245 3.2674431
Observation 20 27.15 12.507997 2.7968933
Independent sample test
Type conf t df Sig. (2-tailed) Mean Difference Standard Error Difference 95% Confidence Interval (Lower) 95% Confidence Interval (Upper)
Equal Variance not Assumed 0 3.534 37.116717335823 0.001 15.2 4.30101 6.48625 23.9137
Equal Variance Assumed 8.706939 3.534 38 0.001 15.2 4.30101 6.49306 23.9069

Loading the sample data

Do the following:

  1. Create a new app with a new sheet.
  2. Enter the following in the data load editor:

    Table1:
    Crosstable (Type, Value)
    Load recno() as ID, * inline [
    Observation|Comparison
    35|2
    40|27
    12|38
    15|31
    21|1
    14|19
    46|1
    10|34
    28|3
    48|1
    16|2
    30|3
    32|2
    48|1
    31|2
    22|1
    12|3
    39|29
    19|37
    25|2 ] (delimiter is '|');

    In this load script, recno() is included because crosstable requires three arguments. So, recno() simply provides an extra argument, in this case an ID for each row. Without it, Comparison sample values would not be loaded.

  3. Click run script to load data.

Creating the Group statistics table

Do the following:

  1. In the data load editor, click compass to go to app view, and then click the sheet you created before.

    This opens the sheet view.

  2. Click Edit sheet to edit the sheet.
  3. From Charts, add a table, and from Fields, add Type as a dimension to the table.

  4. Add the following expressions as measures.

    Example expressions
    Label Expression
    N Count(Value)
    Mean Avg(Value)
    Standard Deviation Stdev(Value)
    Standard Error Mean Sterr(Value)
  5. Click Sorting and make sure Type is at the top of the sorting list.

Result:

A Group statistics table for these samples would look like this:

Group statistics
TypeNMeanStandard DeviationStandard Error Mean
Comparison2011.9514.612453.2674431
Observation2027.1512.5079972.7968933

Creating the Independent sample test table

Do the following:

  1. Click Edit sheet to edit the sheet.
  2. From Charts add a table with the following expression as a dimension to the table. =ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1)) and give it the label Type.

  3. Add the following expressions as measures:

    Example expressions
    Label Expression
    conf if(ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1)),TTest_conf(Type, Value),TTest_conf(Type, Value, 0))
    t if(ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1)),TTest_t(Type, Value),TTest_t(Type, Value, 0))
    df if(ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1)),TTest_df(Type, Value),TTest_df(Type, Value, 0))
    Sig. (2-tailed) if(ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1)),TTest_sig(Type, Value),TTest_sig(Type, Value, 0))
    Mean Difference TTest_dif(Type, Value)
    Standard Error Difference if(ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1)),TTest_sterr(Type, Value),TTest_sterr(Type, Value, 0))
    95% Confidence Interval (Lower) if(ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1)),TTest_lower(Type, Value,(1-(95)/100)/2),TTest_lower(Type, Value,(1-(95)/100)/2, 0))
    95% Confidence Interval (Upper) if(ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1)),TTest_upper(Type, Value,(1-(95)/100)/2),TTest_upper(Type, Value,(1-(95)/100)/2, 0))

    Result:

    Independent sample test
    Type conf t df Sig. (2-tailed) Mean Difference Standard Error Difference 95% Confidence Interval (Lower) 95% Confidence Interval (Upper)
    Equal Variance not Assumed 0 3.534 37.116717335823 0.001 15.2 4.30101 6.48625 23.9137
    Equal Variance Assumed 8.706939 3.534 38 0.001 15.2 4.30101 6.49306 23.9069

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!