Tag: R

Train neural network in R, predict in SAS

This R code fits an artificial neural network in R and generates Base SAS code, so new records can be scored entirely in Base SAS. This is intended to be a simple, elegant, fast solution. You don’t need SAS Enterprise Miner, IML, or any other spe…

What 5,728.986 miles look like…

Time Series as calendar heat maps + All of my running data since April 1, 2009 = Generated by the following code: #Sample Code based on example program at: source(file = “calendarHeat.R”) run<- read.csv(“log.csv”, header = TRUE, sep=”,”) sum(run$Distance) date <- c() for (i in 1: dim(run)[1]){ if(run$DistanceUnit[i]== ‘Kilometer’){ miles <- c(miles,run$Distance[i] * 0.62) } […]

Another Mystery: sas7bdat != sd2

I received an email from a very inconvenienced statistician a few weeks ago. The problem was an old data file with the extension .sd2. Apparently, this is an obsolete data storage format used by past versions of SAS. A quick glance at the file contents revealed that this sd2 formatted file is incompatible with the […]

Model decision tree in R, score in SAS

This code creates a decision tree model in R using party::ctree() and prepares the model for export it from R to SAS, so SAS can score new records without invoking R. I use this method for several reasons. First, it’s convenient for my workflow t…

Obtain Trace of the Projection Matrix in a Linear Regression

Recently, I am working on coding in SAS for a set of regularized regressions and need to compute trace of the projection matrix:
$$ S=X(X’X + \lambda I)^{-1}X’ $$.

Wikipedia has a well written introduction to Trace @ here.

To obtain the inverse of …

Obtain Trace of the Projection Matrix in a Linear Regression

Recently, I am working on coding in SAS for a set of regularized regressions and need to compute trace of the projection matrix:
S=X(X’X + \lambda I)^{-1}X’.

Trace of the project matrix S is a key concept in modern regression analysis. For example, …

Obtain Trace of the Projection Matrix in a Linear Regression

Recently, I am working on coding in SAS for a set of regularized regressions and need to compute trace of the projection matrix:
S=X(X’X + \lambda I)^{-1}X’.

Wikipedia has a well written introduction to Trace @ here.

Trace of the project matrix S i…

StackExchange and CrossValidated: An Epidemiologist’s Review

This seems like as good a day as any to review CrossValidated, and the whole StackExchange constellation of websites. It’s been a month since I joined, exactly, and today I also crossed the 1,000 reputation threshold on the site. So why not give my impressions of it? First, how I got there in the first […]