## Building R packages for Windows when you don’t use it.

May 2, 2011
By

Are you a non-windows user wanting to share your R package with others who do use windows? There's a handy utility (http://win-builder.r-project.org/)that allows you to upload your .tar.gz file and it checks it, builds it, and sends you a link to downl...

## Building R packages for Windows when you don’t use it.

May 2, 2011
By

Are you a non-windows user wanting to share your R package with others who do use windows? There's a handy utility (http://win-builder.r-project.org/)that allows you to upload your .tar.gz file and it checks it, builds it, and sends you a link to downl...

## "Inside" Functors — Evaluating things more than once

May 1, 2011
By

(The examples here work with the version of insidefunctor tagged as "v1") I ran into an interesting problem using "inside" functors. Something is wrong in the following code (well, depending on what you thought it should do). > library(insidefunctor) > %+.% = fmap(+) > x = seq(0, 10, len = 50) > plot(x,...

## The R Inferno revised

May 1, 2011
By

Hell is new and improved. The R Inferno has been revised.  If you don’t know of it, it is a short explanation of a few trouble spots when using the R language.  Somehow the short explanation grew to approach book-length. It can be found at the usual place: http://www.burns-stat.com/pages/Tutor/R_inferno.pdf Major improvements An index has been … Continue reading...

## Here comes the sun

The solar irradiance incident outside the earth’s atmosphere is called the extraterrestial or extra-atmospheric irradiance. It is derived from the solar constant only with geometric equations. It can be easily calculated with the calcSol function of the solaR package. With this post I will show an example with some packages from the Spatial task view.

## Bayesian Confidence Intervals: Obama’s ‘That’-Addition and Informality

May 1, 2011
By
$Bayesian Confidence Intervals: Obama’s ‘That’-Addition and Informality$

No “That” Left Behind? I came across a post on Language Log last week giving some evidence that Obama tends to add that to the prepared version of his speeches. For example, in a recent speech at George Washington University, … Continue reading →

## Some rediscovered R scripts from spring cleaning

May 1, 2011
By

Gompertz Model Visualization # Gomperz growth function gomp <- function(x, a, b, k) a*exp(-b*exp(-k*x))   # Normal model with Gompertz mean function likelihood <- function(weight, age, sigma, a, b, k) { mu <- gomp(age, a, b, k) dnorm(weight, mu, sigma) }   # Visualize the model visualize <- function(phi=40, theta=-35) { weight <- seq(0, 250,

## Schelling’s Neighborhood Model

April 30, 2011
By

The New York Times has created a beautiful visualization of the Census Bureau's 2005-2009 American Community Survey data. The distribution of racial and ethnic groups in New York City is particularly fascinating:Chinatown appears in red toward the sou...

## Produce Authentic Math Formulas in R Graphics

April 30, 2011
By

I remember a few weeks ago, there was a challenge in the R-help list to make the prime symbol in R graphics. In LaTeX, we simply write $X'$ or $X^\prime$. R has a rough support for math expressions (see demo(plotmath)) and they are certainly unsatisfactory for LaTeX users. In fact we can write native LaTeX

## Filtering for English Tweets: Unsupervised Language Detection on Twitter

April 30, 2011
By

(See a demo here.) While working on a Twitter sentiment analysis project, I ran into the problem of needing to filter out all non-English tweets. (Asking the Twitter API for English-only tweets doesn’t seem to work, as it nonetheless returns tweets in Spanish, Portuguese, Dutch, Russian, and a couple other languages.) Since I didn’t have any...

April 30, 2011
By

About a year ago I was reading Godel, Escher, Bach by Douglas Hofstadter. In a section on recursion he presents a sequence that he calls "A Chaotic Sequence" defined as:Q(n) = Q(n - Q(n - 1)) + Q(n - Q(n - 2)) for n > 2Q(1) = Q(2) =1It's sim...

## Visualizing Terrain Surface Indicies with Scaled Arrows

April 30, 2011
By

Hamish Bowman recently posted a new GRASS module (d.barb) that can be used to depict the direction and magnitude components of some vector (e.g. wind field) along a raster surface or at points in space. An example (c/o Hamish): read more

## Bootstrap Confidence Intervals for Diversity Indices

April 30, 2011
By

Here's the bootstrap refinement of the normal asymptotic interval (Mills and Zandvakili, 1997; Dixon et al., 1987; Efron and Tibshirani, 1997) - where Diversity (div, g) is the Simpson Index calculated from the observed sample, k is the number boot...

## Produce Authentic Math Formulas in R Graphics

April 30, 2011
By

I remember a few weeks ago, there was a challenge in the R-help list to make the prime symbol in R graphics. In LaTeX, we simply write $X'$ or $X^\prime$. R has a rough support for math expressions (see demo(plotmath)) and they are certainly unsatisfac...

## Friday function triple bill: with vs. within vs. transform

April 29, 2011
By

When you first learnt about data frames in R, I’m sure that, like me, you thought “This is a lot of hassle having to type the names of data frames over and over in order to access each column”. library(MASS) anorexia$wtDiff <- anorexia$Postwt - anorexia\$Prewt #I have to type anorexia how many times? Indeed, any

## Another Use of LSPM in Tactical Portfolio Allocation

April 29, 2011
By

After the slightly unconventional use of LSPM presented in Slightly Different Use of Ralph Vince’s Leverage Space Trading Model, I thought I should follow up with something that more closely resembles my interpretation of Ralph Vince’s book. LSPM s...

## Rcpp Workshop slides

April 29, 2011
By

Dirk and I gave a full day Rcpp workshop yesterday in Chicago before the R in Finance conference. The pdfs of the slides are available here: part 1 (intro), part 2 (details), part 3 (modules) and part 4 (applications)

## Rcpp Workshop slides

April 29, 2011
By

Dirk and I gave a full day Rcpp workshop yesterday in Chicago before the R in Finance conference. The pdfs of the slides are available here: part 1 (intro), part 2 (details), part 3 (modules) and part 4 (applications)

## Parallelizing and cross-validating feature selection in R

April 29, 2011
By

This is an example piece of code for the Overfitting competition at kaggle.com. This method has an AUC score of ~.91, which is currently good enough for about 38th place on the leaderboard. If you read the completion forums closely, you will find code...

## Gartner: Revolution Analytics a "Cool Vendor" for BI

April 29, 2011
By

Leading analyst firm Gartner has just published its "Cool Vendors in Analytics and Business Intelligence" report for 2011 (download it here if you have a Gartner subscription). In the report, Revolution Analytics is named a Gartner Cool Vendor, and recognizes the company as "innovative, impactful and intriguing": Driven in part by the rise of big data, business intelligence (BI)...

## RStudio is good for you

April 29, 2011
By

I was recently introduced to RStudio, a new integrated development environment for R, it is just amazing! It is free, and open, compatible with PC/Mac/Linux OSs. You can also choose to run it in the cloud, and access it from your favorite web browser. As you can see, the window divides into four in a

## Example 8.36: Quadratic equation with real roots

April 29, 2011
By

We often simulate data in SAS or R to confirm analytical results. For example, consider the following problem from the excellent text by Rice:Let U1, U2, and U3 be independent random variables uniform on . What is the probability that the roots...

## Slides from Rcpp workshop / master class yesterday

April 29, 2011
By

Romain and I just posted our slides from yesterday's Rcpp workshop and class (preceding the now-ongoing R/Finance conference). You can access the slides via my presentation page, or directly from here as Part 1 (Introduction), Part 2 (Details), Part ...

## Forming Formulas

April 29, 2011
By

One of the first functions a new R user learns how to use is the lm() command, which involves stating the model formula.lm(y~x1+x2, data=mydata)After a while, this just becomes a natural way to say "I want a regression of y on x1 and x2 using mydata." ...

## Forming Formulas

April 29, 2011
By

One of the first functions a new R user learns how to use is the lm() command, which involves stating the model formula.lm(y~x1+x2, data=mydata)After a while, this just becomes a natural way to say "I want a regression of y on x1 and x2 using mydata." ...

## RStudio

April 29, 2011
By

As has been discussed on various blogs the RStudio interface to R has been released. It is definitely worth checking out as it has the potential to improve the user experience for R.

## ggplot2 – First impressions

April 29, 2011
By

I was reading various R blogs and saw very nice looking plots created with ggplot2 package. Especially this blog was useful because of link to a very interesting book about ggplot2. I want to display and update the latest co-integrated pairs every day ...

## Easy way to get yield curve : what you need is only "FRBData" package !

April 28, 2011
By

I made FRBData package and registerd it on CRAN.This package allow you to download financial data from FRB's website.This website provide many economical data such as consumer credit, money stock.This article show you how to use this package.(But, it has only a function about interest rate now.　I will create other functions to download other macro-economical data in next version.)First,...