Course Outline

Course Overview

Modules

Assignments

Resources

Policies

Insurmountable Coding Problems


Boots for Days!



Must be submitted for Peer Commentary by 8:00 pm Tuesday, November 9th.


Peer Commentary and Final Homework DUE at 5:00 pm Wednesday, November 22nd.



Create a new GitHub repo and git-referenced Rstudio Project called “AN588_Boots_BUlogin”. Within that repo, create a new .Rmd file called “BUlogin_OriginalHomeworkCode_04”. Don’t forget to add your Peer Group and instructor as collaborators, and to accept their invitations to you. Making sure to push both the markdown and knitted .html files to your repository, do the following:

You are welcome to work with your Peer Group together on this homework assignment or on your own. If you work with someone else, please include all of your names in the header information for your .Rmd file.

Bootstrapping Standard Errors and CIs for Linear Models.

When we initially discussed the central limit theorem and confidence intervals, we showed how we could use bootstrapping to estimate standard errors and confidence intervals around certain parameter values, like the mean. Using bootstrapping, we could also do the same for estimating standard errors and CIs around regression parameters, such as \(\beta\) coefficients.

[1] Using the “KamilarAndCooperData.csv” dataset, run a linear regression looking at log(HomeRange_km2) in relation to log(Body_mass_female_mean) and report your \(\beta\) coeffiecients (slope and intercept).

[2] Then, use bootstrapping to sample from your data 1000 times with replacement, each time fitting the same model and calculating the same coefficients. This generates a sampling distribution for each \(\beta\) coefficient.

EXTRA CREDIT

Write a FUNCTION that takes as its arguments a dataframe, “d”, a linear model, “m” (as a character string, e.g., “logHR~logBM”), a user-defined confidence interval level, “conf.level” (with default = 0.95), and a number of bootstrap replicates, “n” (with default = 1000). Your function should return a dataframe that includes: beta coefficient names; beta coefficients, standard errors, and upper and lower CI limits for the linear model based on your entire dataset; and mean beta coefficient estimates, SEs, and CI limits for those coefficients based on your bootstrap.

EXTRA EXTRA CREDIT

Graph each beta value from the linear model and its corresponding mean value, lower CI and upper CI from a bootstrap as a function of number of bootstraps from 10 to 200 by 10s. HINT: the beta value from the linear model will be the same for all bootstraps and the mean beta value may not differ that much!


Your Final Assignment for Homework 03

Your final assignment, due to me by 5:00 pm on November 22nd, is to have in your AN588_Zombies_BUlogin repo only the following files (aside from repo basics like an .Rproj and README file):
    1. The FINAL PUSH of your Original Homework Code, including the five challenges you faced, as pushed to your repo by 5:00 pm on Wednesday November 22nd, an R Markdown file named BUlogin_OriginalHomeworkCode_05.
    2. The FINAL PUSH of the Peer Commentary made on your code, an R Markdown file named Peerlogin_PeerCommentary_BUlogin_05 or PeerGroupX_PeerCommentary_BUlogin_05.
    3. The FINAL PUSH of your Final Homework Code, which has taken into account any changes recommended from the Peer Commentary and notes, an R Markdown file named BUlogin_FinalHomeworkCode_05.

Homework 05 Solutions will be posted on November 5th.


NOTE: If you want your homework code to look nice (beyond being very well annotated and commented), and be easy to use by others, you can check out the relatively simply example R Markdown templates in the AN588_Week_3_caschmit repo.

Please also consider consulting the following helpful guidelines on how to write effective R Markdown documents (also available at the end of Module 03), which go well beyond the simple formatting of the templates.