Course Materials Stat 370 Spring 2017

From Sean_Carver
Revision as of 18:10, 28 February 2017 by Carver (talk | contribs) (Day 11: Friday, February 24, 2017)
Jump to: navigation, search

Day 1: Tuesday, January 17, 2017

We had introductions and we went over the syllabus. We talked about our goals and dreams and reasons for taking this course. We also talked about our experience with R and with programming in general.

Remember No class next Friday (Inauguration Day).

Day 2: Tuesday, January 24, 2017

We talked about getting and installing R and RStudio. We discussed some of the panels within RStudio including the editor and the console. I showed you dynamic documents with R-Markdown. We wrote an R Script, and a dynamic document. We talked about Markov chains. I presented several project ideas concerning Markov chains, including applications to baseball, and neuroscience.

Day 3: Friday, January 27, 2017

I started by discussing a default project idea (click here). You are not required to follow this suggestion. Some students are already doing something else, and that is fine. Synergies with other projects, outside of this class, are encouraged.

After I discussed this project idea, we talked about calling and writing functions, and passing arguments to functions. We discussed required/positional arguments and optional/named arguments. The function getwd() was an example of one with no arguments. We talked about getting help...from Google and from the console with the ? and ?? commands. E.g. type "?getwd" for help on getwd() or "??topic" if you don't know the exact function name. We talked about operators such as + - * / and ^. We talked about variables, though we have more to discuss here. We talked about sampling from the vector c("HomeRun", "Single", "Double", "Triple", "Out").

Day 4: Tuesday, January 31, 2017

We did an introduction to Git and GitBash today. In GitBash we learned the commands "pwd", "ls", and "cd", plus three commands specific to git, "git init", "git add [file]", and "git commit -am "[message]". The brackets [...] and what is inside is replaced by what is indicated.

We did an lecture on Markov Chains. We presented an example of a traveler randomly selecting which city to visit next depending on what city they are currently in. We discussed transition probabilities and the transition probability matrix. A matrix was a two dimensional table of numbers. The entries have a row number and a column number. The rows indicate which city you travel from and the columns indicate which city you travel to. In Markov chains the nodes are called "states". In the traveler example, these are the cities. In baseball, the states include the information about which bases have runners and the number of outs.

Please read the first 5 pages of the "Modeling Baseball Using a Markov Chain" handout.

Day 5: Friday, February 3, 2017

Today we discussed variables and types of variables. The atomic types were logical, integer, numeric (double), character, complex and raw. We made vectors and lists and matrices, and arrays, and data frames with these atomic types. We talked about coercion of variables from one type to another. For instance TRUE + TRUE + FALSE is coerced to 2. We also talked about variables whose values were functions. We then moved to work on Git. We created a GitHub account and forked Max Albert's Baseball_R repository that includes the code for our textbook. We created a new branch in our repository, made a change, then tried to push the branch to our forked repository. Pushing the branch didn't work.

Day 6: Tuesday, February 7, 2017

Today we discussed: factors, custom classes, and data frames. I showed you the default datasets in R. We spent a little more time on GitHub, including figuring out how do create new branches. Then I discussed model selection, and passed out a printout of my code called KLI in R for estimating the number of samples needed for model selection with confidence.

Day 7: Friday, February 10, 2017

Today we have a homework assignment: Homework 01. Most people got through the script part of the assignment and were preparing to work on the dynamic documents part.

Day 8: Tuesday, February 14, 2017

We worked on dynamic documents part of the assignment from last class: Homework 01.

Day 9: Friday, February 17, 2017

We did an exercise on spatial data in class today.

Day 10: Tuesday, February 21, 2017

There is a new homework for today's class: Homework 02.

We are going to tie both homeworks together on a website. This website will not be accessible via the web but will be accessible via a browser on your local computer. The code will of course be in GitHub. On the About page for the website, please list your goals, dreams, and what you want to get out of this class.

See

http://rmarkdown.rstudio.com/rmarkdown_websites.html

Day 11: Friday, February 24, 2017

We worked on Homework 02 in class, today. Those who were finished worked on projects. Homework 02 had real challenges. Good going if you were able to complete it!

Day 12: Tuesday, February 28, 2017

We now have a server! Today we set up user accounts on the server and worked on Homework 03, which involved first putting R-Studio's template for R-Markdown on the server and making it accessible to the web, and then updating the server with a completed version of homework 03 which involved an exercise with loops and conditionals based on the truncated Normal distribution.