1. A researcher conducts a study to evaluate whether the distribution of the length of time it takes migraine patients to respond to a 100 mg. dose of an intravenously administered drug is normal, with a mean response time of 90 seconds and a standard deviation of 35 seconds (i.e., μ = 90 and σ = 35). The amount of time (in seconds) that elapses between the administration of the drug and cessation of a headache for 30 migraine patients is recorded below. The 30 scores are arranged ordinally (i.e., from fastest response time to slowest response time).

SOLUTION:

Null Hypothesis : The data comes form the specified distribution.

Alternative Hypothesis: At least one value does not match the specifies distribution.


    Asymptotic one-sample Kolmogorov-Smirnov test

data:  Kolmogorov
D = 0.96532, p-value < 2.2e-16
alternative hypothesis: two-sided

Since the p-value 2.2e-16 is less than D = 0.96532, then we reject the null hypothesis and conclude that at least one value does not match the specifies distribution.

`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Do the data conform to a normal distribution with the specified parameters?

By the graph shown above, the data is not normality distributed.

2. A physician states that the median number of times he sees each of his patients during the year is five. In order to evaluate the validity of this statement, he randomly selects ten of his patients and determines the number of office visits each of them made during the past year.

SOLUTION:

Null Hypothesis : The median number of times a physician sees each of his patients during the year is five.

Alternative Hypothesis: The median number of times a physician sees each of his patients during the year is not equal to 5.

To perform Wilcoxon Signed-Rank Test we have the following assumptions:


    Asymptotic one-sample Kolmogorov-Smirnov test

data:  Wilcoxon
D = 0.87725, p-value = 8.56e-14
alternative hypothesis: two-sided

Since the p-value 8.56e-14 is less than D = 0.87725, then we reject the null hypothesis and conclude that at least one value does not match the specifies distribution.

This observation is shown in the graph below.

`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

By the above illustration and Kolmogorov-Smirnov test for normality, it shows that the data is skewed. Thus, we can perfom the Wilcoxon Signed-Rank Test.

Do the data support his contention that the median number of times he sees a patient is five?

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.00    5.00    8.50    7.60    9.75   15.00 

    Wilcoxon signed rank test with continuity correction

data:  Wilcoxon$Frequency
V = 44, p-value = 0.1016
alternative hypothesis: true location is not equal to 5
[1] 0.1015756

The p-value of the test is 0.1015756, which is greater than the significance level alpha = 0.05. We do not reject the null hypothesis and conclude that the median number of times a physician sees each of his patients during the year is five significantly the same from a median of five with a p-value = 0.1015756.

3. In order to assess the efficacy of a new antidepressant drug, ten clinically depressed patients are randomly assigned to one of two groups. Five patients are assigned to Group 1, which is administered the antidepressant drug for a period of six months. The other five patients are assigned to Group 2, which is administered a placebo during the same six-month period. Assume that prior to introducing the experimental treatments, the experimenter confirmed that the level of depression in the two groups was equal. After six months elapse all ten subjects are rated by a psychiatrist (who is blind with respect to a subject’s experimental condition) on their level of depression. The psychiatrist’s depression ratings for the five subjects in each group follow (the higher the rating, the more depressed a subject).

SOLUTION:

The following assumptions must be met in order to run a Mann-Whitney U test:

Normality Check:

[1] "The data is not normally distribued. Please check the result of Mann-Whitney U test."

Null Hypothesis : The level of depression of depressed patients which is administered by antidepressant drug is different from the placebo group.

Alternative Hypothesis: The level of depression of depressed patients which is administered by antidepressant drug is not different from the placebo group.


    Wilcoxon rank sum test with continuity correction

data:  Mann_Whitney$antidepressantdrug and Mann_Whitney$placebo
W = 4, p-value = 0.08969
alternative hypothesis: true location shift is not equal to 0

Since the p-value is 0.08969 which is greater than the significance level 0.05, we do not have sufficient evidence to say that the level of depression of depressed patients which is administered by antidepressant drug is different from the placebo group.

Do the data indicate that the antidepressant drug is effective?


    Wilcoxon rank sum test with continuity correction

data:  Mann_Whitney$antidepressantdrug and Mann_Whitney$placebo
W = 4, p-value = 0.04484
alternative hypothesis: true location shift is less than 0

Since the p value is 0.04484 which is less than the significance level 0.05,

We have sufficient evidence to say that the level of depression of depressed patients administered by antidepressant drug was less than that of the patients in the placebo group. Hence, antidepressant drug is effective.

4. A psychologist conducts a study to determine whether or not noise can inhibit learning. Each of six subjects is tested under three experimental conditions. In each of the experimental conditions a subject is given 20 minutes to memorize a list of 10 nonsense syllables, which the subject is told she will be tested on the following day. The three experimental connditions each subject serves under are as follows: Condition 1, the no noise condition, requires subjects to study the list of nonsense syllables in a quiet room. Condition 2, the moderate noise condition, requires subjects to study the list of nonsense syllables while listening to classical music. Condition 3, the extreme noise condition, requires subjects to study the list of nonsense syllables while listening to rock music. Although in each of the experimental conditions subjects are presented with a different list of nonsense syllables, the three lists are comparable with respect to those variables that are known to influence a person’s ability to learn nonsense syllables. To control for order effects, the order of presentation of the three experimental conditions is completely counterbalanced. The number of nonsense syllables correctly recalled by the six subjects under the three experimental conditions follows: (Subjects’ scores are listed in the order Condition 1, Condition 2, Condition 3.)

SOLUTION:


    Asymptotic one-sample Kolmogorov-Smirnov test

data:  Friedman
D = 0.93558, p-value < 2.2e-16
alternative hypothesis: two-sided

Since the p-value 2.2e-16 is less than D = 0.84134, then we reject the null hypothesis and conclude that at least one value does not match the specifies distribution.

Null Hypothesis: The mean response of nonsense syllables correctly recalled by the six subjects under the three experimental conditions is the same for the three condition.

Alternative Hypothesis: The mean response of nonsense syllables correctly recalled by the six subjects under the three experimental conditions is not the same for the three condition.

Summary

    Subject       Condition1      Condition2     Condition3   
 Min.   :1.00   Min.   : 7.00   Min.   :5.00   Min.   :2.000  
 1st Qu.:2.25   1st Qu.: 7.25   1st Qu.:5.25   1st Qu.:3.250  
 Median :3.50   Median : 8.50   Median :6.50   Median :5.000  
 Mean   :3.50   Mean   : 8.50   Mean   :6.50   Mean   :4.833  
 3rd Qu.:4.75   3rd Qu.: 9.75   3rd Qu.:7.75   3rd Qu.:6.750  
 Max.   :6.00   Max.   :10.00   Max.   :8.00   Max.   :7.000  

There was a statistically significant difference in inhibiting learning depending on which type of noise was upon the memorizing of nonsense syllable of the subject , χ2 = 11.56522, p = 0.003080668

A large effect size is detected, W = 0.9637681.

Condition1 and Condition2 are statistically significant with p-value 0.020.

Condition1 and Condition3 are statistically significant with p-value 0.035.

Condition2 and Condition3 are not statistically significant with p-value 0.057.

Do the data indicate that noise influenced subjects’ performance?

By the result presented above, the answer is affirmative.

5. A psychologist conducts a study to determine whether or not noise can inhibit learning. Each of 15 subjects is randomly assigned to one of three groups. Each subject is given 20 minutes to memorize a list of 10 nonsense syllables which she is told she will be tested on the following day. The five subjects assigned to Group 1, the no noise condition, study the list of nonsense syllables while they are in a quiet room. The five subjects assigned to Group 2, the moderate noise condition, study the list of nonsense syllables while listening to classical music. The five subjects assigned to Group 3, the extreme noise condition, study the list of nonsense syllables while listening to rock music. The number of nonsense syllables correctly recalled by the 15 subjects follows: Group 1: 8, 10, 9, 10, 9; Group 2: 7, 8, 5, 8, 5; Group 3: 4, 8, 7, 5, 7.

Do the data indicate that noise influenced subjects’ performance?

    Subject    Condition1     Condition2    Condition3 
 Min.   :1   Min.   : 8.0   Min.   :5.0   Min.   :4.0  
 1st Qu.:2   1st Qu.: 9.0   1st Qu.:5.0   1st Qu.:5.0  
 Median :3   Median : 9.0   Median :7.0   Median :7.0  
 Mean   :3   Mean   : 9.2   Mean   :6.6   Mean   :6.2  
 3rd Qu.:4   3rd Qu.:10.0   3rd Qu.:8.0   3rd Qu.:7.0  
 Max.   :5   Max.   :10.0   Max.   :8.0   Max.   :8.0  

Summary statistics

Compute summary statistics by groups:

Visualization

ggboxplot(F, x = "Condition", y = "score")

Computation

res.kruskal <- F %>% kruskal_test(score ~ Condition)
paged_table(res.kruskal)

Effect size

c<-F %>% kruskal_effsize(score ~ Condition)
paged_table(c)

A large effect size is detected, eta2[H] = 0.562284

Pairwise comparisons

pwc <- F %>% 
  dunn_test(score ~ Condition, p.adjust.method = "bonferroni") 
paged_table(pwc)

Only Condition1 and Condition3 are statistically significant with p-value 0.01863958.

Pairwise comparisons using Wilcoxon’s test:

pwc2 <- F %>% 
  wilcox_test(score ~ Condition, p.adjust.method = "bonferroni")
paged_table(pwc2)

The pairwise comparison shows that, Condition1 and Condition3 are significantly different (Wilcoxon’s test, p = 0.045).

Interpretation

There was a statistically significant differences between inhibiting learning depending on the noise present during the memorizing as assessed using the Kruskal-Wallis test (p = 0.013). Pairwise Wilcoxon test between groups showed that only the difference between Condition1 and Condition3 group was significant (Wilcoxon’s test, p = 0.045)

Visualization: box plots with p-values

pwc <- pwc %>% add_xy_position(x = "Condition")
ggboxplot(F, x = "Condition", y = "score") +
  stat_pvalue_manual(pwc, hide.ns = TRUE) +
  labs(
    subtitle = get_test_label(res.kruskal, detailed = TRUE),
    caption = get_pwc_label(pwc)
    )