GG 615 L P R, R, R P: Iterate Rogramming With Studio AND Markdown Urpose
GG 615 L P R, R, R P: Iterate Rogramming With Studio AND Markdown Urpose
615
PURPOSE
This course was created to meet the needs of graduate students and upper level undergraduates who
haven’t coded before at all, or want to learn R, or want to learn literate programming for the
purpose of writing research papers.
The course is mostly hands-on coding. Weekly coding assignments touch on introductory statistics,
pre-calculus math, and even a bit of linear algebra. Toward the end of the course we also introduce
Matlab, which is easy to learn and convenient for rapid modeling.
Topics
2. Introduction to graphics in R: base graphics and the ggplot2 package. LaTeX for math in R
Markdown. Expressions and latex2exp for annotation in R.
3. Classes and data structures in R. Vector and matrix algebra in R and Matlab. Tidy data.
4. Indexing and subsetting in R and Matlab. Submission formats for science journals. EndNote.
5. Skill with RStudio: navigating directories and environments, inspecting and editing data
structures, choosing and installing packages, CRAN and Taskview. Skill with R Markdown:
stopping the knit where you want, figure sizing, choosing the dev, saving separate figures.
6. Writing and calling functions in R and Matlab. Graceful error handling. Knitting to MSWord
and subsequent editing.
7. For- and while loops. Functional programming. Advanced graphics: legend wrangling in R and
Matlab.
8. Control structures: if, if-else, ifelse, switch. Review of probability density functions.
9. Forward modeling and the estimation of uncertainty. Why Monte Carlo is easier and less prone
to error than calculus. Histograms, densities and statistics. Why quantiles are always more
informative than mean and sd.
10. More on distributions: PDFs, CDFs, inverse CDFs and samplers. The d-p-q-r nomenclature.
Interval scale and ratio scale variables: when to transform.
11. Frequentist thinking and likelihood. Wilkinson-Rogers notation, lm() and its friend predict().
Confidence intervals and prediction intervals. Robustness and alternatives to L2 processing.
Bootstrapping.
12. Bayesian thinking: prior, posterior and sampling distributions, likelihood, prior predictive,
posterior predictive, evidence. Conjugate priors. Uninformative priors.
13. Introduction to Markov chain Monte Carlo (MCMC). The Gibbs sampler and the JAGS
program. Hamiltonian Monte Carlo and the Stan program.
14. Review.
Textbooks: A textbook isn’t absolutely required, but I recommend Data Analysis with R by Tony
Fischetti, PACKT Publishing, and copies of this text have been ordered by the UHM bookstore.
Class Format:
This is a combined lecture-laboratory. Students are encouraged to actively ask questions in class, to
work on weekly assignments in class, and to assist each other in learning, although copying of work is
not permitted.