Search

Friday, September 15, 2006

How to compute min-F

Here's how to compute minF in R. You have to give the function the F1 and F2 values and the denominator dfs for each: minf(f1,f2,n1,n2).

minf <- function(f1,f2,n1,n2){
fprime <- (f1*f2)/(f1+f2)
n <- round(((f1+f2)*(f1+f2))/(((f1*f1)/n2)+((f2*f2)/n1)))
return(paste("minF(",n,")=",round(fprime,digits=2),", crit=",round(qf(.95,1,n)),sep=""))
}

If there are any mistakes here, corrections are welcome.

References: Raaijmakers' 1999 and 2003 articles.

Monday, February 13, 2006

Sweave introduction

Sweave is a package that comes with R, and can be used to interleave LaTeX and R code. Here's how I use it:

(I'm assuming you've got R installed on your machine.)

1. Download the bash script Sweave.sh from here. Install it in your bin directory, and be sure to change the first line to reflect the location of your bash.

2. Download the file Sweave-test-1.Rnw into a temporary directory.

3. cd to that directory and now run the script on this file:
Sweave.sh Sweave-test-1.Rnw. If all goes well, you have a .tex file Sweave-test-1.tex.

4. Compile the .tex file in whatever way is usual for you. The Sweave FAQ is a must-read.