CSU Fullerton
800 N. State College Blvd.
Fullerton, CA 92831-3599

Main Nick HK Website

Educational Videos

I have three main video series, listed on this page: Advanced Stata Tips, Introduction to R for Economists, and Principles of Microeconomics. I also have a few stray additional videos, which you can see here, in addition to a few more stragglers which you can see by going directly to my YouTube channel. Feel free to subscribe; who knows when I'll get the itch to make another series!



Principles of Microeconomics:

This series of videos is meant to accompany my Principles of Microeconomics (ECON 201) class. Or, if you're a non-CSUF visitor, you can use it as a free principles of micro course! You can see these videos on a YouTube playlist as well here.
Principles of Microeconomics Video 1: Incentives

This lecture is equivalent to the first day lecture in ECON 201. Here we cover the basics of incentives, and a bevy of important vocabulary terms.
Principles of Microeconomics Video 2: Comparative Advantage

This lecture is equivalent to the second day lecture in ECON 201. Here we cover comparative advantage, and the tricky problem of how to most efficiently use the resources at hand.
Principles of Microeconomics Video 3: Supply and Demand

This lecture is equivalent to the first Supply and Demand lecture in ECON 201. Here we cover the basics of the supply and demand model - how it works, how it explains price and quantity, and how it describes markets as working.
Principles of Microeconomics Video 4: Supply and Demand Part 2: Moving Curves Around!

This lecture is equivalent to the second Supply and Demand lecture in ECON 201. Here we cover how the supply and demand model MOVES AROUND! No point to the model if you don't move it around.
Principles of Microeconomics Video 5: Marginal Thinking

This lecture is equivalent to the first post-Midterm 1 lecture in ECON 201. Here we cover the ONE GOLDEN RULE to explain all of economics! Marginal thinking ahead...
Principles of Microeconomics Video 6: Costs and Supply

This lecture is equivalent to the second post-Midterm 1 lecture in ECON 201. Here we cover the the cost structure for a firm, and see how firms in competitive markets choose quantities that maximize their profits.
Principles of Microeconomics Video 7: Elasticity

This lecture is equivalent to the Elasticity lecture in ECON 201. Here we cover the the cost structure for a firm, and see how firms in competitive markets choose quantities that maximize their profits.
Principles of Microeconomics Video 8: Efficiency

This lecture is equivalent to the Efficiency lecture in ECON 201. Here we cover the allocation of goods, and how different ways of allocating goods leads to resources being used more or less efficiently. We also talk a lot about competitive markets, and snow shovels.
Principles of Microeconomics Video 9: Market Failure

This lecture is equivalent to the Market Failure lecture in ECON 201. Here we cover the times when competitive markets will NOT lead to efficient results. We cover externalities, as well as goods that may not be rival in consumption, or may not be excludable.
Principles of Microeconomics Video 10: Pricing Power

This lecture is equivalent to the first Pricing Power lecture in ECON 201. Here we cover what happens when competition is limited in some way - pricing power! We cover the causes of pricing power, how a monopoly maximizes profit, and what to do about monopolies.
Principles of Microeconomics Video 11: Pricing Power, Part 2

This lecture is equivalent to the second Pricing Power lecture in ECON 201. Here we cover market structures aside from competitive and monopolistic markets - oligopolies and monopolistic competition. We also look at how firms with pricing power use price discrimination.
Principles of Microeconomics Video 12: Game Theory

This lecture is equivalent to both game theory lectures in ECON 201. Here we cover the basics of game theory, including sequential and simultaneous games, and the problems with commitment that both of them lead us to!
Principles of Microeconomics Video 13: Risk and Partial Information

This lecture is equivalent to the Partial Information lecture in ECON 201. Here we cover the times when we don't know the full consequences of our actions! We cover expected utility, risk, search, and information-providing firms.
Principles of Microeconomics Video 14: Asymmetric Information

This lecture is equivalent to the Asymmetric Information lecture in ECON 201. Here we cover the times when one person in a transaction knows more than someone else. Lemons ahoy!
Principles of Microeconomics Video 15: Labor Economics

This lecture is equivalent to the first Labor Economics lecture in ECON 201. Here we cover the basics of what is essentially the biggest market around! What goes into labor supply and labor demand? And why do different people earn different wages?
Principles of Microeconomics Video 16: Wage Differentials

This lecture is equivalent to the second Labor Economics lecture (Wage Differentials) in ECON 201. Here we cover reasons why different people earn different wages, other than simply being differently productive! We cover compensating differentials, labor unions, and discrimination.


Introduction to R for Economists:

This series of videos is aimed at the undergraduate Econ crowd as well as any other economists getting started in R. It's aimed at explaining the R software package through the lens of the kinds of things that economists tend to do. The videos are divided into Basics, Moderate, and Advanced. You can see these videos on a YouTube playlist as well here. Note that if you click through to the YouTube video, the code shown in each video is available through a link in the description. Or, you can simply download a ZIP file with all the code here.
Introduction to R for Economists

This series of videos will serve as an introduction to the R statistics language, targeted at economists. This video will lay out how these videos will go!

BASIC R VIDEOS:

Basics 1: Getting Started

In this video, I cover how to install R and RStudio, and how to work your way around RStudio.
Basics 2: Getting Help

In this video, I cover how to use the documentation in R. I cover the help search bar, the help() function, ??, and searching for R help on the internet.
Basics 3: Objects and Variables in R

In this video I cover the basics of working with variables, creating new ones, using the is. and as. functions, and manipulating variables.
Basics 4: Vectors and Matrices

This video will cover the basics of using vectors and matrices in R, from creating them with c() and cbind() to exploring them with [] and proper indexing. Not to mention using vectors inside vectors!
Basics 5: Data Frames

This video offers an introduction to data frames, showing how to create them out of matrices using as.data.frame (although skipping over how to create them from scratch using data.frame() - check it out!), how to select variables using $, and how to look at the data using head().
Basics 6: Data Frames Part 2

This video expands on the introduction to data frames, showing how to manipulate variables using $, and how to choose a subset of the rows and columns of the data using the subset() command.
Basics 7: Packages and Libraries

This video will cover how to install (with install.packages() or the Packages tab) and load (with library() or the Packages tab) packages in R. The particular package we'll be loading is "foreign", which contains the read.dta() function we'll need to load in data for the next few videos!
Basics 8: Summary Statistics with One Variable

This video will cover how to calculate basic statistics, like mean and standard deviation, with a single variable, or how to look at all the levels of a categorical or discrete variable with table(). It will also show how to create summary statistics tables with summary() and stargazer().
Basics 9: Summary Statistics with Two Variables

This video will cover how to calculate summary statistics of two variables, including correlations with cor(), cross-tabulations with table(), comparing the means of two variables with t.test(), and calculating summary statistics by group with aggregate().
Basics 10: Plots and Graphs

This video covers the basics of plotting in R, using the commands plot() for scatterplots, hist() for histograms, plot(density()) for kernel densities, barplot() for bar graphs, and plot(,type="l") with aggregate() for line graphs.
Basics 11: Linear Regression (OLS)

This video covers how to run a linear regression in R and create a regression object with lm(), as well as how to display the results of that regression with summary() or stargazer(). It also covers how to construct a regression formula in R.

MODERATE R VIDEOS:

Moderate 1: Fancy Linear Regression Formulas (Squares, Interactions, etc.)

This video will cover how to include something in your regression commands other than just a list of controls! These tips apply to all kinds of regression, too, not just OLS. These include square and threshold terms with I(), logs with log(), interaction terms with * or :, and sets of dummies with factor().
Moderate 2: Robust or Clustered Errors and Post-Regression Statistics

In this video we cover what to do once you've already run your regression! We pull out the predicted values and residuals with predict() and residuals(), we use Breusch-Pagan (bptest()) to check for heteroskedasticity, we calculate heteroskedasticity- or cluster-robust standard errors with coeftest() in the sandwich package, and we perform F-tests of regression coefficients with linearHypothesis() in the AER package. These commands and tests work with all kinds of regression commands, not just OLS (lm()).
Moderate 3: Regression Plots

In this video we cover how to make plots of your regression after you've performed it. We produce residual plots, plots of fitted values, and we overlay the regression line on top of a scatterplot.
Moderate 4: Instrumental Variables (IV)

In this video we cover how to perform an instrumental variables regression using ivreg() from the AER package. We also cover how to estimate the first stage separately, and run an F-test on the instruments using linearHypothesis().
Moderate 5: Time Series

In this video we cover the basics of time series analysis, from making time series objects with ts(), loading them in with data(), plotting them with plot(), plotting autocorrelation and partial autocorrelation functions with acf() and pacf(), performing Dickey-Fuller with adf.test(), and some seasonality with stl() and seasonplot(). Lots of stuff!
Moderate 6: ARMA and ARIMA

In this video we cover how to use R's ARIMA command arima(), which also covers ARMA models. I also show how to use these models to forecast the future using forecast() from the forecast package. That's about it!
Moderate 7: Probit and Logit (Limited Dependent Variables)

In this video I cover some basic limited dependent variable models, in particular how to do probit and logit with glm() and then get their marginal effects with the mfx package. I even go over ordered logit and ordered probit with polr() and their marginal effects with ocME().
Moderate 8: Tobit and Heckman (Censored Data and Sample Selection)

In this video I cover how to perform a Tobit regression with censReg() and get its marginal effects with margEff(). We also cover how to perform a sample selection regression, or Heckman model, with selection().
Moderate 9: Panel Data

In this video, I cover the basics of panel data using library(plm), pdata.frame()s, and performing fixed effects, random effects, and first-difference regressions with plm(), as well as the Hausman test (phtest()).
Moderate 10: Missing Data

In this video, I cover how to handle it when you have missing data in your data set. I'm really just covering how to make sure listwise deletion works properly, with is.na(), complete.cases(), na.rm, and na.omit. But that's a good place to start with missing data!

ADVANCED R VIDEOS:

Advanced 1: Simulations

In this video, I cover how to create your own random data (using rnorm() and similar commands) in order to perform a simulation that will allow you to test how much of a problem it is if your assumptions fail! The only other new command here is for loops, but I cover a few advanced ways of putting it all together.
Advanced 2: The Tidyverse

In this video, I provide an introduction to the tidyverse library, which is a great way of handling data manipulation. I address the better-than-data-frames tibbles and as.tibble(), the better-than-head() glimpse(), and the better-than-read.dta read_dta in the haven package.
Advanced 3: Reshape and Join/Merge

In this video I cover how to reshape your data from wide to long format using gather(), and then how to join/merge two data sets together using the various join commands in tidyverse. I also cover the concept of the observation level, very important when joining!
Advanced 4: dplyr

In this video I cover the basics of using dplyr, a package for manipulating data. In this video I cover how dplyr is structured, and how you can use mutate() to create variables, filter() and select() to subset rows and columns, arrange() to sort the data, and rename() to rename variables.
Advanced 5: Piping in dplyr

In this video I will cover how to use the pipe operator %>% in dplyr to chain together multiple operations at once. Highly useful!
Advanced 6: Grouping in dplyr

In this video I will cover how to use group_by() in dplyr, which will prove highly useful in combination with mutate() and summarize().
Advanced 7: ggplot

In this video I go over a very basic introduction to the ggplot function from the ggplot2 package (from, of course, the tidyverse). I illustrate how to put together a ggplot command by combining a data set, an aes()thetic, and a geometry (geom_point()) in the example).

Check out the ggplot2 reference manual here!
Advanced 8: ggplot Geometries

In this video we go further into ggplot, detailing some of the geometries you're most likely to use in your graphcs - geom_point() for scatterplots, geom_bar() for bar graphs, geom_histogram() for histograms, geom_density() and stat_density() for density plots, and geom_line() for line graphs.
Advanced 9: Overlaid and Grouped ggplots

In this video we go further into ggplot, detailing how to overlay graphs on top of each other, with examples on putting a regression line (geom_smooth) over a scatterplot (geom_point) or putting straight lines (geom_hline and geom_vline) over scatterplots and density (geom_density) plots. I also go over how to draw graphs separately by group by including a color, shape, or linetype aspect in the aes()thetic.
Advanced 10: ggplot Titles and Labels

The final video! In this video I go over how to put labels and titles on your ggplot()s. I go over axis labels with xlab() and ylab() as well as whole-graph titles with ggtitle(). Finally, I cover how to label your legends as desired, either by carefully labeling your factor variables, or with scale_color_manual() and/or labs().

BONUS R VIDEOS:

Bonus 1: vtable

This video is a brief introduction to the vtable package, which I wrote. The function vtable() makes it quick and easy to look at information about your variables while you continue to work on your data, without repeatedly calling head(), glimpse(), etc., or to automatically create variable documentation files to share with others.


Advanced Stata Tips:

This series of videos is somehow my most popular by far. It provides Stata tips for the advanced user, and assumes you already have a moderate knowledge of how to use Stata. You can see these videos on a YouTube playlist as well here.
Using Excel to Write Code for Stata and Other Stats Packages

The first video I made for YouTube and by far the worst video quality! This is a nice time-saving trick that I use with some regularity when I have to write some tedious code. Usually this approach is taking the place of a nicer-looking for loop of some kind directly in your stats package, but I find that using Excel like this can often save a lot of time over writing the for loop if the task isn't nice and clean. Also, in some cases it's easier to check that you've done it correctly, and make the process robust to strangely formatted data like what I have here.
Cascading Replace in Stata

This is a very useful trick that I use all the time whenever I am doing data editing in Stata. Stata-specific, too! Can't get this to work in most other statistics packages.
Panel Data in Stata: Reshape and Collapse

Two of the trickest Stata commands that you will almost certainly finding yourself having to use if you're manipulating panel data!
Handling Missing Data in Stata

If there are missing observations in your data it can really get you into trouble if you're not careful. Some notes on how to handle it.
Opening New Stata Files in Old Versions of Stata

If you've ever tried to use old versions of Stata to open datasets made in newer versions, you know it doesn't quite work right! Let's figure out how to do it.
Interaction Terms in Stata

This video will explain how to use Stata's inline syntax for interaction and polynomial terms, as well as a quick refresher on interpreting interaction terms.
Basic Loops in Stata

This will go over the basic syntax and information about foreach and forvalues loops in Stata, as well as how to use them with levelsof.
Basic Loops in Stata

This will go over the basic syntax and information about foreach and forvalues loops in Stata, as well as how to use them with levelsof.
Handy Shortcuts in Stata

Just some nice quick shortcuts to save you some time in Stata!
Outputting Stata Summary and Regression Tables for Excel, Word, or LaTeX

Don't you dare spend hours copying over every cell of your table by hand! There are many easier ways to get your results out of Stata. Goes over outreg2, mkcorr, and copying tables.
Outputting Stata Summary and Regression Tables for Excel, Word, or LaTeX

Don't you dare spend hours copying over every cell of your table by hand! There are many easier ways to get your results out of Stata. Goes over outreg2, mkcorr, and copying tables.
Bootstrap in Stata

This video will talk about some of the basics of bootstrapping, which is a handy statistical tool, and how to do it in Stata.
Monte Carlo Simulation in Stata

One good way to test-drive an estimator and see if it works, or simply see what it does, is to use Monte Carlo Simulation. This is actually pretty easy to do! In this video I go over the steps to create a Monte Carlo simulation.


Miscellany:

Quick Steps to Nice Looking Statistical Tables for Research Papers (Word and LaTeX)

This describes the very simple steps for creating some very nice-looking tables for your research papers. It uses Stata to create the tables in the first place, but these steps could just as easily follow from a Stargazer output in R, or something else entirely. I won't claim this is the only way to do it, but this is quick, easy, and always looks good!