---
title: "Lab 00 - Computing Basics"
author: "[Your Name Here]"
date: "Due Sept 19, 2026, 11:59pm"
output:
  bookdown::pdf_document2:
    includes:
      in_header: preamble.tex
    number_sections: false
    toc: FALSE
---

# Lab overview

There are two goals in this lab. The first is to ensure everyone installs the computing environment and packages correctly. The second is to demonstrate the "correct" way to format a lab or assignment based on the provided template, through a short probability review exercise.


# Pre-lab work

(Students should begin by browsing these instructions in their web browser).
1. Check your [Canvas profile settings](https://community.canvaslms.com/t5/Student-Guide/How-do-I-add-contact-methods-to-receive-Canvas-notifications-as/ta-p/516) to ensure the email associated with your Canvas account is correct.
1. Review your [Canvas notification settings](https://community.canvaslms.com/t5/Student-Guide/How-do-I-set-my-Canvas-notification-preferences-as-a-student/ta-p/434) and decide what you want to be notified about.
1. Visit the [Course website](https://ubc-stat.github.io/stat-406/). In particular, as you might expect, this course requires computing. We will use R and RStudio and LaTeX. Follow the relevant link on the [Computing](https://ubc-stat.github.io/stat-406/computing/) tab to set up R, XQuartz, RStudio, LaTeX and obtain relevant R packages.


# Using Assignment Template

Beginning a new Lab or homework assignment always starts out like this.

1. Downoad the assignment template from Canvas. For this lab, it is `lab00.Rmd`.
1. Now open `lab00.Rmd`. You'll see all the instructions you've been looking at there in that document.
1. Try to click `Knit` or use `Cmd+Shift+K` (`Ctrl+Shift+K` on Windows/Linux) to render the lab to `.pdf`. You should always do this first to make sure everything works.
1. Make sure to change the name of the author to your name in the preamble of the .Rmd file.

### The `.solbox`

In other labs and homework, you'll see something that looks like

    ```
    ::: {.solbox data-latex=""}

    some dumb text

    :::
    ```

It's called `.solbox` because that's where your solutions will go. It makes it easier for the TAs to find your answers. So don't delete this. 


## Question 1
A joint distribution of (X, Y) is as follows:

$X \sim  \text{Normal}(\mu= 250, \sigma^2 = 100 )$

$Y | X = x \sim \text{Normal}(\mu = 2x, \sigma^2 = 4)$


a. Find the expected value of $Y$.
b. Plot a histogram using 100 realizations of $Y$.  Make sure your plot is an appropriate size (not too large/cut off, and not too small). Make sure to specify a random seed **using your student ID** before generating data.

::: {.solbox data-latex=""}
a.
b.
```{r , warning=FALSE}
# your code
```
:::


## Question 2
Next we want to make sure that you indeed installed the required course package by simply running the code shown in the following `.solbox`. If installation was successful you should have no error messages in your output.

::: {.solbox data-latex=""}
```{r}
library(Stat406)
library(ElemStatLearn)
"Stat406" %in% loadedNamespaces() #expects `TRUE` as output
"ElemStatLearn" %in% loadedNamespaces() #expects `TRUE` as output
```
:::

That's it! All done. Make sure to submit this `.Rmd` and the rendered `.pdf` on Canvas.


