Monthly Archives: March 2010

Converting Siemens MOSAIC

March 21, 2010
By
Converting Siemens MOSAIC

Siemens multi-slice EPI data may be collected as a "mosiac" image; i.e., all slices acquired in a single TR (repitition time) of a functional MRI run are stored in a single DICOM file.  The images are stored in an MxN array of images.  The function create3D() will try to guess the number of images embedded within the single DICOM...

Read more »

R: Add vertical line to a plot

March 21, 2010
By

If you have a plot open and want to add a vertical line to it: abline(v=20) #Add vertical line at x=20

Read more »

The distribution of rho…

March 21, 2010
By
The distribution of rho…

There was a post here about obtaining non-standard p-values for testing the correlation coefficient. The R-library SuppDists deals with this problem efficiently. library(SuppDists) plot(function(x)dPearson(x,N=23,rho=0.7),-1,1,ylim=c(0,10),ylab="density") plot(function(x)dPearson(x,N=23,rho=0),-1,1,add=TRUE,col="steelblue") plot(function(x)dPearson(x,N=23,rho=-.2),-1,1,add=TRUE,col="green") plot(function(x)dPearson(x,N=23,rho=.9),-1,1,add=TRUE,col="red");grid() legend("topleft", col=c("black","steelblue","red","green"),lty=1, legend=c("rho=0.7","rho=0","rho=-.2","rho=.9"))</pre> This is how it looks like, Now, let’s construct a table of critical values for some arbitrary or not significance levels. q=c(.025,.05,.075,.1,.15,.2) xtabs(qPearson(p=q, N=23, rho

Read more »

My Experience at ACM Data Mining Camp #DMcamp

March 21, 2010
By
My Experience at ACM Data Mining Camp #DMcamp

My parents and I made plans to visit San Jose and Saratoga on my grandmother’s birthday, March 19, since that is where she grew up. I randomly saw someone tweet about the ACM Data Mining Camp unconference that happened to be the next day, March 20, only a couple of miles from our hotel in Santa Clara. This was...

Read more »

R: Geometric mean

March 21, 2010
By

gm(x) But this requires package heR.Misc so you might as well just use: exp(mean(log(x)))

Read more »

Returns on Easter week and one week after

March 21, 2010
By
Returns on Easter week and one week after

Inspired by CXO group report, I did a rerun of the same strategy on my data. Easter’s dates can be find at wikipedia. Overall, my results are similar to CXO group’s results. In the graph below, I plotted daily returns on Easter week (Monday to Thursday) from 1982 to 2009. I prefer this way of showing

Read more »

R annoyances

March 20, 2010
By

Readers returning to our blog will know that Win-Vector LLC is fairly “pro-R.” You can take that to mean “in favor or R” or “professionally using R” (both statements are true). Some days we really don’t feel that way. Consider the following snippet of R code where we create a list with a single element Related posts:

Read more »

R: remove all objects fromt he current workspace

March 20, 2010
By

rm(list = ls())

Read more »

Package Releases

March 20, 2010
By
Package Releases

I just put a new version of the XML package on the Omegahat repository. There is a new version of the RKML package which handles large datasets much more rapidly. Also, I put a new package named RJSCanvasDevice which implements and R graphics device that creates JavaScript code that can be subsequently display on a

Read more »

R: Backwards for loop

March 20, 2010
By

for (i in 10:1) { print(i) } As easy as that.

Read more »