# Exercises - Nonparametric Models

1. It is a common belief that more fatal car crashes occur on certain days of the week, such as Friday or Saturday. A sample of motor vehicle deaths is randomly selected for a recent year. The number of fatalities for the different days of the week are listed below. At the $0.05$ significance level, test the claim that accidents occur with equal frequency on the different days. State the null hypothesis, test statistic, critical value, your conclusion and interpretation. $$\begin{array}{l|c|c|c|c|c|c|c|} \textrm{Day} & \textrm{Sun} & \textrm{Mon} & \textrm{Tue} & \textrm{Wed} & \textrm{Thu} & \textrm{Fri} & \textrm{Sat}\\\hline \textrm{Number of Fatalities} & 31 & 20 & 20 & 22 & 22 & 29 & 26\\\hline \end{array}$$

$H_0 : p_{sun} = p_{mon} = p_{tue} = p_{wed} = p_{thu} = p_{fri} = p_{sat}$, test statistic is $4.8352$, critical value is $12.592$, fail to reject the null. There is no significant difference among the frequencies of accidents by day of the week.

2. In a study of drug abuse in a local high school, the school board selected 100 eighth graders, 100 sophomores and 100 seniors randomly from their respective rolls for each grade. Each student was then asked if they used a particular drug frequently, seldom or never. The data are summarized in the table given below. Is there evidence to suggest that the frequency of drug use is the same across the three different grades? State the null hypothesis, give the test statistic, test criterion, conclusion, and interpretation.

Frequency of Drug Use

$$\begin{array}{l|c|c|c|} \textrm{Grade} & \textrm{Frequently} & \textrm{Seldom} & \textrm{Never}\\\hline \textrm{8th Grade} & 15 & 30 & 55\\\hline \textrm{Sophomore} & 20 & 35 & 45\\\hline \textrm{Senior} & 25 & 35 & 40\\\hline \end{array}$$
$H_0 :$ The frequency of drug use is the same across grade levels. Critical value is $9.488$ for $4$ degrees freedom at $\alpha = 0.05$. Test statistic is $5.5$, cannot reject null. The frequency of drug use is not significantly different across the three grades.
3. In an experiment on extrasensory perception, subjects were asked to identify the month showing on a calendar in the next room. If the results were as shown, test the claim that months were selected with equal frequencies. Assume a significance level of $0.05$, If it appears that the months were not selected with equal frequencies, is the claim that the subjects have extrasensory perception supported? $$\begin{array}{|c|c|c|c|c|c|c|c|c|c|c|c|} \textrm{Jan} & \textrm{Feb} & \textrm{Mar} & \textrm{Apr} & \textrm{May} & \textrm{Jun} & \textrm{Jul} & \textrm{Aug} & \textrm{Sep} & \textrm{Oct} & \textrm{Nov} & \textrm{Dec}\\\hline 23 & 21 & 35 & 31 & 22 & 41 & 12 & 14 & 10 & 26 & 30 & 24\\\hline \end{array}$$

$H_0 : p_{jan} = p_{feb} = p_{mar} = \cdots = p_{dec}$. Test statistic of $39.71$. Critical value is $19.675$. Reject the null. Months were not selected with equal frequencies. It his highly unlikely to get the above distribution by chance. To truly evaluate this crazy experiment, the month showing on the calendar in the next room would need to be known. Was the month changed or the same for each subject questioned?

4. An American karate studio plans to advertise but is unsure as to which of three ads to use. The ads are tested on randomly selected consumers and the reactions measured on an ordinal scale that produces the following data: $$\begin{array}{l|l} \textrm{Red} & 80, 80, 78, 81, 72, 85, 96, 84, 71, 75, 98\\\hline \textrm{White} & 75, 55, 98, 92, 86, 78, 87, 79, 88, 87, 85, 94, 99\\\hline \textrm{Blue} & 72, 76, 70, 77, 68, 82, 85, 81, 65, 69\\ \end{array}$$ Test the claim that reactions are the same for the three different ads. Perform the Kruskal Wallis Test. If appropriate, follow with Wilcoxon tests and interpret your results.

$H_0 :$ All three ads are liked equally by consumers. Test statistic is $H = 8.188$, critical value is $7.378$ for $2$ degrees of freedom at $\alpha = 0.025$. Ads are not equally liked by consumers. The Wilcoxon tests produced the following test statistics: $z = -1.79$ for comparison between blue and red; $z = -1.30$ for comparison between red and white; $z = 2.69$ for comparison between blue and white. There is no difference between blue and red or between red and white. There is a significant difference between blue and white, with a $p$-value of $0.0072$ or critical value of $2.33$ for $\alpha = 001$. White probably should be given the contract.

5. You suspect that a die is unfair. Your roll it 60 times and get the following results: $$\begin{array}{l|c|c|c|c|c|c|} \textrm{Number on die} & 1 & 2 & 3 & 4 & 5 & 6\\\hline \textrm{Observed frequency} & 10 & 12 & 14 & 8 & 12 & 4\\\hline \end{array}$$ Determine if the above distribution is significantly different from the expected distribution assuming that the die is fair.

$H_0 :$ Each number on the die is equally likely to appear. Test statistic is $6.4$, critical value is $11.071$ for degrees of freedom of $5$ at $\alpha = 0.05$. Fail to reject. The die is not significantly different from results that would be obtained from a fair die.

6. A test for independence of judgement was administered to three different groups of students. The higher the score, the more independent the person is in judgment (the person is not easily influenced by another person's opinions). Group A includes premedical students ($n=11$), Group B includes English majors ($n=10$), and Group C includes psychology majors ($n=11$). $$\begin{array}{l|l} \textrm{A} & 69, 78, 90, 92, 68, 77, 85, 96, 87, 71, 93\\\hline \textrm{B} & 44, 36, 41, 90, 51, 42, 38, 52, 87, 46\\\hline \textrm{C} & 36, 97, 84, 72, 75, 64, 62, 79, 63, 66, 58 \end{array}$$ The scores represent ordinal data. Are there any significant differences among the groups? Specifically: (a) Perform a Kruskal Wallis test. (b) If the Kruskal Wallis test is significant, follow with the appropriate Wilcoxon tests. (remember to re-rank your groups). (c) Interpret the results from (a) and (b). Are there any significant differences among the groups? Which group is more independent, if any?

(a) $H_0$ : There is no difference in independence of judgement across student types. $H = 10.486$, reject the null hypothesis at $\alpha = 0.005$ since the chi square value for $2$ degrees freedom is $7.879$ for $\alpha = 0.005$. There is at least one significant difference. (FYI: using low value to high value for ranking: $R_A = 256, R_B = 96.5, R_C = 175.5$).

(b) The null hypothesis is that ther is no difference between groups A and B (or A and C, or B and C, respectively). Between groups A and B, $z = -2.89$ with $p$-value of $0.0038$, reject the null. A is more independent than B. Between groups A and C, $z = -2.20$ with a $p$-value of $0.0278$, reject the null. A is more independent than C. Between groups B and C, $z = 1.94$ with a $p$-value of $0.0524$, fail to reject the null. There is no significant difference between B and C.

(c) A is significantly more independent than B or C. There is no significant difference between B and C. The premedical students seem to be more independent than English or Psychology majors.

7. Students at Oxford were asked to indicate their agreement with the following statement: "I find mathematics challenging but I am able to make a good grade." Is there a difference in the distributions of responses between males and females? Students responded as follows: $$\begin{array}{l|c|c|c|c|} & \textrm{agree} & \textrm{no opinion} & \textrm{disagree} & \textrm{total}\\\hline \textrm{males} & 75 & 10 & 85 & 170\\\hline \textrm{females} & 121 & 8 & 51 & 180\\\hline \end{array}$$ Give the null hypothesis, test statistic, critical value at an appropriate alpha level, conclusion, and interpretation.

Null hypothesis: There is no difference in response distributions between males and females. Or opinions are independent of sex. Test statistic, chi square with $2$ degrees of freedom, is $19.245$. Critical value is $10.597$ for $\alpha = 0.005$. Reject the null hypothesis. There is a significant difference between males and females in their responses. Females tend to agree more than do males with the statement, "I find mathematics challenging but I am able to make a good grade.", while males tend to disagree more than fmales with the statement. (One can interpret responses by checking the chi square value for each cell.)

8. To test whether children who cry more actively as babies later tend to have higher IQs, a cry count was taken for a sample of 22 children aged five days and was later compared with their Stanford-Binet IQ scores at age three. Use these cry counts and IQ scores and Spearman's $r$ model to determin if there is a relationship.

The relationship is not significant, $r = 0.0960$, $p \gt 0.05$. There does not seem to be a relationship between the crying rate and IQ. Note that both sets of data are somewhat questionable and that other factors are present.

9. Students were asked to respond to the following statement: "Participating in study groups is an effective way to study for some courses." Is there a significant difference in the responses of freshmen and sophomores? Show appropriate hypothesis testing responses. $$\begin{array}{l|c|c|c|} & \textrm{agree} & \textrm{no opinion} & \textrm{disagree}\\\hline \textrm{Freshmen} & 34 & 21 & 35\\\hline \textrm{Sophomore} & 54 & 12 & 29\\\hline \end{array}$$

Null hypothesis: There is no difference between responses given by freshmen and sophomores. Test statistic: $7.4327$. Critical value of chi square with $2$ degrees of freedom for $\alpha = 0.05$ is $5.991$. Reject the null. The opinions of freshmen and sophomores are significantly different. Freshmen seem to agree less and have no opinion more than the sophomores.

10. A pair of dice was rolled 500 times. The sums that occurred were as recorded in the following table. Test whether the dice seem fair based on this data. For example, $P(2,3,\textrm{ or } 4) = 1/6$ and the sums $2$, $3$, and $4$ occurred at total of $74$ times. Since the dice were rolled $500$ times, one would expect $83.3$ ($500 \times 1/6 \approx 83.3$) occurrences of rolling a $2$, $3$, or $4$, so $83.3$ is the expected value. $$\begin{array}{l|c|c|c|c|c|} \textrm{Sum} & \{2,3,4\} & \{5,6\} & \{7\} & \{8,9\} & \{10,11,12\}\\\hline \textrm{Frequency (Observed)} & 74 & 120 & 83 & 135 & 88\\\hline \end{array}$$ Now rework this problem using the actual observed values for each sum: $$\begin{array}{l|c|c|c|c|c|c|c|c|c|c|c|} \textrm{Sum} & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12\\\hline \textrm{Observed} & 12 & 26 & 36 & 58 & 62 & 83 & 102 & 33 & 20 & 9 & 59\\\hline \end{array}$$ Did you find that testing the die this way was significant? Which way would be the best for determining if a die were fair?

Null hypothesis: $p_{2,3,4} = p_7 = p_{10,11,12} = 1/6$ and $p_{5,6} = p_{8,9} = 1/4$. Chi square test statistic is $2.305$ with critical value at $).05$, $4$ degrees of freedom, of $9.488$. Fail to reject the null hypothesis. The dice seem fair. Probably a better way would be to record the occurrences of each sum and check. WHen this is done, there is a significant differnce and the dice are shown to be unfair.

11. A movie producer wishes to test the audience response to three different possible endings for a movie. Three audiences were randomly selected and each was shown the movie with one of the possible endings. Each audience member was asked to rate the movie on a scale of 1 to 100 (with 100 representing the best rating). Assume this is ordinal data. Using the information provided, test whether there is a significant difference in the audience response to the endings. If there is a difference, determine where that difference lies. Show your hypothesis testing steps clearly. $$\begin{array}{|c|c|c|} \textrm{Ending A} & \textrm{Ending B} & \textrm{Ending C}\\\hline 35 & 42 & 12\\\hline 40 & 50 & 20\\\hline 54 & 52 & 28\\\hline 60 & 55 & 35\\\hline 64 & 57 & 40\\\hline 67 & 60 & 45\\\hline 70 & 60 & 50\\\hline 72 & 62 & 51\\\hline 75 & 65 & 53\\\hline 78 & 70 & 64\\\hline 80 & 73 & 70\\\hline 84 & 77 & 75\\\hline \end{array}$$

Kruskal Wallis test produces $H=7.786$ with critical value of $5.991$ ($\alpha = 0.05$ and $2$ degrees of freedom). Reject the null hypothesis, the populations have the same distributions. Therefore, there is a significant difference in the audience response to the endings. Three Wilcoxon Rank-Sum tests give the following test statistics (remember to re-rank for each Wilcoxon Test): 1.18 (between A and B), 2.45 (between A and C), and 2.08 (between B and C). Critical value is $\pm1.96$ for $\alpha = 0.05$. There is a significant difference between A and C, and a significant difference between B and C. Based on the study, it seems that the producer should not choose ending C.