Question: Results of TwoSampleTTest

Hi,

I did some hypothesis testing exercises and I cross checked the result with Maple. I just used following vectors for an unpaired test

a := [88, 89, 92, 90, 90];
b := [92, 90, 91, 89, 91];

I ended up with the following solution:

HFloat(1.5225682336585966)
HFloat(-3.122568233658591)
for a 0.95 confidence interval.

 

Using

TwoSampleTTest(a, b, 0, confidence = .95, summarize = embed)

and

TwoSampleTTest(a, b, 0, confidence = .975, summarize = embed)

I get following results:

-2.75177 .. 1.15177

-3.13633 .. 1.53633

respectively. I can not explain the discrepancy.

 

Best regards,

Oliver

 

PS:

Maple Code in case files won´t be attached.

 

 

Unpaired t Test
restart;
Unpaired test-test dataset
a := [88, 89, 92, 90, 90];
b := [92, 90, 91, 89, 91];
The se² estimate is given by:
se²=var(a)+var(b)+2*cov(a*b)=var(a)+var(b)
se²=
sigma[a]^2/Na+sigma[b]^2/Nb;
with Na, Nb being the length of vector a and b respectively.
                             2                              2
  sigma[[88, 89, 92, 90, 90]]    sigma[[92, 90, 91, 89, 91]]
  ---------------------------- + ----------------------------
               Na                             Nb             
sigma[a]^2;
 and
sigma[b]^2;
 are approximated by
S[a]^2;
 and
S[b]^2;
                                             2
                  sigma[[88, 89, 92, 90, 90]]
                                             2
                  sigma[[92, 90, 91, 89, 91]]
                                           2
                    S[[88, 89, 92, 90, 90]]
                                           2
                    S[[92, 90, 91, 89, 91]]
with
S[X]^2;
 defined as
S[X]*`²` = (sum(X[i]-(sum(X[j], j = 1 .. N))/N, i = 1 .. N))^2/N;
                                 2
                             S[X]
                                                 2
                      /      /         N       \\
                      |      |       -----     ||
                      |  N   |        \        ||
                      |----- |         )       ||
                      | \    |        /    X[j]||
                      |  )   |       -----     ||
                      | /    |       j = 1     ||
                      |----- |X[i] - ----------||
                      \i = 1 \           N     //
             S[X] ᅡᄇ = ----------------------------
                                   N              
with(Statistics);
Sa := Variance(a);
                   HFloat(2.1999999999999993)
Sb := Variance(b);
                   HFloat(1.3000000000000003)
Now we are ready to do hypothesis testing (0.95).
We have (with k=min(Na,Nb)=5):
C = mean(a)-mean(b); Deviation := t_(alpha/a, k-1)*se(Sa/k-Sb/k);
c := Mean(a)-Mean(b); deviation := 2.776*sqrt((1/5)*Variance(a)+(1/5)*Variance(b));
                  HFloat(-0.7999999999999972)
                   HFloat(2.3225682336585938)
upperlimit := c+deviation; lowerlimit := c-deviation;
                   HFloat(1.5225682336585966)
                   HFloat(-3.122568233658591)

Execution of built in student test
TwoSampleTTest(a, b, 0, confidence = .95, summarize = embed);

 

 

Please Wait...