library(learnr) library(tidyverse) library(tutorialExtras) library(gradethis) gradethis_setup() knitr::opts_chunk$set(echo = FALSE)
grade_server("grade")
# student name question_text("Name:", answer_fn(function(value){ if(length(value) >= 1 ) { return(mark_as(TRUE)) } return(mark_as(FALSE) ) }), correct = "submitted", allow_retry = FALSE )
grade_button_ui(id = "grade")
Complete this tutorial while reading Chapter 12 of the textbook. Each question allows 3 'free' attempts. After the third attempt a 10% deduction occurs per attempt.
You can click the "View Grade" button as many times as you would like to see your current grade and the number of attempts you are on. Before submitting make sure your grade is as expected.
quiz( caption = NULL, # Question 1 question_wordbank("Q1) Match each scenario and decision with whether it corresponds to a Type I or II error.", choices = c("The null hypothesis is true but you reject it", "The defendant is guilty but not convicted", "You decide to go to the party but it is not fun", "You decide to stay home but you miss out on a fun party", "The pregnancy test comes back positive but you are not pregnant", "The defendant is innocent but convicted", "The null hypothesis is false but you do not reject it", "The pregnancy test comes back negative but you are pregnant"), arrange = "ordered", box = 8, answer(c("Type I error (false positive)", "Type II error (false negative)", "Type I error (false positive)", "Type II error (false negative)", "Type I error (false positive)", "Type I error (false positive)", "Type II error (false negative)", "Type II error (false negative)"), correct = TRUE), allow_retry = TRUE), # Q2 question_wordbank("Q2) Match each statistical concept with how it is represented in mathematical symbols.", choices = c("\\(1 - \\beta\\)", "\\(p-value > \\alpha\\)", "\\(p-value < \\alpha\\)", "\\(\\alpha\\)", "\\(\\beta\\)"), wordbank = c("Power", "Do not reject the null hypothesis", "Reject the null hypothesis", "Type I error", "Type II error"), answer(c("Power", "Do not reject the null hypothesis", "Reject the null hypothesis", "Type I error", "Type II error"), correct = TRUE), allow_retry = TRUE), # Question 12 question_wordbank("Q3) Match each statistical concept with its appropriate definition.", choices = c("The probability of NOT rejecting the null hypothesis when it is FALSE", "The probability of rejecting the null hypothesis when it is FALSE", "The probability of rejecting the null hypothesis when it is TRUE"), wordbank = c("Type I error", "Type II error", "Power"), answer(c("Type II error", "Power", "Type I error"), correct = TRUE), allow_retry = TRUE), # Q4 question("Q4) Which of the following are TRUE about hypothesis tests? Select all that apply.", answer("The hypotheses must be in terms of sample statistics"), answer("When $p < \\alpha$ you reject the null hypothesis", correct = TRUE), answer("The hypotheses must be in terms of population parameters", correct = TRUE), answer("When $p > \\alpha$ you accept the null hypothesis"), answer("You must pre-specify your $\\alpha$ threshold", correct = TRUE), allow_retry = TRUE, random_answer_order = TRUE), # Q5 question("Q5) Assume for the context of your research question, you decide you are comfortable with a 10% Type I error rate. Which of the following test-statistic values, if observed and calculated from your data, would lead you to reject the null hypothesis? Assume you are conducting a two-sided hypothesis test for a proportion, so you can compare your test statistic to the N(0,1) distribution. Hint: You can use properties you know about the N(0,1) distribution or you can use the function pnorm() to actually compute the two-sided p-values in R. ", answer("t-stat = -2.575", correct = TRUE), answer("t-stat = -1.7", correct = TRUE), answer("t-stat = -1"), answer("t-stat = 0.002"), answer("t-stat = 0.5"), answer("t-stat = 1.96", correct = TRUE), answer("t-stat = 3.2", correct = TRUE), allow_retry = TRUE, random_answer_order = TRUE), question_wordbank("Q6) Imagine that you wish to compare the proportion of NU students ( $\\pi_s$ ) vs. faculty ( $\\pi_f$ ) that support universal healthcare. Reorder each step in the right column to be in the appropriate order for conducting a hypothesis test to test whether there is a difference in support rates.", choices = c("Determine the Type I error rate you are comfortable with", "Conclude that there is a difference among students vs. faculty in support of universal healthcare if \\(p<\\alpha\\)", "Determine the sampling distribution of \\( \\frac{ (\\hat{\\pi_s}- \\hat{\\pi_f}) - (\\pi_s - \\pi_f) }{ \\sqrt{ \\frac{\\hat{\\pi_0}(1-\\hat{\\pi_0})}{n_s} +\\frac{\\hat{\\pi_0}(1-\\hat{\\pi_0})}{n_f} } } \\)", "Specify \\(H_0:\\pi_s = \\pi_f\\) vs \\(H_A: \\pi_s \\ne`1 \\pi_f \\)", "Compute your p-value", "Compute the value of \\( \\frac{ \\hat{\\pi_s}- \\hat{\\pi_f}}{ \\sqrt{ \\frac{\\hat{\\pi_0}(1-\\hat{\\pi_0})}{n_s} +\\frac{\\hat{\\pi_0}(1-\\hat{\\pi_0})}{n_f} } } \\) observed in your data"), arrange = "ordered", box = 8, answer(c("Step 2", "Step 6", "Step 3", "Step 1", "Step 5", "Step 4"), correct = TRUE), allow_retry = TRUE) )
Once you are finished:
grade_print_ui("grade")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.