Programming and Data Analysis with R
Statistical Models and Applications in Economics and Environmental Sciences
This website collects the material of the Programming and Data Analysis with R part of the course Statistical Models and Applications in Economics and Environmental Sciences, B.Sc. in “Economics and Science for Environmental Sustainability”, Università degli Studi di Milano-Bicocca.
The other module of the course, Statistical Inference and Modeling, is not covered here.
Teaching material
Required
- Agresti, A. and Kateri, M. (2022), Foundations of Statistics for Data Scientists, CRC Press.
- Agresti, A. and Kateri, M., R Web Appendix of the above book. It is freely available and it is an integral part of the material of this module.
The website of the book, where the data files used in the exercises are also hosted.
Notes and R scripts
The code is written live during the classes, following the R scripts. The notes cover exactly the same material and are there for you to consult at any time, before or after the class.
The acronym AK refers to the book by Agresti and Kateri: the sections numbered §A0, §A1, . . . are those of its R web appendix.
| Topic | Notes | R script | Textbook |
|---|---|---|---|
| INTRODUCTION TO R | |||
| A-B-C | Unit A | un_A.R |
AK §A0.1–A0.3, §A0.6 |
| Programming | Unit B | un_B.R |
AK §A0.3.5, §A0.5 |
| Data frames | Unit C | un_C.R |
AK §A0.3.4, §A0.4 |
| Exercises | Exercises A | ||
| DESCRIPTIVE STATISTICS | |||
The dde data |
Unit D | un_D.R |
AK §1.4, §A1.2 |
The hemoglobin data |
Unit E | un_E.R |
AK §1.4, §A1.3 |
The forbes data |
Unit F | un_F.R |
AK §1.5, §6.1, §A1.5 |
The titanic data |
Unit G | un_G.R |
AK §1.5, §A1.6 |
| Exercises | Exercises B | ||
| INFERENCE AND SAMPLING DISTRIBUTIONS | |||
| Random variables | Unit H | un_H.R |
AK Ch. 2, §A2.1 |
| Sampling distributions | Unit I | un_I.R |
AK Ch. 3, §4.1, §A3 |
| Confidence intervals and tests | Unit J | un_J.R |
AK §4.3–4.5, §5.1–5.3, §A4.1 |
| Exercises | Exercises C | ||
| LINEAR MODELS AND LEAST SQUARES | |||
The trees data |
Unit K | un_K.R |
AK §6.1–6.4, §A6.1–A6.2 |
The Houses and Income data |
Unit L | un_L.R |
AK §6.2.4, §6.5.1–6.5.3, §6.5.5 |
| Exercises | Exercises D |
Exam
The exam is a written examination held in the computer lab, combining theoretical questions, exercises and exercises in R, covering both parts of the course. Students are required to execute R code in order to answer some of the questions.
| Date | Exam |
|---|---|
| No exams yet |
Software
- R is open source and can be downloaded at https://cloud.r-project.org.
- The use of RStudio is optional but strongly recommended: https://posit.co/download/rstudio-desktop/.
- The documentation of the R software is an integral part of the teaching material.