You are on page 1of 5

*All used commands I wrote in attached do-file.

1. a) One-Sample Test for the Mean (σ Unknown).

I took variable SAT to run One-Sample t-test. Firstly, we should check is data normally distributed.
Normality of data is needed to Sample mean be more close to Population mean, so the results of our
analysis will be more reliable. I checked normality by the histogram in Stata 14. As it is seen in the
Figure 1 below, data of students’ SAT scores is not normally distributed, it has outliers and it is right
skewed. In order to make it normally distributed, we need to get rid of outliers. We can trim data where
SAT scores are more than 1380. Figure 2 shows the histogram of SAT after we deleted outliers and it is
normally distributed now.

Figure 1. Histogram of SAT Figure 2. Histogram of SAT after trimming the data

.003
.003

Now we can conduct One Sample t-


test. My Null hypothesis(H0)

.002
.002

for this test is that average


Density
Density

SAT score of students is


1000. My Alternative
.001
.001

0
0

400 600 800 1000 1200 1400 400 600 800 1000 1200 1400
SAT SAT
Hypotghesis(H1) here is that average of SAT is not equal to 1000. The results of the test provided in the
Table 1 below. According to this table, P value=0.000, which is less than 0.05, or in other words
possibility of H0 is true is close to 0. Therefore, our H0, stating that the average of SAT score, is 1000 is
rejected(there is a significant difference between 1000 and actual average of SAT). So, our H1, which
states that mean is not equal to 1000 is not rejected.

The other way to decide reject or not reject the H0 is using critical value approach. By using excel I found
that critical value for this example with the degree of freedom 727, is 1.96. As I understood, it means
that if absolute value of t is more than 1.96 then we can reject our H0. According to the Table 1, |t|=|-
17|=17, which is >1.96, so our H0 is rejected.

Table 1. One Sample t-test.


One-sample t test

Variable Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]

SAT 728 896.0714 6.086503 164.2228 884.1222 908.0206

mean = mean(SAT) t = -17.0753


Ho: mean = 1000 degrees of freedom = 727

Ha: mean < 1000 Ha: mean != 1000 Ha: mean > 1000
Pr(T < t) = 0.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 1.0000

b) For conducting Two Sample t-test I chose course GPA and gender identity of students. Again, before
test we check the normality of course GPA. I checked, it is not normally distributed, so I deleted course
GPA scores which are more than 3.4. In these test we are testing is there any significant difference
between (means) course GPA of female and male.

H0: There is no significant difference between course GPA means of female and male students

H1: There is a significant difference between course GPA means of female and male students

The results from the test are given in the Table 2. According to this table t-test show that P
value=0.0912, which is >0.05, so our H0 is not rejected. It means that there is actually no statistically
significant difference between course GPA means of female and male students

Absolute value of t is 1.69, critical value for df=718 is 1.96. Because 1.69<1.96 we are failed to reject H0.

Table 2. Two Sample t-test

Group Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]

0 547 2.76298 .0086575 .2024809 2.745974 2.779986


1 173 2.793327 .0163938 .2156266 2.760968 2.825686

combined 720 2.770271 .0076761 .2059725 2.755201 2.785342

diff -.0303469 .0179431 -.0655741 .0048803

diff = mean(0) - mean(1) t = -1.6913


Ho: diff = 0 degrees of freedom = 718

Ha: diff < 0 Ha: diff != 0 Ha: diff > 0


Pr(T < t) = 0.0456 Pr(|T| > |t|) = 0.0912 Pr(T > t) = 0.9544
c) For the Paired t-test I took course GPA and term GPA. In these test we are testing is there any
significant difference between (means) of course GPA and term GPA of students.

H0: There is no significant difference between means of course GPA and term GPA

H0: There is a significant difference between means of course GPA and term GPA

(I did the same operations as before to make data normally distributed.) According to the conducted
ttest, p value is 0.000, which is <0.05 and it means our H0 is rejected and H1 stating that there is
statistically significant difference between means of course GPA and term GPA is true. Table with results
of this test is provided in Table 3.

Absolute value of t is 16.46, critical value for df=705 is 1.96. Because 16.46>1.96 we reject H0.

Table 3. Paired t-test.


Paired t test

Variable Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]

CrsGPA 706 2.772951 .0077329 .2054692 2.757768 2.788133


TrmGPA 706 2.350411 .0260093 .6910853 2.299346 2.401476

diff 706 .4225399 .0256622 .6818626 .3721564 .4729235

mean(diff) = mean(CrsGPA - TrmGPA) t = 16.4654


Ho: mean(diff) = 0 degrees of freedom = 705

Ha: mean(diff) < 0 Ha: mean(diff) != 0 Ha: mean(diff) > 0


Pr(T < t) = 1.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 0.0000

It should be noted that in a and b, the size of variables is different (for example in *a* part there are 548
males and 180 females). So, our results can be not reliable.

2. a) One sample z-test

For this test I used variable SAT.

My Null hypothesis(H0) is that average SAT score of students is 900

My Alternative Hypotghesis(H1) here is that average of SAT is not equal to 900.

Firstly, I found standard deviation of SAT and then conducted ztest. Results shown in Table 4 below. It
shows that P value here =0.9099,which is >0.05, or in other words possibility of H0 is true is 90%.
Therefore, our H0, stating that the average of SAT score, is 900 is not rejected(there is no statistically
significant difference between 900 and actual average of SAT, which is 899).

If we use critical values, then z=-0.1131 and by using table for the 5% confidence level z value is 0.44.
Because confidence level is 0.05, z value should be between -1.96 and 1.96 in order to not reject H0. So,
0.44 is in this range, that is why we are failed to reject H0.

Table 4.One sample z-test


One-sample z test

Variable Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]

SAT 706 899.3059 6.135504 163.0244 887.2806 911.3313

mean = mean(SAT) z = -0.1131


Ho: mean = 900

Ha: mean < 900 Ha: mean != 900 Ha: mean > 900
Pr(Z < z) = 0.4550 Pr(|Z| > |z|) = 0.9099 Pr(Z > z) = 0.5450

b) For the two-sample z-test I used course GPA and term GPA. In these ztest we are testing is there any
significant difference between (means) course GPA of female and male.

H0: There is no significant difference between course GPA means of female and male students

H1: There is a significant difference between course GPA means of female and male students

Again, firstly, I found sd for these two variables and run the test. According to the results shown in Table
5, P value=0.1463, which is >0.05, so our H0 is not rejected. It means that there is actually no statistically
significant difference between course GPA means of female and male students.

According to critical values table when z score is -1.4 z value=

Table 5. Two-sample z-test.


Two-sample z test

Group Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]

0 533 2.766337 .0087422 .2018297 2.749203 2.783472


1 173 2.793327 .0163938 .2156266 2.761195 2.825458

diff -.0269894 .0185791 -.0634038 .0094249

diff = mean(0) - mean(1) z = -1.4527


Ho: diff = 0

Ha: diff < 0 Ha: diff != 0 Ha: diff > 0


Pr(Z < z) = 0.0732 Pr(|Z| > |z|) = 0.1463 Pr(Z > z) = 0.9268

c) Used variables: term GPA, course GPA. In this paired z-test test we are testing is there any significant
difference between (means) of course GPA and term GPA of students.

H0: There is no significant difference between means of course GPA and term GPA

H0: There is a significant difference between means of course GPA and term GPA

According to the results of z-test(Table 6), probability value is close to 0, which means that H0 is not
true, so we reject H0 and say that there is actually a significant difference between means of course GPA
and term GPA.

Table 6. Paired z-test.


Variable Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]

diff 706 .4225399 .0182764 .4856161 .3867189 .458361

mean(diff) = mean(CrsGPA - TrmGPA) z = 23.1194


Ho: mean(diff) = 0

Ha: mean(diff) < 0 Ha: mean(diff) != 0 Ha: mean(diff) > 0


Pr(Z < z) = 1.0000 Pr(|Z| > |z|) = 0.0000 Pr(Z > z) = 0.0000

3) For this I used the same data which I used in 2. c) part above. In order to calculate confidence interval
we used formula mean+ - (z(a/2)*sd/√n (All calculations are provided in do-file). The results show that
with the 95% confidence level mean will be between .38671815 and .45836165

4) For this I used the same data which I used in 2. b) part above. Stata shows statistic power of 0.4032.
In order to be sure that we do not make Type Error I, II, Static power should be more than 80%. In this
example we got 40.32% of Statistic power as shown in Table 7, which means that we can make mistakes
and our results can be not reliable.

Table 7. Statistic power


Estimated power for a two-sample means test
Satterthwaite's t test assuming unequal variances
Ho: m2 = m1 versus Ha: m2 != m1

Study parameters:

alpha = 0.0500
N = 706
N per group = 353
delta = 0.0270
m1 = 2.7663
m2 = 2.7933
sd1 = 0.2018
sd2 = 0.2156

Estimated power:

power = 0.4032

You might also like