# Monthly Archives: January 2013

## Regression tree using Gini’s index

January 27, 2013
By
$Y$

In order to illustrate the construction of regression tree (using the CART methodology), consider the following simulated dataset, > set.seed(1) > n=200 > X1=runif(n) > X2=runif(n) > P=.8*(X1<.3)*(X2<.5)+ + .2*(X1<.3)*(X2>.5)+ + .8*(X1>.3)*(X1<.85)*(X2<.3)+ + .2*(X1>.3)*(X1<.85)*(X2>.3)+ + .8*(X1>.85)*(X2<.7)+ + .2*(X1>.85)*(X2>.7) > Y=rbinom(n,size=1,P) > B=data.frame(Y,X1,X2) with one dichotomos varible (the variable of interest, ), and two continuous ones (the explanatory ones  and ). > tail(B) Y...

## Tracking Number of Historical Clusters

January 26, 2013
By

In the prior post, Optimal number of clusters, we looked at methods of selecting number of clusters. Today, I want to continue with clustering theme and show historical Number of Clusters time series using these methods. In particular, I will look at the following methods of selecting optimal number of clusters: Minimum number of clusters

## ggplot2 multiple boxplots with metadata

January 26, 2013
By

Recently I was asked for an advice of how to plot values with an additional attached condition separating the boxplots. This turns out to be ugly in base graphics, but amazingly simple in ggplot2.

## Learning R using a Chemical Reaction Engineering Book: Part 3

January 26, 2013
By
$Learning R using a Chemical Reaction Engineering Book: Part 3$

In case you missed previous parts, the links to them are listed below. Part 1 Part 2 In this part, I tried to recreate the examples in section A.2.3 of the computational appendix in the reaction engineering book (by Rawlings and … Continue reading →

## Learning R using a Chemical Reaction Engineering Book: Part 2

January 26, 2013
By
$Learning R using a Chemical Reaction Engineering Book: Part 2$

In case you missed part 1, you can view it here. In this part, I tried to recreate the examples in section A.2.2 of the computational appendix in the reaction engineering book by Rawlings and Ekerdt. Solving a nonlinear system of equations … Continue reading →

## Waiting for an API request to complete

January 26, 2013
By

Dealing with API tokens in R In my previous post I showed an example of calling the Phylotastic taxonomic name resolution API Taxosaurus here. When you query their API they give you a token which you use later to retrieve the result (see examples on their page above). However, you don't know when the query will be...

## Code Pollution With Command Prompts

January 26, 2013
By

This is not the first time I have ranted about command prompts, but I cannot help ranting about them whenever I saw them in source code. In short, a piece of source code with command prompts is like a bag of cooked shrimps in the market -- it does not make sense, and an otherwise good thing is...

## Waiting for an API request to complete

January 26, 2013
By

Dealing with API tokens in R In my previous post I showed an example of calling the Phylotastic taxonomic name resolution API Taxosaurus here. When you query their API they give you a token which you use later to retrieve the result (see examples on their page above). However, you don't know when the query will be...

## Learning R using a Chemical Reaction Engineering Book: Part 1

January 25, 2013
By
$Learning R using a Chemical Reaction Engineering Book: Part 1$

Chemical Reactor Analysis and Design Fundamentals by J.B. Rawlings and J. G. Ekerdt is a textbook for studying Chemical Reaction Engineering. The popular open source package Octave has its origins to the reaction engineering course offered by Prof. Rawlings. This book … Continue reading →