Programming in Finance and Economics I
This course requires basic knowledge of a programming language, as specified in the admission criteria to the Master in Finance. For USI students, Informatica I is sufficient. Students with little or no programming experience in R have to follow an online tutorial before the course starts.Objectives
Many interesting problems in economics and finance can only be solved with the help of the computer, as no analytical solution exist or large amounts of data are involved. This course teaches how to solve quantitative problems with the help of R, a powerful and widely used open source programming environment.
The course has the following goals:
- Learn the most important elements of the R language
- Understand the differences between analytical and numerical problem solving
- Learn how to translate mathematical or statistical problems into the R language
- Learn how to organize data efficiently with the help of R
- Learn how to write efficient and durable R programs
After this course, students should be able and confident to use R independently for project work, courses such as numerical methods or for their master thesis.
Description / Program
The course is structured along computational concepts, not applications.
The topics include
- Recap of basic R: variables, types, operators and main commands
- How computers calculate: floating point numbers
- The R language: commands and functions
- Modular programming: User-defined functions and loops
- Working with data in R, data sources and data APIs
- A short introduction to numerical algorithms
- Random number generation and simple simulations
- Finding and installing R packages
- How to write a successful program or an entire research report in R
- Finding errors and improving R programs
Learning Method / Style of Lessons
The course is organized in seven blocks of four hours. Each block introduces a new concept and employs learning-by-doing to move from theory to practice. Students start with short online tutorial before each class (flipped classroom). The course block itself starts with a presentation of a new concept. Next, we study a sample R program that illustrates this concept and try to understand the underlying ideas. Students will then train their skills with programming exercises that are submitted to an online system that provides instant feedback.
10% participation in online tutorials
- Grading is based on timely completion of the online tutorials
40% individual programming exercises during the course phase
- Grading is based on the correctness of the results, programming style
- If students require help or automatic feedback, a small deduction in points is performed
50% programming project in small groups, due at the end of the semester
- Grading is based on four criteria:
- Completeness and correctness (Does the program work, produce correct results and perform all the tasks required?)
- Programming style (Is the program written elegantly, efficiently and well documented?)
- User documentation (Completeness, style)
- Complexity of the problem and the solution (Are requirements over/under satisfied in a relevant way?)
Students should bring a laptop with R and R Studio installed to all classes.
This class is generously supported by Datacamp.
All slides and sample programs will be published on iCorsi.
Additional material about the R programming language
Venables et al: An introduction to R, https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf
Additional material about the Rstudio IDE
https://www.rstudio.com/resources/webinars/ (choose “Programming part I”)
Further resources will be discussed in the first lecture.