library(gradethis)
library(learnr)
library(qsslearnr)
tutorial_options(exercise.checker = gradethis::grade_learnr)
knitr::opts_chunk$set(echo = FALSE)
tut_reptitle <- "QSS Tutorial 10: Output Report"

Hypothesis Tests

Null hypotheses

question(
  paste0("Suppose you wish to test whether education has an effect on wages.",
         " What could be the null hypothesis?"),
  answer("Education has no effect on wages", correct = TRUE),
  answer("Education has an effect on wages"),
  answer(" Wages has no effect on education"),
  answer("Wages has an effect on education")
)

Type I and Type II errors

question(
  paste0("When hiring, large companies get tons of overqualified applicants, ",
         "so they are fine with rejecting qualified applicants, though they do",
         " want to make sure selected applicants are actually qualified. ",
         "Given the null hypothesis that applicants are not qualified, ",
         "do large companies care more about Type I or Type II errors?"),
  answer("Type I", correct = TRUE),
  answer("Type II")
)

One-sided vs two-sided tests

question(
  paste0(
    "You wish to conduct a study to test whether students at your university",
    "sleep more hours than the national average. What t-test should you use?"
  ),
  answer("two-sample, one-sided"),
  answer("two-sample, two-sided"),
  answer("one-sample, one-sided", correct = TRUE),
  answer("one-sample, two-sided")
)

Power

You have a coin which you suspect is unfair and instead shows heads with probability 0.7. So, you decide to test this by flipping it exactly once: if heads comes up, you say it is unfair, otherwise, you say it is fair. What is the power of this test (express to the nearest 0.1)? Hint: think of the coin being fair as the null and the coin being unfair as the alternative.

question_text(
  "Answer:",
  answer("0.7", correct = TRUE),
  answer(".7", correct = TRUE),
  allow_retry = TRUE
)

Coin flips, redux

Flipping a coin once is not super informative, you think to yourself, and so decide to flip the coin two more times. If any heads appear, you say the coin is unfair, otherwise, you say it is fair. With these three flips in total, what is the power of the test now (express to the nearest 0.001)? Hint: what's the probability of drawing no heads under the alternative?

question_text(
  "Answer:",
  answer("0.973", correct = TRUE),
  answer(".973", correct = TRUE),
  allow_retry = TRUE
)

Power and errors in testing

question(
  "What does the quantity (1- power) represent?",
  answer("The probability of true positive."),
  answer("The probability of true negative."),
  answer("The probability of false positive."),
  answer("The probability of false negative.", correct = TRUE)
)

Running lots of tests

question(
  paste0(
    "You repeatedly run statistical tests until you get significance. ",
    "This fallacy is known as:"
  ),
  answer("multiple testing", correct = TRUE),
  answer("repeated error detection"),
  answer("likelihood fallacy"),
  answer("multiple hypothesis detection")
)

Calculating Type I error

question(
  paste0(
    "You think a die is unfair, so you roll twice. ",
    "If you get 2 sixes in a row, you deem it unfair. ",
    "What is the probability of a Type I error in this test?"
  ),
  answer("1/2"),
  answer("1/6"),
  answer("1/12"),
  answer("1/36", correct = TRUE)
)

Types of tests

question(
  paste0(
    "You wish to test whether political sentiment of the average Texan is ",
    "significantly different from that of the average New Yorker. ",
    "What test would be appropriate?"
  ),
  answer("one-sample t-test"),
  answer("two-sample z-test"),
  answer("two-sample t-test", correct = TRUE),
  answer("one-sample z-test")
)

z-tests vs t-tests

question(
  "How does a t-test primary differ from a z-test?",
  answer("You do not know the population mean"),
  answer("You do not know the population standard deviation",
         correct = TRUE),
  answer("You do not know the confidence level"),
  answer("You do not know if the data is normally distributed")
)

Submit

submission_ui
submission_server()


mattblackwell/qsslearnr documentation built on Sept. 17, 2022, 6:25 p.m.