Blog Archives

Regression via Gradient Descent in R

November 27, 2011
By
Regression via Gradient Descent in R

In a previous post I derived the least squares estimators using basic calculus, algebra, and arithmetic, and also showed how the same results can be achieved using the canned functions in SAS and R or via the matrix programming capabilities offered by ...

Read more »

Basic Econometrics in R and SAS

November 27, 2011
By
Basic Econometrics in R and SAS

Regression Basicsy= b0 + b1 *X  ‘regression line we want to fit’The method of least squares minimizes the squared distance between the line ‘y’ andindividual data observations yi. That is minimize: ∑ ei2 = ∑ (yi - b0 -  b1 Xi...

Read more »

Gradient Descent in R

November 27, 2011
By
Gradient Descent in R

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...

Read more »

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

September 17, 2011
By
Bayesian Models with Censored Data: A comparison of OLS, tobit and bayesian models

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 ...

Read more »

Elements of Bayesian Econometrics

September 16, 2011
By
Elements of Bayesian Econometrics

 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→...

Read more »

QTL Analysis in R

August 13, 2011
By
QTL Analysis in R

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...

Read more »

R Program Documentation Template

August 13, 2011
By
R Program Documentation Template

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

Read more »

%EXPORT_TO_R SAS Macro Code

May 6, 2011
By
%EXPORT_TO_R SAS Macro Code

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 se...

Read more »

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

May 6, 2011
By
An Intuitive Approach to ROC Curves  (with SAS & R)

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 m...

Read more »

The Budget Compromise: Mining Tweets

April 9, 2011
By
The Budget Compromise: Mining Tweets

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...

Read more »