# Posts Tagged ‘ R code ’

## R Code for A Justification and Application of Eigenvector Centrality

November 8, 2012
By

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

## Do you still have time to sleep ?

June 11, 2012
By

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

## Using SNA in Predictive Modeling

April 10, 2012
By

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

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

## Regression via Gradient Descent in R

November 27, 2011
By

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

## Basic Econometrics in R and SAS

November 27, 2011
By

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

November 27, 2011
By

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

## Bridge and Torch problem in R

November 8, 2011
By

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 →

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

September 17, 2011
By

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

## Elements of Bayesian Econometrics

September 16, 2011
By

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