Computing all joint and marginal probabilities (in percent) in a fourfold table based on two randomly-generated conditional probabilities and one marginal probability. The exercise is a cloze with nine numeric answers presented in a table layout using "##ANSWERi##" tags.
Verbatim R input/output:
(Note that the HTML output contains mathematical equations in MathML, rendered by MathJax using ‘mathjax = TRUE’. Instead it is also possible to use ‘converter = “pandoc-mathjax”’ so that LaTeX equations are rendered by MathJax directly.)
library("exams") set.seed(403) exams2html("fourfold2.Rmd", mathjax = TRUE) set.seed(403) exams2pdf("fourfold2.Rmd") set.seed(403) exams2html("fourfold2.Rnw", mathjax = TRUE) set.seed(403) exams2pdf("fourfold2.Rnw")