# Skapa en typisk t-test-rapport

En typisk t-test-rapport kan innehålla tabeller med Group Statistics och Independent Samples Test-resultat. I följande avsnitt kommer vi att bygga upp de här tabellerna med hjälp av QlikViewt-test-funktioner som tillämpas på två fristående grupper av stickprov, Observation och Comparison. Motsvarande tabeller för dessa stickprov skulle se ut så här:

Group Statistics

Utdatatabell för exempel med 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

Utdatatabell för exempel med Independent Sample

| - | 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 |

## Ladda exempeldata

Gör följande:

1. Skapa ett nytt dokument.

2. Välj Redigera skript i verktygsfältet och lägg till följande i skriptet:

   `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 '|');`

   I detta laddningsskript är recno() inkluderat eftersom crosstable kräver tre argument. Det innebär att recno() helt enkelt ger ett extra argument, i det här fallet ett ID för varje rad. Utan det skulle Comparison-stickprovsvärdena inte läsas in.

3. Spara skriptet och klicka på Ladda data för att ladda data.

## Skapa tabellen Group Statistics

Gör följande:

1. Lägg till en rak tabell på arket och välj Type som dimension.

2. Lägg till följande uttryck:

   Uttryck att lägga till

   | Etikett | Uttryck |
   | --- | --- |
   | N | Count(Value) |
   | Mean | Avg(Value) |
   | Standard Deviation | Stdev(Value) |
   | Standard Error Mean | Sterr(Value) |

3. Se till att Type är längst upp på sorteringslistan.

**Resultat:**

En Group Statistics-tabell för dessa stickprov skulle se ut så här:

Utdatatabell för exempel med 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 |

## Skapa tabellen Two Independent Sample Student's T-test

Gör följande:

1. Lägg till en tabell på arket.

2. Lägg till följande beräknade dimension som en dimension i tabellen. `=ValueList (Dual('Equal Variance not Assumed', 0), Dual('Equal Variance Assumed', 1))`

3. Lägg till följande uttryck:

   Uttryck att lägga till

   | Etikett | Uttryck |
   | --- | --- |
   | 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)) |

**Resultat:**

Tabellen Independent Sample Test för dessa stickprov skulle se ut så här:

Utdatatabell för exempel med Independent Sample Test

| - | 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 |