Archives for posts tagged ‘Programming’

Using -levelsof- to future-proof a loop through factorial variables in Stata

Stata’s -levelsof- command was a solution to a problem I encountered the other day when I had to write a script that looped through a dataset and was one that I previously didn’t know about. In general, I feel that if you find yourself making looping through observations in a dataset or creating many nested [...]

Generate monte-carlo simulated data for simultaneous equations

There are many sources around the net describing how to use two-stage least squares (2sls) to estimate a system of simultaneous equations. I won’t get into the nitty-gritty of simultaneous equations here because there is plenty out there on the web. My purpose for this post is to simply show how one can create an [...]

Statistical analysis Q&A website

Earlier I mentioned the website StackOverflow.com which is a great way to get help with programming questions. Now on the website Area51 there is a proposal to create a similar site for questions related to statistical analysis. My hope is that the site would be a great place to find help answer questions like: What [...]

Random conversion of imported data to factors in R

While getting extremely frustrated trying to import a simple dataset into R today I stumbled upon a post by Erehweb who sarcastically dissects the difficulty of importing numeric data into R and having it automagically converted to factors saying: Maybe when you do an uncommon operation like reading in a file, your numbers will be [...]

NppToR: R Syntax Highlighting, Code Folding and Code-Passing for R in Notepad++

When I’m not using Stata for modelling I sometimes dabble with R. In general I find that this is a good environment for modeling when you may want to keep several datasets (or data.frames as they are called in R) in memory. For better or worse, Stata allows you to keep only one dataset in [...]