Lab 02

Linear regression

January 24, 2025

Welcome

Goals

  • LaTex in this course
  • Lab 02: Linear regression

LaTex in this class

For this class you will need to be able to…

  • Properly write mathematical symbols, e.g., \(\beta_1\) not B1, \(R^2\) not R2

  • Write basic regression equations, e.g., \(\hat{y} = \beta_0 + \beta_1x_1 + \beta_2x_2\)

  • Write matrix equations: \(\mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\epsilon}\)

  • Write hypotheses (we’ll start this next week), e.g., \(H_0: \beta = 0\)

You are welcome to but not required to write math proofs using LaTex.

Writing LaTex

Inline: Your mathematics will display within the line of text.

  • Use $ to start and end your LaTex syntax. You can also use the menu: Insert -> LaTex Math -> Inline Math.

  • Example: The text The linear regression model is $\mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\epsilon}$ produces

    The linear regression model is \(\mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\epsilon}\)

Writing LaTex

Display: Your mathematics will display outside the line of text

  • Use a $$ to start and end your LaTex syntax. You can also use the menu: Insert -> LaTex Math -> Display Math.

  • Example: The text The estimated regression equation is $$\hat{\mathbf{y}} = \mathbf{X}\hat{\boldsymbol{\beta}}$$ produces

    The estimated regression equation is

\[ \hat{\mathbf{y}} = \mathbf{X}\hat{\boldsymbol{\beta}} \]

Tip

Click here for a quick reference of LaTex code.

Describing bivariate relationships

Describe the relationship between the price and width of Ikea sofas, armchairs, and bookcases/shelving.

Lab 02: Linear regression

Today’s lab focuses on using simple and multiple linear regression to understand variability in coffee quality ratings.


🔗 sta221-sp25.netlify.app/labs/lab-02.html