Computing coefficients and a point prediction from a simple linear prediction (by hand). Internally, a full bivariate data set is simulated but only the marginal means and variances and the correlation coefficient are presented in the exercise.
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("regression.Rmd", mathjax = TRUE) set.seed(403) exams2pdf("regression.Rmd") set.seed(403) exams2html("regression.Rnw", mathjax = TRUE) set.seed(403) exams2pdf("regression.Rnw")