Monday, February 28, 2011

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:


Friday, February 25, 2011

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.

Thursday, February 24, 2011

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 to save the file to the C: drive as myfuzzydata.dta. After loading the foreign library,


Here's the syntax:

write.dta(fuzzybunny, "C://myfuzzydata.dta")

Try it out and impress your friends (you know, the friends who only know how to use Stata).

Tuesday, February 22, 2011

An R Video Tutorial on Entering Data

Here is a video tutorial on entering and manipulating data in R. I plan to do more of these. If you have some suggested topics, let me know in the comments.