Publications by Matt Bogard

Copula Functions, R, and the Financial Crisis

10.03.2011

From: In defense of the Gaussian copula, The Economist“The Gaussian copula provided a convenient way to describe a relationship that held under particular conditions. But it was fed data that reflected a period when housing prices were not correlated to the extent that they turned out to be when the housing bubble popped.”Decision...

3606 sym R (2830 sym/1 pcs) 8 img

Plotting Indifference Curves with R Contour Function

11.03.2011

The following post at Constructing Difference Curves – Part 3 from economics.about.com provides a discussion on indifference curves (but actually I think they are isoquants) and how to construct them. I think I have a grasp on how to do this in R if you define the utility function as z =  √(x*y) . For the x and y data I used modi...

1442 sym R (2602 sym/2 pcs) 2 img

The Budget Compromise: Mining Tweets

09.04.2011

After a week as SAS Gobal Forum, I’ve been pretty excited about some of the text mining presentations that I got to see. I couldn’t wait to get back to work to at least try something.  After getting home I found a tweet from @imusicmash sharing a post from the Heuristic Andrew blog that shared text mining code from R.  I thought...

3988 sym 4 img

An Intuitive Approach to ROC Curves (with SAS & R)

06.05.2011

I developed the following schematic (with annotations) based on supporting documents (link) from the article cited below. The authors used R for their work. The ROC curve in my schematic was output from PROC LOGISTIC in SAS, the scatterplot with marginal histograms was created in R (code below) using the scored data from PROC LOGISTI...

1361 sym R (2503 sym/1 pcs) 4 img

%EXPORT_TO_R SAS Macro Code

06.05.2011

The SAS Analysis blog post ‘A macro calls R in SAS for paneled 3d plotting’ influenced my macro coding.   The following macro call: %EXPORT_TO_R(DATA = YOURDATA)  exports the SAS data set ‘YOURDATA’ as .csv and produces the R code for setting the R working directory and reading the file. R-code written by %EXPORT_TO_R :# s...

3452 sym R (245 sym/1 pcs) 2 img

R Program Documentation Template

13.08.2011

# ------------------------------------------------------------------ # |PROGRAM NAME: # |DATE: # |CREATED BY: MATT BOGARD # |PROJECT FILE: # |---------------------------------------------------------------- # | PURPOSE: # | # |------------------------------------------------------------------ # |DATA ...

400 sym R (955 sym/1 pcs) 2 img

QTL Analysis in R

13.08.2011

See also: Part 1: QTL Analysis and Quantitative Genetics  Part 2: Statistical Methods for QTL Analysis The ‘qtl’ package in R allows you to implement QTL analysis using the methods I’ve previously discussed. The code below is adapted from Broman’s documentation “A Brief Tour of R/qtl.” ( http://www.rqtl.org/tutorials/rq...

2866 sym R (3900 sym/1 pcs) 10 img

Elements of Bayesian Econometrics

16.09.2011

 posterior = (likelihood x prior) / integrated likelihoodThe combination of a prior distribution and a likelihood function is utilized to produce a posterior distribution.  Incorporating information from both the prior distribution and the likelihood function leads to a reduction in variance and an improved estimator. As n→ ∞ the likelihood...

5123 sym R (1257 sym/1 pcs) 6 img

Bayesian Models with Censored Data: A comparison of OLS, tobit and bayesian models

17.09.2011

The following R code models a censored dependent variable (in this case academic aptitude) using a traditional least squares, tobit, and Bayesian approaches.  As depicted below, the OLS estimates (blue) for censored data are inconsistent and will not approach the true population parameters (green).A tobit model will provide better re...

5029 sym R (2583 sym/1 pcs) 6 img

Gradient Descent in R

27.11.2011

In a previous post I discussed the concept of gradient descent.  Given some recent work in the online machine learning course offered at Stanford,  I’m going to extend that discussion with an actual example using R-code  (the actual code is adapted from a computer science course at Colorado State, and the example is verbatim from...

1904 sym R (1706 sym/1 pcs) 4 img