code

Autocorrelation Matrix in R

December 25, 2010 | ramhiser

I have been simulating a lot of data lately  with various covariance (correlation) structures, and one that I have been using is the autocorrelation (or autoregressive) structure, where there is a “lag” between variables. The matrix is a v-dimension matrix of the form $$\begin{bmatrix} 1 & \rho & \rho^2 & \dots & \rho^{v-1}\\ \... [Read more...]

Pretty R code in the blog

November 5, 2010 | arthur charpentier

David Smith (alias @revodavid, see also on the Revolutions blog, here) pointed out that my R code was not easy to read (not only due to my computing skills, but mainly because of the typography I use). He suggested that I use the Pretty R tool (her... [Read more...]

Correlation scatter-plot matrix for ordered-categorical data

April 7, 2010 | Tal Galili

When analyzing a questionnaire, one often wants to view the correlation between two or more Likert questionnaire item’s (for example: two ordered categorical vectors ranging from 1 to 5). When dealing with several such Likert variable’s, a clear presentation of all the pairwise relation’s between our variable can be ... [Read more...]

A von Mises variate…

March 25, 2010 | M. Parzakonis

Inspired from a mail that came along the previous random generation post the following question rised : How to draw random variates from the Von Mises distribution? First of all let’s check the pdf of the probability rule, it is , for . Ok, I admit that Bessels functions can be a ... [Read more...]

The distribution of rho…

March 21, 2010 | M. Parzakonis

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(... [Read more...]

\pi day!

March 14, 2010 | M. Parzakonis

It’s π-day today so we gonna have a little fun today with Buffon’s needle and of course R. A well known approximation to the value of $latex \pi$ is the experiment tha Buffon performed using a needle of length,$latex l$. What I do in the next is ... [Read more...]

A quicky..

February 22, 2010 | M. Parzakonis

If you’re (and you should) interested in principal components then take a good look at this. The linked post will take you by hand to do everything from scratch. If you’re not in the mood then the dollowing R functions will help you. An example. # Generates sample matrix ... [Read more...]

Post hoc analysis for Friedman’s Test (R code)

February 22, 2010 | Tal Galili

My goal in this post is to give an overview of Friedman’s Test and then offer R code to perform post hoc analysis on Friedman’s Test results. (The R function can be downloaded from here) Preface: What is Friedman’s Test Friedman test is a non-parametric randomized block ...
[Read more...]

The truncated Poisson

February 21, 2010 | M. Parzakonis

A common model for counts data is the Poisson. There are cases however that we only record positive counts, ie there is a truncation of 0. This is the truncated Poisson model. To study this model we only need the total counts and the sample size. This comes from the sufficient ... [Read more...]

Uh!

February 20, 2010 | M. Parzakonis

Didn't know this... a data 0 2 4 7+ 25 34 12 5 It's becoming clear that I have learned R in the most unstructured way...I always do it in two stages :ashamed: [Read more...]

R> if (done=TRUE) tweet me!

December 11, 2009 | Manos Parzakonis

Let’s say that you’re fitting a cumbersome model so time is not to waste over a PC staring at the screen half anxious-half bored… Then, you can always leave and go on with meetings and all your daily routine and have R notify you the results! How? We ... [Read more...]

Tactical asset allocation using blotter

November 18, 2009 | Joshua Ulrich

blotter is an R package that tracks the P&L of your trading systems (or simulations), even if your portfolio spans many security types and/or currencies. This post uses blotter to track a simple two-ETF trading system. The contents of this post b... [Read more...]

Confidence we seek…

November 18, 2009 | Manos Parzakonis

Estimating a proportion at first looks elementary. Hail to aymptotics, right? Well, initially it might seem efficient to iuse the fact that . In other words the classical confidence interval relies on the inversion of Wald’s test. A function to ease the computation is the following (not really needed!). waldci [Read more...]
1 2 3

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)