Publications by Tony Cookson
How to read and write Stata data (.dta) files into R
Here’s an R tutorial where I explain how to read Stata data files into R (even if you don’t own the program Stata). I also offer some other basic tips.Of note, you can also write Stata .dta files from R (if your coauthors or journals insist on having “.dta” data). Suppose your R data frame has the name fuzzybunny and you want...
1021 sym 8 img
Tutorial on Distributions in R
Here’s a video tutorial I put together to go over how to generate a random sample from one of the commonly known parametric distributions in R.Along the way, I also discuss how some of the properties of estimators are reflected in the computations I perform. Related To leave a comment for the author, please follow the link and com...
693 sym 8 img
Running a Regression in R
I created another video tutorial on R. This time, I discuss R’s lm() command and how to use it for a variety of standard applications.Here is the code that goes with the video:Enjoy! Related To leave a comment for the author, please follow the link and comment on their blog: Coffee and Econometrics in the Morning. R-bloggers.com...
617 sym 8 img
Data from last post
Posting the code I used in the last post wasn’t that useful unless I also posted the data set. Here’s the data. These are made up data, but it is a nice data set for illustrating how to conduct a regression. Enjoy! Related To leave a comment for the author, please follow the link and comment on their blog: Coffee and Econome...
652 sym 8 img
How Does R Deal with Categorical Explanatory Variables?
Here’s a video tutorial where I demonstrate an answer to this question.This video is designed to instill a baseline level of practical knowledge. There is more to how R treats factors in regression models. An interested reader should Google “R contrasts” for more information.Here is the code I used in the video:Here is a link ...
781 sym 8 img
Testing Multiple Linear Restrictions in R
This video shows a couple of things:1. How to test (multiple) linear restrictions in R.2. How to install a package in R. Here is the code I use in the video (with some extra comments).Here is the data set that I use in the video. Related To leave a comment for the author, please follow the link and comment on their blog: Coffee and...
664 sym 8 img
Basic Plots in R
Here’s a tutorial I recorded on producing basic plots in R.I lost the script file I used to create the video to a horrifying black screen of death, but I used the data from the previous post (available here). Hopefully, the video is clear enough that you can follow along with your own window of R. Related To leave a comment for t...
734 sym 8 img
IV Regression
Here is my code from a previous post that performs IV regression. This may be easier to copy into an R script. I will post a video tutorial using this code shortly. Related To leave a comment for the author, please follow the link and comment on their blog: Coffee and Econometrics in the Morning. R-bloggers.com offers daily e-ma...
601 sym 8 img
Video Tutorial on Instrumental Variables in R
Update: I have replaced this video tutorial with a video tutorial on a newer, easier to use IV regression command. Check out that command here.In this video, I show how to use my instrumental variables function in R, ivreg(), along with its companion summary command, sum.iv().Here is a link to the synthetic “market share” data I used in the ...
773 sym 8 img
An easier to use IV regression command in R
Update: I have added some functionality to my ivregress() command. Check out my newer post here.After I posted my last video tutorial on how to use my IV regression function, I received a comment asking why I didn’t write the command a different way to make the syntax easier to read.The answer is that I didn’t know how to write an easier to ...
1926 sym 8 img