-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
title: "EEEB UN3005/GR5005 \nHomework - Week 06 - Due 10 Mar 2020" | ||
author: "USE YOUR NAME HERE" | ||
output: pdf_document | ||
fontsize: 12pt | ||
--- | ||
|
||
```{r setup, include = FALSE} | ||
knitr::opts_chunk$set(echo = TRUE) | ||
library(rethinking) | ||
``` | ||
|
||
|
||
**Homework Instructions:** Complete this assignment by writing code in the code chunks provided. If required, provide written explanations **below** the relevant code chunks. Replace "USE THE NUMERIC PORTION OF YOUR UNI HERE" in the document header with the numbers appearing in your UNI. When complete, knit this document within RStudio to generate a PDF file. Please review the resulting PDF to ensure that all content relevant for grading (i.e., code, code output, and written explanations) appears in the document. Rename your PDF document according to the following format: hw_week_06_UNInumbers.pdf. Upload this final homework document to CourseWorks by 5 pm on the due date. | ||
|
||
|
||
## Problem 1 (4 points) | ||
|
||
In lab this week you used the `simulated_trees.csv` dataset to specify a linear regression model with tree age (years) as the outcome variable and tree height (centimeters) as the predictor variable. Using the same dataset, do the following: | ||
|
||
- create a centered tree height variable | ||
|
||
- plot tree age (y-axis) vs. the centered tree height variable (x-axis) | ||
|
||
- fit a linear regression model for tree age using centered tree height as a predictor variable | ||
|
||
Assume a prior of `dnorm(0, 50)` for both the intercept and slope parameters and a prior of `dcauchy(0, 5)` for the standard deviation parameter. Also note, you'll need to use start values as follows to ensure a good model fit: intercept parameter = 50, slope parameter = 0, standard deviation parameter = 50. | ||
|
||
Summarize your fit model parameters using 99% PIs. How do the parameter posteriors in this model compare to the linear regression you fit during lab? What is the interpretation of the intercept parameter in this model? | ||
|
||
```{r} | ||
``` | ||
|
||
|
||
## Problem 2 (3 points) | ||
|
||
Now: | ||
|
||
- create a standardized tree height variable | ||
|
||
- plot tree age (y-axis) vs. the standardized tree height variable (x-axis) | ||
|
||
- fit a linear regression model for tree age using standardized tree height as a predictor variable (use the same priors and start values as in Problem 1) | ||
|
||
Summarize your fit model parameters using 99% PIs. How do the parameter posteriors in this model compare to the linear regression fit with the centered tree height variable? What is the interpretation of the slope parameter in this model? | ||
|
||
```{r} | ||
``` | ||
|
||
|
||
## Problem 3 (3 points) | ||
|
||
Using the model you fit in Problem 2, generate 10,000 tree age predictions for a tree of average height (i.e., the average in the `simulated_trees` dataset). Report the mean and 50% HPDI of these predictions. Visualize the predictions using a density plot. | ||
|
||
```{r} | ||
``` |