R
Assignment #21
General Purpose
General Purpose of these Assignments (the usual): The purpose of these R
Assignments is to give you some pointed, direct practice in using R
. As such, these are designed to be quick and to the point (less than 10 minutes each). They are also designed to give you a place to return if you forget how to perform some analysis in the future.
Please supply your results in the form below. Clicking on “Click to Check Your Answers” will allow you to see which as correct and which are not. When all are correct (and you can try as many time as you wish), you will be allowed to send your answers to me for credit by clicking on “Click to Email Your Results.” You only receive credit when this is submitted (with all answers correct).
This assignment is due at the start of the class period on
Monday, February 19, 2024.
With that being said, if this R Assignment is available, which is could be until approximately 11:59 pm (CST), then you are able to work on it.
As expected, these are graded according to the syllabus (all or nothing). Please review the appropriate section in the syllabus for more information. Also, if this is not submitted before it is due, then it counts as a zero.
Specific Purpose: Here, I check that you can calculate p-values for various hypothesis tests. Remember that these assignments are not here to test your understanding (usually). They are only here to check that you can perform the analysis.
Slidedeck Support: The following slidedecks may be helpful for you in completing this R
Assignment:
The Problems
Note that we are assuming this particular experiment is representative of the entire population (all people). Here, there are two populations: Those singing a song (song) and those not singing a song (control). The dependent variable is the distance in inches the ruler drops from release until the person stops it (distance).
First, run the following code. Then, answer the questions that follow. These lines of code load a particular data set and attaches it. In other words, they allow you easy access to a common data set.
source("http://rfs.kvasaheim.com/stat200.R")
dt = read.csv("http://rfs.kvasaheim.com/data/stat4013rxtimes.csv")
attach(dt)
Note that I only want you to use the t-procedure for these three.
The Answers
Since this is past due, I can now give you the code and the answer:
Since it is now after the time this is due, I can now give you the code and the answers:
t.test(distance, mu=6)
t.test(distance, mu=6, alternative='greater')
t.test(distance~treatment, alternative='greater')
The answers are
0.4438
0.7781
1
Wait! Why alternative="greater"
? Well, R
does things alphabetically. So, distance~treatment
will test mu(control) against mu(song). Since the original question was “Is mu(control) > mu(song)?”, we have to use alternative="greater"
.
This also emphasizes the need for you to look at your results and make sure they make sense, given what you know. Never forget to check your work!