class: center, middle, inverse, title-slide .title[ # ECON 4370 / 6370 Computing for Economics ] .subtitle[ ## Lecture 0: Course Overview ] .author[ ### Zhan Gao ] .date[ ### 02 September 2025 ] --- class: middle name: Overview ## Overview 1. [Introduction](#3) 2. [Syllabus](#4) 3. [Software Installation](#20) 4. [R Basics](#26) --- # Introduction <div style="display: flex; align-items: center;"> <img src="./images/logo.png" width="200" style="margin-right: 20px;"> <div style="flex: 1; text-align: center;"> <h3 style="margin: 0;">ECON 4370 / 6370 Computing for Economics</h3> </div> </div> .pull-left[ ### Instructor
Zhan Gao ([website](https://zhan-gao.github.io/))
zhangao [at] smu [dot] edu
Office Hours: 1 - 3pm, Wednesday @ 301U, Umphrey Lee ] .pull-right[ ### Teaching Assistant
Zihao Yin
zihaoy [at] smu [dot] edu
Office Hours: 11 - 12pm, Monday ] --- class: inverse, center, middle name: started # Syllabus Highlights <html><div style='float:left'></div><hr color='#354CA1' size=1px width=1096px></html> (Read the full document on <span style="color:#CC0035">Canvas</span>.) --- # Why this course? Fill in the gaps left between traditional econometrics and methods classes and the real world problems. - You need practical skills to <span style="color:#CC0035">implement</span> your ideas with <span style="color:#CC0035">real/simulated data</span>. -- ... on a *"computer"* -- - Computing skills are largely distinct from (and complementary to) the core 'metrics oeuvre familiar to economists - Data viz, cleaning and wrangling; simulation; cloud computation; relational databases; machine learning; etc -- - Unfortunately, you still need to learn a programming language that the computer understands to get the job done<br> -- ... even with the rapid advances of <span style="color:#CC0035">Generative AI</span> -- <div align="center"> <img src="https://media.tenor.com/pzpYwFLrKBkAAAAM/not-yet-hold-it.gif"> </div> -- ... but maybe soon. Let's embrace it starting from this course -- - That said, it is MORE important to know what you (or the AI model) are doing behind the scenes <br> ... you are the <span style="color:#CC0035">*manager*</span> who knows *what*, *how* and *WHY* --- # Why this course? <div align="center"> A <span class="font130" style="color:#354CA1">question</span> to be answered and/or a <span class="font130" style="color:#354CA1">decision</span> to be made </div> <div style="height: 20px;"></div> <div align="center"> <span class="font130" style="color:#354CA1">Data</span> <br> numbers/text/images/etc. with <span style="color:#CC0035">context</span> <span class = "font80" style="color:gray30;">(David More & George Cobb, 1997)</span><br> Collection / retrieval / simulation <br> cleaning / wrangling / visualization ... </div> <!-- Moore, D. S., & Cobb, G. W. (1997). "Mathematics, Statistics, and Teaching", published in The American Mathematical Monthly, Vol. 104, No. 9, pp. 801-823. --> <div style="height: 20px;"></div> <div align="center"> <span class="font130" style="color:#354CA1">Model</span> <br> mathematical description of (1) the data generating process, (2) how does data depend on the model parameters </div> <div style="height: 20px;"></div> <div align="center"> <span class="font130" style="color:#354CA1">Computation</span> <br> estimate parameters from data → <span class="font130" style="color:#CC0035">prediction, inference, decision</span> <br> which answers the question and/or makes the decision </div> --- # Learning Outcomes - Write and execute <span style="color:#CC0035">reproducible code</span> in <span style="color:#354CA1">R</span> for data analysis and visualization - <span style="color:#354CA1">Python</span> is perfectly fine ... but not used in the course materials - Choice of language is less and less important in the age of AI - Use <span style="color:#354CA1">shell</span> tools, <span style="color:#354CA1">Git(hub)</span> for version control and collaborative workflows - Collect, clean, and organize <span style="color:#CC0035">data</span> from diverse sources, including <span style="color:#CC0035">web scraping</span>, <span style="color:#CC0035">databases</span>, and public datasets - Implement econometric and statistical methods for <span style="color:#CC0035">causal inference</span> and <span style="color:#CC0035">economic forecasting</span> - Implement basic <span style="color:#CC0035">machine learning</span> algorithms - Explore <span style="color:#CC0035">computing techniques</span> and <span style="color:#CC0035">modern computing infrastructure</span> - Develop fully <span style="color:#CC0035">reproducible projects</span> including data, code and documentation --- # You, at the end of this course <div align="center"> <img src="images/awesome.jpg"> </div> --- class: inverse, center, middle name: started # Getting started <html><div style='float:left'></div><hr color='#354CA1' size=1px width=1096px></html> --- # Software installation and registration 1. Download [R](https://www.r-project.org/). 2. Download [RStudio](https://www.rstudio.com/products/rstudio/download/preview/). 3. Download [Git](https://git-scm.com/downloads). 4. Create an account on [GitHub](https://github.com/) and register for a student/educator [discount](https://education.github.com/discount_requests/new). 5. Join the class team on <span style="color:#CC0035">Teams</span> -- If you had trouble completing any of these steps, please raise your hand. - Go-to place for installation guidance and troubleshooting is Jenny Bryan's http://happygitwithr.com. --- # Some OS-specific extras I'll detail further software requirements as and when the need arises. However, to help smooth some software installation issues further down the road, please also do the following (depending on your OS): - **Windows:** Install [Rtools](https://cran.r-project.org/bin/windows/Rtools/). I also recommend that you install [Chocolately](https://chocolatey.org/). - **Mac:** Install [Homebrew](https://brew.sh/). I also recommend that you configure/open your C++ toolchain (see [here](https://github.com/rmacoslib/r-macos-rtools#installer-package-for-macos-r-toolchain-).) - **Linux:** None (you should be good to go). --- # Checklist ☑ Do you have the most recent version of R? ``` r version$version.string ``` ``` ## [1] "R version 4.5.1 (2025-06-13)" ``` ☑ Do you have the most recent version of RStudio? (The [preview version](https://www.rstudio.com/products/rstudio/download/preview/) is fine.) ``` r RStudio.Version()$version ## Requires an interactive session but should return something like "[1] ‘1.4.1100’" ``` ☑ Have you updated all of your R packages? ``` r update.packages(ask = FALSE, checkBuilt = TRUE) ``` --- # Checklist (cont.) Open up the [shell](http://happygitwithr.com/shell.html#shell). - Windows users, make sure that you installed a Bash-compatible version of the shell. If you installed [Git for Windows](https://gitforwindows.org), then you should be good to go. ☑ Which version of Git have you installed? ``` bash git --version ``` ``` ## git version 2.39.5 (Apple Git-154) ``` ☑ Did you introduce yourself to Git? (Substitute in your details.) ``` bash git config --global user.name 'Your Name' git config --global user.email 'your.email@smu.edu' git config --global --list ``` ☑ Did you register an account in GitHub? --- # Checklist (cont.) We will make sure that everything is working properly with your R and GitHub setup next lecture. For the rest of today's lecture, I want to go over some very basic R concepts with demonstrations. -- </br> PS — Just so you know where we're headed: We'll return to these R concepts (and delve much deeper) next week after a brief, but important detour to the lands of Git(Hub) and the shell. - Don't worry, it will all make sense. You'll see. --- class: inverse, center, middle name: started # About R programming language <html><div style='float:left'></div><hr color='#354CA1' size=1px width=1096px></html> --- # What is R? To quote the [R project website](https://www.r-project.org): > R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS. What does that mean? - R was created for the statistical and graphical work required by econometrics. - R has a vibrant, thriving online community. ([stack overflow](https://stackoverflow.com/questions/tagged/r)) - Plus it's **free** and **open source**. --- # Why R? - Many alternatives: - STATA v.s.R v.s. Python v.s MATLAB v.s. Julia v.s. C/C++ - No clear answer... - Advantages of R - R is <span style="color:#CC0035">free</span> and <span style="color:#CC0035">open source</span> (v.s. STATA and MATLAB) - Designed for data work. Favored by the academia, particular the statistics and econometrics community, which means most of the times you can apply most up-to-date methods with packages developed by the authors. (v.s. all others) - R is very <span style="color:#CC0035">flexible and powerful</span> — adaptable to nearly any task, *e.g.*, 'metrics, spatial data analysis, machine learning, web scraping, data cleaning, website building, teaching. - Well-developed environment. Rich sources of packages. (v.s. Julia.) - R imposes <span style="color:#CC0035">no limitations</span> on your amount of observations, variables, memory, or processing power. (v.s. Stata) - If you put in the work, you will come away with a <span style="color:#CC0035">valuable and marketable</span> tool. --- # Python? <div align="center"> <span class="font150" style="color:#CC0035">Yes!</span> </div> - ... but ... path dependencies of econoemtricians and statisticians - You got to master one of them first<br> -- ... and you will be using both of them in the real world <div align="center"> <img src="https://www.business-science.io/assets/2021-01-28-python-or-r/data_science_workflow_cover.png" width="50%"> </div> --- # Why R? (cont.) and you <span style="color:#CC0035">have to </span> learn one of them <div align="center"> <img src="https://datafuture.fr/post/2018-07-24-r-or-python-nobody-cares_files/1_1YX-KXB5iL3CZOsX9bFz4w@2x.jpeg" width="60%"> </div> --- # Additional resources - Official Manual - [R-Introduction](https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf) - Books - Grolemund G. [Hands-On Programming with R](https://rstudio-education.github.io/hopr/) - Hanck, C., Arnold, M., Gerber, A., and Schmelzer, M. [Econometrics with R](https://www.econometrics-with-r.org/) - SMU Office of Information Technology Help Desk - Jenny Bryan's [Happy Git and Github for the useR](http://happygitwithr.com) --- class: inverse, center, middle name: started # Next lecture(s): R programming <html><div style='float:left'></div><hr color='#354CA1' size=1px width=1096px></html>