$\$

# install.packages("latex2exp")

library(latex2exp)

knitr::opts_chunk$set(echo = TRUE)

set.seed(230)
# get some images that are used in this document
SDS230::download_image("gingko_pills.jpg")

SDS230::download_data("gingko_RCT.rda")

$\$

Overview

$\$

Part 1: Running a randomization test for a single proportion in R

$\$

Part 1.1: Is it possible to smell whether someone has Parkinson's disease?

Joy Milne claimed to have the ability to smell whether someone had Parkinson’s disease.

To test this claim, researchers gave Joy 6 shirts that had been worn by people who had Parkinson’s disease and 6 people who did not.

Joy identified 11 out of the 12 shirts correctly.

Let's run a hypothesis test to assess whether there is significant evidence to suggest that Joy can really could smell whether someone has Parkinson's disease.

$\$

Step 1: State the null and alternative hypotheses in symbols and words, and set up the rules of the game

In words:

Using symbols

Rules of the game

$\$

Step 2: Calculate the observed statistic

$\$

Step 3: Create the null distribution

$\$

Step 4: Calculate a p-value

$\$

Step 5: Make a decision

$\$

Questions

  1. Do you believe Joy can really smell Parkinson's disease?

  2. Is it better to report the actual p-value or just whether we rejected the null hypothesis $H_0$?

$\$

Part 2: Permutation tests for comparing two means in R

Let's us examine the randomized controlled trial experiment by Solomon et al (2002) to see if there is evidence that taking a gingko pills improves memory. To read the original paper see: https://jamanetwork.com/journals/jama/fullarticle/195207

Step 1: State the null and alternative hypotheses

$\$

Step 2a: Plot the data

load("gingko_RCT.rda")



# plot the data





# create a stripchart

$\$

Step 2b: Calculate the observed statistic


$\$

Step 3: Create the null distribution

# combine the data from the treatment and placebo groups together




# use a for loop to create shuffled treatment and placebo groups and shuffled statistics 


       # shuffle data


        # create fake treatment and control groups


        # save the statistic of interest






# plot the null distribution as a histogram

$\$

Step 4: Calculate a p-value

# plot the null distribution again with a red line a the value of the observed statistic









# calculate the p-value

$\$

Step 5: Make a decision

$\$



emeyers/SDS230 documentation built on Jan. 18, 2024, 1:01 a.m.