Doing Tests of Proportions Quiz - task
Doing Tests of Proportions Quiz,
Qn1.
Download the file deviceprefs.csv from the course materials. This file describes a study in which people with and without disabilities indicated their preferences for touchpads or trackballs as computer input devices. You will use R to analyze this file to answer the questions in this quiz.. With this and every quiz in this course, you can find what you need by understanding and mimicking coursera.R, the R code file used in the lecture. This first question gives you credit for getting R, RStudio, and deviceprefs.csv ready to go. Are you ready to proceed?
Qn2. How many subjects’ preferences were recorded?
Note: For this and every other quiz in this course, when you miss a question, code will be revealed to help you. However, you cannot usually just copy the code verbatim. For example, the variable ‘df” is used throughout these code snippets to refer to the “data frame”, the term R uses for the variable that holds the .csv file that you read in. If you read in your .csv file into a variable with a name other than “df”, then you will need to use your variable name, not “df”. Similarly, the variable “m” is used in these code snippets to hold a fitted statistical model. If you use a variable name other than “m” for your model, you will need to change “m” to be your variable name.
Be sure that when you copy the code provided for missed questions, you understand that code by looking p the documentation for the R functions used. You can do that after loading a function’s library with the question mark operator. For example, if the function is “foo” then you would do:
?foo
As stated, this only works if the library defines “foo” is loaded. You load libraries into memory with the library command:
And this won’t work unless the “foolib” package is installed. You install packages using install.packages, which brings the package files into your computer and should only have to be done once:
Does the data table indicate a one-sample proportion or a two-sample proportion?
As described, the data table shows input device preferences of certain people with and without disability. How many subjects have a disability?
Ignoring for a moment disability status, perform a one-sample chi-square test to see whether the proportion of subjects who preferred the trackball (or touchpad) differed significantly from chance. To the nearest hundredth (two digits), what is the chi-square statistic? Hint: Note that this question is not asking for the p-value!
For people without disabilities, perform a binomial test to see whether their preference for touchpads differed significantly from chance. To the nearest ten-thousandth (four digits), what is the p-value? Hint: Run a binomial test comparing the sum of rows of people without disabilities who prefer the touchpad against the number of all rows of people without disabilities. With two possible preferences, touchpad and trackball, the chance probability would be 1/2/. Do not correct for multiple comparisons; consider this a single test on a subset of the data.
For people with disabilities, perform a binomial test to see whether their preference for touchpads differed significantly from chance. To the nearest ten-thousandth (four digits), what is the p-value? Hint: Run a binomial test comparing the sum of rows of people with disabilities. With two possible preferences, touchpad, and trackball, the chance probability would be 1/2. Do not correct for multiple comparisons; consider this a single test on a subset of the data.
Conduct a two-sample Chi-square test of proportions on preferences by disability status. To the nearest hundredth (two digits), what is the chi-square statistic?
Perform a two-sample G-test on preferences by disability status. To the nearest hundredth (to digits), what is the G statistic? Hint: Use the RVaideMemoire library and its G.test function.
Perform Fisher’s exact test on preferences by disability status. To the nearest ten-thousandth ( four digits), What is the p-value?