The data for the 50 patients is stored in file “
magnets.csv”. The file can be found on the internet at pluto.huji.ac.il/~msby/StatThink/Datasets/magnets.csv. Download this file to your computer and store it in the working directory of R. Read the content of the file into an R data frame. Produce a summary of the content of the data frame and answer the following questions:
-
What is the sample average of the change in score between the patient’s rating before the application of the device and the rating after the application?
-
Is the variable “
active” a factor or a numeric variable? -
Compute the average value of the variable “
change” for the patients that received and active magnet and average value for those that received an inactive placebo. (Hint: Notice that the first 29 patients received an active magnet and the last 21 patients received an inactive placebo. The sub-sequence of the first 29 values of the given variables can be obtained via the expression “change[1:29]” and the last 21 vales are obtained via the expression “change[30:50]”.) -
Compute the sample standard deviation of the variable “
change” for the patients that received and active magnet and the sample standard deviation for those that received an inactive placebo. -
Produce a boxplot of the variable “
change” for the patients that received and active magnet and for patients that received an inactive placebo. What is the number of outliers in each subsequence?
