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 QlikViewt-test functions applied to two independent groups of samples, Observation and Comparison. The corresponding tables for these samples would look like this:

Group Statistics

Group Statistics example table output
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

Independent Sample Test example table output
- t df Sig. (2-tailed) Mean Difference Standard Error Difference 95% Confidence Interval of the Difference (Lower) 95% Confidence Interval of the Difference (Upper)
Equal Variance not Assumed 3.534 37.116717335823 0.001 15.2 4.30101 6.48625 23.9137
Equal Variance Assumed 3.534 38 0.001 15.2 4.30101 6.49306 23.9069

Loading the sample data

Do the following:

  1. Create a new document.
  2. Select Edit Script in the toolbar and enter the following to the script:

    Table1:

    crosstable 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. Save the script and click Reload to load the data.

Creating the Group Statistics table

Do the following:

  1. Add a straight table on the sheet and select Type as a dimension.

  2. Add the following expressions:

    Expressions to add
    Label Expression
    N Count(Value)
    Mean Avg(Value)
    Standard Deviation Stdev(Value)
    Standard Error Mean Sterr(Value)
  3. Make sure that Type is at the top of the sorting list.

Result:

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

Group Statistics example table output
Type N Mean Standard Deviation Standard Error Mean
Comparison 20 11.95 14.61245 3.2674431
Observation 20 27.15 12.507997 2.7968933

Creating the Two Independent Sample Student's T-test table

Do the following:

  1. Add a table on the sheet.
  2. Add the following calculated dimension as a dimension to the table. =ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1))

  3. Add the following expressions:

    Expressions to add
    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 of the Difference (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 of the Difference (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:

An Independent Sample Test table for these samples would look like this:

Independent Sample Test example table output
- t df Sig. (2-tailed) Mean Difference Standard Error Difference 95% Confidence Interval of the Difference (Lower) 95% Confidence Interval of the Difference (Upper)
Equal Variance not Assumed 3.534 37.116717335823 0.001 15.2 4.30101 6.48625 23.9137
Equal Variance Assumed 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!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com