Stats raving mad

The blog

R> if (done=TRUE) tweet me!

by M. Parzakonis on December 11, 2009

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 will illustrate the situation above using some [...]

Create factor variables in R

by M. Parzakonis on December 7, 2009

Instead of the factor() function which usually applies after defining a vector there’s the gl() base function to do this in one step, eg freq <- c(204,6,1,211,13,5,357,44,38,92,34,49) row <- gl(4,3,length=12) col <- gl(3,1,length=12) > col [1] 1 2 3 1 2 3 1 2 3 1 2 3 Levels: 1 2 3 tt <- data.frame(freq,row,col) [...]

Confidence we seek…

by M. Parzakonis on November 18, 2009

Estimating a proportion at first looks elementary. Hail to aymptotics, right? Well, initially it might seem efficient to iuse the fact that $$\frac{\hat{p}-p}{\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}} \tilde {} N(0,1)$$. 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<- function(x,n,level){ phat<-sum(x)/n [...]

Show me the mean(ing)…

by M. Parzakonis on November 5, 2009

Well testing a bunch of samples for the largest population mean isn’t that common yet a simple test is at hand. Under the obvious title “The rank sum maximum test for the largest K population means” the test relies on the calculation of the sum of ranks under the combined sample of size $latex {{nk}}$, [...]