Welsh test by permutations

November 1, 2009

(This article was first published on [R] tricks, and kindly contributed to R-bloggers)

WelshPerm <- function(response,variable,nperm=999,...){

base <- oneway.test(response~variable,...)

base.p <- base$p.value
base.W 	<- base$statistic

count <- 1

# Permutation loop
for(i in 1:nperm){

	SAMPLE <- sample(response)

	welsh.perm.W<-welsh.perm$statistic 	if(abs(welsh.perm.W) >= abs(base.W)) {count <- count+1}

To leave a comment for the author, please follow the link and comment on his blog: [R] tricks.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.