Posts Tagged ‘ R code ’

R Code for A Justification and Application of Eigenvector Centrality

November 8, 2012
By
R Code for A Justification and Application of Eigenvector Centrality

Leo Spizzirri  does an excellent job of providing mathematical intuition behind eigenvector centrality. As I was reading through it, I found it easier to just work through the matrix operations he proposes using R.  You can find his paper her...

Read more »

Do you still have time to sleep ?

June 11, 2012
By
Do you still have time to sleep ?

Last week, @3wen (Ewen) helped me to write nice R functions to extract tweets in R and build datasets containing a lot of information. I've tried a couple of time on my own. Once on tweet contents, but it was not convincing and once on the activit...

Read more »

Using SNA in Predictive Modeling

April 10, 2012
By
Using SNA in Predictive Modeling

In a previous post, I described the basics of social network analysis. I plan to extend that example here with an application in predictive analytics. Let's suppose we have the following network (visualized in R)Suppose we have used the igraph package ...

Read more »

An Introduction to Social Network Analysis with R and NetDraw

April 10, 2012
By

With the rise in the use of social media, data related to social networks is ripe for analysis using techniques from social network analysis and graph theory. According to International Network for Social Network Analysis, ‘Social network analysis is...

Read more »

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 »

Bridge and Torch problem in R

November 8, 2011
By
Bridge and Torch problem in R

A couple months ago I came across the bridge and torch problem at a careers fair in Oxford. A young tech company called QuBit used it as a brain teaser challenge for would be software engineers to solve before submitting … Continue reading →

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 »