Appex 05

STA 112 - Fall 2022

Part 1

data
\(x_1\) 3
\(x_2\) 5
\(x_3\) 1
\(x_4\) 7
\(x_5\) 8

  1. Using the data to the left, what is \(n\)?
  2. What is \(\bar{x}\)?

Part 2

Open your 04-appex.qmd file in RStudio Pro. Load the packages by running the top R chunk of code.

  1. Copy the code below into an R chunk at the bottom of the file:
d <- tibble(
  x = c(3, 5, 1, 7, 8)
)

What do you think this code does? Try typing ?tibble in the Console - what does this function do?

  1. Calculate the mean of x. Do this two ways, using the summary function and using the lm function.
  2. Add a new variable called error to the data set d that is equal to x minus the mean of x.