Creating an R package, using developer/productivity tools

October 27, 2011
By
Creating an R package, using developer/productivity tools

Couple of R programming (mainly infrastructure/workflow) related topics discussed at the Los Angeles R users group in a tutorial/demo-like form (targeted mainly to beginners) by Szilard Pafka and Jeroen Ooms: how easy it is to create a simple package for … Continue reading →

Read more »

Building diversified portfolios with R

October 27, 2011
By
Building diversified portfolios with R

A common approach to reducing risk associated with financial portfolios is diversification. A portfolio made of components that are all highly correlated with each other -- a portfolio composed solely of financial stocks, for example -- is risky, because if there's a wide-spread crisis that affects the banking sector, all components of the portfolio will tank at once, together....

Read more »

Predictability of stock returns : Using acf()

October 27, 2011
By
Predictability of stock returns : Using acf()

In my previous post, I employed a rather crude and non-parametric approach to see if I could predict the direction of stock returns using the function runs.test(). Lets go a step further and try modelling this with a parametric econometric approach. The company that I choose for the study is INFOSYS (NSE code INFY). Lets start...

Read more »

Copy all the files in a directory to a new directory using R

October 27, 2011
By

Someone asked me how to move a directory full of files from one place to another using R.  The easiest way I've found is as follows (where "oldpath" is the existing directory and "newpath" is the new directory):file.copy(list.files(oldpath),newpath) Tags: R

Read more »

Copy all the files in a directory to a new directory using R

October 27, 2011
By
Copy all the files in a directory to a new directory using R

Someone asked me how to move a directory full of files from one place to another using R.  The easiest way I've found is as follows (where "oldpath" is the existing directory and "newpath" is the new directory):file.copy(list.files(oldpath),newpath)

Read more »

A New Dimension to Principal Components Analysis

October 27, 2011
By
A New Dimension to Principal Components Analysis

In general, the standard practice for correcting for population stratification in genetic studies is to use principal components analysis (PCA) to categorize samples along different ethnic axes.  Price et al. published on this in 20...

Read more »

The Most Diversified or The Least Correlated Efficient Frontier

October 27, 2011
By
The Most Diversified or The Least Correlated Efficient Frontier

The “Minimum Correlation Algorithm” is a term I stumbled at the CSS Analytics blog. This is an Interesting Risk Measure that in my interpretation means: minimizing Average Portfolio Correlation with each Asset Class for a given level of return. One might try to use Correlation instead of Covariance matrix in mean-variance optimization, but this approach,

Read more »

RStudio Update

October 27, 2011
By
RStudio Update

With R 2.14 slated to be released next week we wanted to encourage everyone planning to upgrade to also update to the latest release of RStudio (v0.94.110). For R 2.14 users this release includes tweaks related to compatibility with the R 2.14 graphics engine as well as compatibility with the new parallel package. There are

Read more »

Two new rOpenSci R packages are on CRAN

October 27, 2011
By
Two new rOpenSci R packages are on CRAN

Carl Boettiger, a graduate student at UC Davis, just got two packages on CRAN.  One is treebase, which which handshakes with the Treebase API.  The other is rfishbase, which connects with the Fishbase, although I believe just scrapes XML cont...

Read more »

Computing on the Language

October 27, 2011
By

And now for something a bit more esoteric…. I recently wrote a function to deal with a strange problem. Writing the function ended up being a fun challenge related to computing on the R language itself. Here’s the problem: Write a function that tak...

Read more »

Introduction to “Numerical Methods and Optimization in Finance”

October 27, 2011
By
Introduction to “Numerical Methods and Optimization in Finance”

The book is by Manfred Gilli, Dietmar Maringer and Enrico Schumann.  I haven’t actually seen the book, so my judgement of it is mainly by the cover (and knowing the first two authors). The parts of the book closest to my heart are optimization, particularly portfolio optimization, and particularly particularly portfolio optimization via heuristic algorithms.  … Continue reading...

Read more »

R Cookbook with examples

October 27, 2011
By
R Cookbook with examples

An R Cookbook can be found at http://code.ca-net.org/R%20Cookbook. It is a short web document presenting dozens of examples on - Accessing Database with packages RSQLite, RMySQL, RdbiPgSQL and RODBC; - Reading and Writing Data; - Date/Time variable; - Graphics; - … Continue reading →

Read more »

Copy all the files in a directory to a new directory using R

October 27, 2011
By

Someone asked me how to move a directory full of files from one place to another using R.  The easiest way I've found is as follows (where "oldpath" is the existing directory and "newpath" is the new directory):   file.copy(list.files(oldpath),newpath)   Tags:  R

Read more »

Shoe Consumption in the U.S. – GGPlot2 #1

October 26, 2011
By
Shoe Consumption in the U.S. – GGPlot2 #1

  This is the first in a series of blog posts in which I use the R package GGPlot2 to examine real world data. In this post, I construct a line graph of U.S. shoe consumption from 1995 to 2007. A recent survey conducted by Shop Smart magazine found that the average woman in the

Read more »

Netflix Post-mortem – How to detect Bubbles

October 26, 2011
By
Netflix Post-mortem – How to detect Bubbles

Bubbles. I’m no expert in behavioral economics, but bubbles seem to be well understood (after they occur) although they seem hard to detect (at least in the eyes of outsiders and late bubble participants). This post won’t tell you how to avoid bubbles, but might give you some insight. I came across Minsky’s explanation of

Read more »

Mixed-Effects Models in R with Quantum Forest

October 26, 2011
By

For anyone who wants to estimate linear or nonlinear mixed-effects models (aka random-effects models, hierarchical models or multilevel models) using the R language, the Quantum Forest blog has several recent posts that will be of interest. Written by Luis Apiolaza from the School of Forestry at the University of Canterbury in New Zealand, the blog includes a number of...

Read more »

What do your rules look like? editrules 1.8-x answers with the help of igraph

October 26, 2011
By
What do your rules look like? editrules 1.8-x answers with the help of igraph

We (Edwin de Jonge and me) have recently updated our editrules package. The most important new features include (beta) support for categorical data. However, in this post I'm going to show some visualizations we included, made possible by Gabor Csardi's … Continue reading →

Read more »

How to display R code on a web page

October 26, 2011
By

Starting to write a blog I need a way how to publish my R codes. One possibility would be to just add some formatting with Pretty R. Nice, but I miss a repository with all codes ever submitted and possibility to make corrections.The final solution was ...

Read more »

Covariance structures

October 26, 2011
By
Covariance structures

In most mixed linear model packages (e.g. asreml, lme4, nlme, etc) one needs to specify only the model equation (the bit that looks like y ~ factors...) when fitting simple models. We explicitly say nothing about the covariances that complete … Continue reading →

Read more »

Two-sex demographic models in R

October 26, 2011
By
Two-sex demographic models in R

Tom Miller (a prof here at Rice) and Brian Inouye have a paper out in Ecology (paper, appendices) that confronts two-sex models of dispersal with empirical data.They conducted the first confrontation of two-sex demographic models with empirical data on...

Read more »

Controlling multiple risk measures during construction of efficient frontier

October 26, 2011
By
Controlling multiple risk measures during construction of efficient frontier

In the last few posts I introduced Maximum Loss, Mean-Absolute Deviation, and Expected shortfall (CVaR) and Conditional Drawdown at Risk (CDaR) risk measures. These risk measures can be formulated as linear constraints and thus can be combined with each other to control multiple risk measures during construction of efficient frontier. Let’s examine efficient frontiers computed

Read more »

PAWL package on CRAN

October 26, 2011
By
PAWL package on CRAN

The PAWL package (which I talked about there, and which implements the parallel adaptive Wang-Landau algorithm and adaptive Metropolis-Hastings for comparison) is now on CRAN! http://cran.r-project.org/web/packages/PAWL/index.html which means that within R you can easily install it by typing install.packages("PAWL") Isn’t that amazing? It’s just amazing. Kudos to the CRAN team for their quickness and their

Read more »

New features in R-bloggers.com

October 26, 2011
By
New features in R-bloggers.com

Hello dear R community, In the past few months I have rolled out a bunch of new features to R-bloggers, and I wanted to raise awareness to them.  Please consider giving some of these a try and leave me any feedback that you have (by leaving a comment on this post): Comments – it is now possible to leave comments in...

Read more »

Batch Processing vs. Interactive Sessions

October 26, 2011
By
Batch Processing vs. Interactive Sessions

We introduced batch processing 3 weeks ago. Many people asked about differences and benefits of batch processing or interactive sessions. Lets start with the definitions: Batch Processing / Batch Jobs: Batch processing is the execution of a series of programs or only one task on a computer environment without manual intervention. All data and commands

Read more »

Machine Learning Ex 5.2 – Regularized Logistic Regression

October 25, 2011
By
Machine Learning Ex 5.2 – Regularized Logistic Regression

Now we move on to the second part of the Exercise 5.2, which requires to implement regularized logistic regression using Newton's Method. Plot the data:

Read more »

treebase package on cran

October 25, 2011
By
treebase package on cran

My treebase package is now up on the CRAN repository. (Source code is up, the binaries should appear soon). Here’s a few introductory examples to illustrate some of the functionality of the package. Thanks in part to new data deposition requirements at journals such as Evolution, Am Nat, and Sys Bio, and data management plan

Read more »

The Psychology of Music and the ‘tuneR’ Package

October 25, 2011
By

Introduction This semester I’m TA’ing a course on the Psychology of Music taught by Phil Johnson-Laird. It’s been a great course to teach because (i) so much of the material is new to me and (ii) because the study of the psychology of music brings together so many of the intellectual tools I enjoy, including

Read more »

"Anyone planning to work with Big Data ought to learn Hadoop and R"

October 25, 2011
By

Dan Woods at Forbes interviewed LinkedIn's Daniel Tunkelang about the rise of data science and on building data science teams. When asked how students today should prepare themselves to be data scientists, Tunkelang gives some good advice: When we built the data science team at LinkedIn a few years ago, we looked for raw talent, assuming that smart people...

Read more »

Catching up faster by switching sooner

October 25, 2011
By
Catching up faster by switching sooner

Here is our discussion (with Nicolas Chopin) of the Read Paper of last Wednesday by T. van Erven, P. Grünwald and S. de Rooij (Centrum voor Wiskunde en Informatica, Amsterdam), entitled Catching up faster by switching sooner: a predictive approach to adaptive estimation with an application to the Akaike information criterion–Bayesian information criterion dilemma. It

Read more »