# Introduction to Computer Science for Economists

## 1. Description

This course provides an introduction to computer science concepts and techniques that are relevant to economists. The course aims to equip students with the fundamental knowledge and skills needed to apply computational methods to economic analysis, modeling, and data analysis. It provides the prerequisite knowledge for students who want to follow specialized courses in data science and machine learning. The course focuses on the following topics:

**Introduction to programming.**The course introduces students to programming concepts and practices, including data types, control structures, and functions. The focus is on programming in R, a widely used language in data science, statistical learning, and computational economics.**Data analysis.**The course covers techniques for data analysis including exploratory data analysis, statistical inference, data preprocessing and feature engineering for machine learning using libraries such as dplyr and TensorFlow.**Visualization.**The course introduces students to the basic concepts of graphics and visualization, including commonly used types of figures and visualizations, annotations, and labeling using the ggplot2 library.

## 2. Objectives

The course's first objective is to introduce students to programming with R. It does so by guiding the students in exploring popular R libraries that are commonly used in data analysis, visualization, and statistical learning. On successful completion of the course, students will be able to

- understand and apply programming concepts and practices to solve economic problems,
- analyze and interpret economic data using appropriate tools and techniques, and
- apply common visualization techniques to economic data.

Second, the course aims to instruct students on working on economic data science projects effectively in a team and communicate technical ideas clearly and concisely. To emulate conditions of working on collaborative data science projects, the didactic approach of the course is to provide students with coding challenges and exercises with economic data that students can work in groups to solve.

Finally, the course aims to enable the students to independently enrich and expand their knowledge of R statistical software and its libraries after completing the course. To this end, the course provides a comprehensive overview of the open-source R statistical software ecosystem.

## 3. Prerequisites

The course is intended for first-year post-graduate students in economics who want to further specialize in computational economics, data science, and machine learning economic applications. Programming with R will be introduced from scratch and no previous experience with the language is required. Experience with other languages such as Python can be helpful, but it is not a prerequisite. Instead, knowledge of basic statistics is a prerequisite. Knowledge of usual statistical measures of centrality and dispersion, histograms, and regression concepts introduced in typical statistics and econometrics courses of B.Sc. programs in economics or business is expected.

## 4. Reading Material

- Textbooks:
The two most important sources for the course are

**[RDS]**and**[ISLR]**. The first book is more appropriate for an introductory level. The second book covers both introductory and intermediate topics. The last texbook, i.e.,**[DLR]**, is more advanced and requires some programming experience and a deeper understanding of the R programming language.- [RDS]
- (Wickham, Hadley, Mine Getinkaya-Rundel, and Garrett Grolemund. 2023.
*R for Data Science: Import, Tidy, Transform, Visualize, and Model Data*. 2nd ed. O’Reilly Media.)

A free book with a modern introduction to R with an emphasis on the most prevalent data science activities.

- [ISLR]
- (Gareth, James, Daniela Witten, Trevor Hastie, and Robert Tibshirani. 2014.
*An Introduction to Statistical Learning: With Applications in R*. Springer Publishing Company, Incorporated.)

An intermediate book with a comprehensive hands-on approach to statistical learning with R.

- [DLR]
- (Chollet, F., T. Kalinowski, and J.J. Allaire. 2022.
*Deep Learning with R, Second Edition*. 2nd ed. Manning.)

Deep learning for classification, computer vision, and time series applications using Keras and TensorFlow in R.

- Blog:
- The discussion topics of the course are available online. The blog contains interactive components (figures, videos, etc.) that can be used when studying. Last but not least, the blog has indices for all the concepts, learning activities, and applications of the course, with links to the corresponding material section they are introduced.

https://teach.pikappa.eu/cs-economics/

- Slides:
- The slides of the course are available online. The content of the slides is a
*subset*of the content available on the blog. The slides are optimized for presenting the course's main ideas in the lectures and are not meant to be used as reading material. Instead, students can use either the blog's topics or the handout to revise what we cover in the lectures.

https://teach.pikappa.eu/cs-economics/slides.html

- Handout:
- A cumulative version of the course's material is given in an online handout format as a single web page (loading all the material can take a while on older cell phones or tablets, though). Those who prefer using PDF material can use the Downloads section of the course's blog. The handout can be downloaded in PDF format from there, though this comes at the expense of figure interactivity.

## 5. Organization

The course discusses the following topics in more detail.

- Preamble (1.5 hours)
- Introduction to programming concepts and practices
- Overview of the R programming language
- Why R?
- A preview of the R ecosystem. What can one do with R?
- Setting up the development environment

- Introduction to Programming (2.5 hours)
- Data types and operators
- Control structures (if-else, loops)
- Functions and libraries
- Lists and vectors
- Input-output operations
- Group coding challenge
- Best practices in R programming

- Data Analysis and Transformation (4 hours)
- Introduction to data analysis and transformation
- Overview of the dplyr library
- Reading and writing data
- Data manipulation and transformation
- Aggregation and grouping operations
- Merging and joining data
- Group data analysis exercise
- Best practices in data analysis

- Data visualization (3.5 hours)
- Introduction to data visualization
- Overview of the ggplot2 library
- Basic plotting with ggplot2
- Aesthetics
- Coordinate systems and geometric transformations
- Annotations and Labels
- Group data visualization exercise
- Best practices in data visualization

- Epilogue (0.5 hours)
- Where to go from here?
- A preview of statistical and machine learning with R

## 6. Evaluation

There is no final exam for the course. Throughout the course, students will have the opportunity to apply their newly acquired knowledge through programming exercises and short data analysis projects. The course emphasizes hands-on learning in teams and practical problem-solving.