Generic intro

  • You will need the following skills from previous practicals:
    • Basic R skills with arithmetic, functions, etc
    • Manipulating and creating vectors: c, seq,
    • Calculating data summaries: mean, sd, var, min, max
    • Plotting a scatterplot with plot, and a histogram with hist
  • New R techniques:
    • Random number generation with rnorm, runif, etc
    • Evaluation of standard density functions via dnorm, dunif, etc
    • Creating a matrix with matrix
    • Applying a function to every row/column of a matrix with apply
    • Drawing a curve on an existing plot using lines

1 Heading

Add content !

First, let’s recap (or introduce) a little theory. If you haven’t seen this yet in lectures, you will soon (Lecture 4). Consider a sample of \(n\) Normally-distributed data points: \(X_1,\dots,X_n\) i.i.d random variables from \(N(\mu,\sigma^2)\). We can say:

  • The sample mean \(\bar{X}\) has distribution:

\[ \bar{X} = \frac{1}{n} \sum_{i=1}^n X_i \sim N \left( \mu,\frac{\sigma^2}{n} \right).\]

  • The sample variance \(S^2\) is independent of \(\bar{X}\), and is such that

\[ \frac{(n-1)}{\sigma^2} S^2 \sim \chi^2_{n-1}.\]

Add techniques!

Add exercises!