# A tibble: 32 × 1
   preference
   <chr>     
 1 cat       
 2 dog       
 3 dog       
 4 dog       
 5 dog       
 6 cat       
 7 dog       
 8 dog       
 9 cat       
10 dog       
# ℹ 22 more rowsLecture 6
BIOB11 - Experimental design and analysis for biologists
Department of Biology, Lund University
2025-04-02
Calculate the test statistic:
Generate a null distibution:
Visualise the null:
Calculate the p-value:
\[ \chi^2 = \sum \frac{(Observed_i - Expected_i)^2}{Expected_i} \]
# A tibble: 120 × 2
   treatment germination_success
   <chr>     <chr>              
 1 coating_a germinated         
 2 coating_a germinated         
 3 coating_a germinated         
 4 coating_a failed_to_germinate
 5 coating_a germinated         
 6 coating_a germinated         
 7 coating_a germinated         
 8 coating_a germinated         
 9 coating_a germinated         
10 coating_a germinated         
# ℹ 110 more rowsobserved_statistic <- 
  germ_data |>
  specify(response = germination_success, explanatory = treatment) |>
  hypothesize(null = "independence") |>
  calculate(stat = "Chisq")
observed_statisticResponse: germination_success (factor)
Explanatory: treatment (factor)
Null Hypothesis: independence
# A tibble: 1 × 1
   stat
  <dbl>
1  2.43# A tibble: 1 × 1
  p_value
    <dbl>
1   0.906