This is the actual example in the text:
Example 1. The GPA (grade point average) of students on Table 1 below is a random sample of 15 GPAs, collected at random from the GPA of all students in my classes. Suppose that the population median of GPA is 2.75. Test the hypothesis using the sign test when the significance level is 0.05.
Table 1. The GPA of 15 students
Student 1 2 3 4 5 6 7 8 9 10 11 12 13
GPA 2.50 3.14 3.45 3.08 2.50 2.85 2.32 3.75 2.31 3.25 3.20 3.40 2.60
Student 14 15
GPA 3.45 2.75
Solution:
The hypothesis is
H_0: M = 2.75 versus H_a:M ≠2.75
Reject H_0 if p-value ≤ 0.05 = α.
Test Statistic:
Here, the original sample is 15, and there are 5 observations below the hypothesized median, 2.75; 9 observations are greater than the hypothesized median, and one is equal to the median. We discard the one observation equals to the median. Now n=14, S = 5 which is the smaller of 5 and 9.
Thus the p-value = 2* P(X≤5) = 2 * 0.2120 = 0.4240. Since the P-value is greater than α=.05, then we do not reject the null hypothesis. The population median of GPA for all of my classes is 2.75 at significance level 0.05.
Computer Analysis:
SAS procedure.
In this section, I will explain how to find the answer to Example 1, using the popular software SAS and SPSS. I will start with SAS and then do the same problem using SPSS.
Example2.1.1: SAS code
data student;
input gpa @@;
cards;
2.50 3.14 3.45 3.08 2.50 2.85 2.32 3.75
2.31 3.25 3.20 3.40 2.60 3.45 2.75
;
proc univariate data=student
mu0=2.75
cipctldf /*option to request distr. free conf limit for percentiles*/
alpha=0.05;
var gpa;
run;
Example 2.1.1: SAS output The SAS System
The UNIVARIATE Procedure
Variable: gpa
Moments
N 15 Sum Weights 15
Mean 2.97 Sum Observations 44.55
Std Deviation 0.45716518 Variance 0.209
Skewness -0.0148278 Kurtosis -1.2344393
Uncorrected SS 135.2395 Corrected SS 2.926
Coeff Variation 15.3927669 Std Error Mean 0.11803954
Basic Statistical Measures
Location Variability
Mean 2.970000 Std Deviation 0.45717
Median 3.080000 Variance 0.20900
Mode 2.500000 Range 1.44000
Interquartile Range 0.90000
Note: The mode displayed is the smallest of 2 modes with a count of 2.
Tests for Location: Mu0=2.75
Test Statistic p Value
Student's t t 1.863782 Pr > |t| 0.0835
Sign M 2 Pr >= |M| 0.4240
Signed Rank S 28.5 Pr >= |S| 0.0758
Quantiles (Definition 5)
Quantile Estimate Order Statistics
95% Confidence Limits
Distribution Free LCL Rank UCL Rank Coverage
100% Max 3.75
99% 3.75 . . . . .
95% 3.75 3.45 3.75 13 15 50.05
90% 3.45 3.40 3.75 12 15 73.86
75% Q3 3.40 3.08 3.75 8 15 96.93
50% Median 3.08 2.50 3.40 4 12 96.48
25% Q1 2.50 2.31 3.08 1 8 96.93
10% 2.32 2.31 2.50 1 4 73.86
5% 2.31 2.31 2.50 1 3 50.05
1% 2.31 . . . . .
0% Min 2.31
The two-sided p-value for the test that the Median is equal to 2.75 is .424. The last three columns under the quantiles of the SAS output indicates that 2.50 and 3.40 is the 4th and 12th largest values in the sample.
SPSS procedure.
Example 1. First enter SPSS, and click Variable View tab, then type gpa, under name. Click Data View tab and enter your data. Click Transform, Compute Variable. Type diff in Target Variable and type gpa-2.75 in Numeric Expression. Then create another variable and call it stat, where the values in the stat variable are minus sign to be 0 and plus sign to be 1. You will see the following:
Now click Analyze, Nonparametric Tests, Legacy Dialogs, then click Binomial, move variable stat to Test Variable List and click OK. The output follow.
Binomial Test
Category N Observed Prop. Test Prop. Exact Sig. (2-tailed)
stat Group 1 0 5 .36 .50 .424
Group 2 1 9 .64
Total 14 1.00
As you can see, the output of the p-value is 0.424. Both SPSS and SAS agree with the output of the p-value.