Due before class on December 4th.
hw07
repositoryGo here to fork the repo for homework 07.
Complete each of the following exercises. Some exercises require an analytical answer, others require you to write code to complete the exercise. When writing your answer to analytical exercises, be sure to use appropriate \(\LaTeX\) mathematical notation.
\[\newcommand{\E}{\mathrm{E}} \newcommand{\Var}{\mathrm{Var}} \newcommand{\Cov}{\mathrm{Cov}} \newcommand{\se}{\text{se}} \newcommand{\Lagr}{\mathcal{L}} \newcommand{\lagr}{\mathcal{l}}\]
Simulate the dataset for the regression model
\[ \begin{align} X_i &\sim \text{Uniform}(0,1) \\ \epsilon_i &\sim N(0, 1) \\ Y_i | X_i &\sim N(\mu_i, 1) \end{align} \]
where \(\mu_i = \beta_0 + \beta_1 X_i\), \(\beta_0 = 2\), and \(\beta_1 = 3\).
Estimate \(\hat{\beta}_0\) and \(\hat{\beta}_1\) using the three functions you created above, in addition to using thelm()
function. Compare your results across all four methods. Do they converge towards the same basic estimates \(\hat{\beta}_0\) and \(\hat{\beta}_1\)?Simulate the dataset for the regression model
\[ \begin{align} X_{1i} &\sim \text{Uniform}(0,1) \\ X_{2i} &\sim \text{Poisson}(4) \\ \epsilon_i &\sim N(0, 1) \\ Y_i | X_{1i}, X_{2i} &\sim N(\mu_i, 1) \end{align} \]
where \(\mu_i = \beta_0 + \beta_1 X_{1i} + \beta_2 X_{2i}\), \(\beta_0 = 2\), \(\beta_1 = 3\), and \(\beta_2 = 8.5\).
Estimate \(\boldsymbol{\hat{\beta}}\) using the three functions you created above, in addition to using the lm()
function. Compare your results across all four methods. Do they converge towards the same basic estimates \(\hat{\beta}_0\) and \(\hat{\beta}_1\)?
Your assignment should be submitted as an R Markdown document rendered as an HTML/PDF document. Don’t know what an R Markdown document is? Read this! Or this! I have included starter files for you to modify to complete the assignment, so you are not beginning completely from scratch.
Follow instructions on homework workflow. As part of the pull request, you’re encouraged to reflect on what was hard/easy, problems you solved, helpful tutorials you read, etc.
This work is licensed under the CC BY-NC 4.0 Creative Commons License.