Monthly Archives: March 2013

Third Milano R net meeting to be held on April 18, 2013

March 12, 2013
By

Third Milano R net meeting April 18, 2013 @ 6.00 PM Fiori Oscuri Bistrot & Bar Via Fiori Oscuri, 3 Milano Further details will be published shortly. Stay connected!

Read more »

How to use optim in R

March 12, 2013
By
How to use optim in R

A friend of mine asked me the other day how she could use the function optim in R to fit data. Of course there are functions for fitting data in R and I wrote about this earlier. However, she wanted to understand how to do this from scratch using optim. The function optim provides algorithms for general...

Read more »

Generating a multivariate gaussian distribution using RcppArmadillo

March 12, 2013
By
Generating a multivariate gaussian distribution using RcppArmadillo

There are many ways to simulate a multivariate gaussian distribution assuming that you can simulate from independent univariate normal distributions. One of the most popular method is based on the Cholesky decomposition. Let’s see how Rcpp and Armadillo perform on this task. #include <RcppArmadillo.h> // ] using namespace Rcpp; // ] arma::mat mvrnormArma(int n, arma::vec mu, arma::mat sigma) { int ncols...

Read more »

Generating a multivariate gaussian distribution using RcppArmadillo

March 12, 2013
By
Generating a multivariate gaussian distribution using RcppArmadillo

There are many ways to simulate a multivariate gaussian distribution assuming that you can simulate from independent univariate normal distributions. One of the most popular method is based on the Cholesky decomposition. Let’s see how Rcpp and Armadillo perform on this task. #include <RcppArmadillo.h> // ] using namespace Rcpp; // ] arma::mat mvrnormArma(int n, arma::vec mu, arma::mat sigma) { int ncols...

Read more »

High Resolution Figures in R

March 12, 2013
By
High Resolution Figures in R

As I was recently preparing a manuscript for PLOS ONE, I realized the default resolution of R and RStudio images are insufficient for publication. PLOS ONE requires 300 ppi images in TIFF or EPS (encapsulated postscript) format. In R plots … Continue reading →

Read more »

R 101

March 11, 2013
By

as.character() is your friendas.character() is your friend Sometimes when you open a data file (lets say a .csv), variables will be recognized as factor whereas it should be numeric. It is therefore tempting to simply convert the variable to numeric using as.numeric(). Big mistake! If...

Read more »

Simulating Random Multivariate Correlated Data (Categorical Variables)

March 11, 2013
By
Simulating Random Multivariate Correlated Data (Categorical Variables)

This is a repost of the second part of an example that I posted last year but at the time I only had the PDF document (written in ). This is the second example to generate multivariate random associated data. This example shows how to generate ordinal, categorical, data. It is a little more complex than generating continuous

Read more »

Interview with Boulder BI Brain Trust

March 11, 2013
By

On Friday I traveled to Boulder, CO to update the Boulder BI Brain Trust on the latest news and updates from Revolution R Enterprise. While I was there, I was interviewed by BBBT president Claudia Imhoff. In a wide-ranging chat, we discussed: What's behind the Revolution Analytics momentum over the past year? How Business Intelligence relates to Data Science...

Read more »

Simulating Allele Counts in a population using R

March 11, 2013
By
Simulating Allele Counts in a population using R

This post is inspired by the Week 7 lectures of the Coursera course "Introduction to Genetics and Evolution" (I highly recommend this course for anyone interested in genetics, BTW.) Professor Noor uses a Univ Washington software called AlleleA1 for try...

Read more »

Reproducible Research at ENAR

March 11, 2013
By

I gave a talk at the Spring ENAR meetings this morning on some of the technical aspects of creating the book. The session was on reproducible research and the slides are here. I was dinged for not using git for version control (we used dropbox for simp...

Read more »