The statistics book I am reading recommends omega squared to measure the effects of my experiments. I have already proven using a split plot design (mix of within-subjects and between-subjects design) that my within-subjects factors are statistically significant with p<0.001 and F=17.

Now I'm looking to see how big is the difference... is there an implementation of omega squared somewhere for R (or python? I know... one can dream ;) Searching on the internet for R-related stuff is a pain the *, I don't know how I manage to find stuff with C.

thanks!

  • 3
    I'm not aware of such a function, but perhaps someone could look at the formulas in Olejnik and Algina (2003) cps.nova.edu/marker/olejnik2003.pdf and write a function – Jeromy Anglim Sep 22 '10 at 5:34
  • 3
    @Jeromy Nice reference! This one is worth looking too: Recommended effect size statistics for repeated measures designs (BRM 2005 37(3)), j.mp/cT9uEQ – chl Sep 22 '10 at 6:56
  • 2
    @chl Thanks. Apparently, ezANOVA() in the ez package in R reports generalised eta squared. – Jeromy Anglim Sep 22 '10 at 7:49
up vote 3 down vote accepted

I'd suggest that generalized eta square is considered (ref, ref) a more appropriate measure of effect size. It is included in the ANOVA output in the ez package for R.

  • 3
    Actually, eta-squared is a highly positively biased statistic. It is, therefore, much worse in this situation than omega-squared, though because of its simplicity, it is more popular. – user95417 Nov 17 '15 at 19:04
  • I agree with user above. Here's a link to back it up. daniellakens.blogspot.nl/2015/06/… – Deleet Mar 15 at 4:57

A function to compute omega squared is straightforward to write. This function takes the object returned by the aov test, and calculates and returns and omega squared:

omega_sq <- function(aovm){
    sum_stats <- summary(aovm)[[1]]
    SSm <- sum_stats[["Sum Sq"]][1]
    SSr <- sum_stats[["Sum Sq"]][2]
    DFm <- sum_stats[["Df"]][1]
    MSr <- sum_stats[["Mean Sq"]][2]
    W2 <- (SSm-DFm*MSr)/(SSm+SSr+MSr)
    return(W2)
}

edit: updated function for n-way aov models:

omega_sq <- function(aov_in, neg2zero=T){
    aovtab <- summary(aov_in)[[1]]
    n_terms <- length(aovtab[["Sum Sq"]]) - 1
    output <- rep(-1, n_terms)
    SSr <- aovtab[["Sum Sq"]][n_terms + 1]
    MSr <- aovtab[["Mean Sq"]][n_terms + 1]
    SSt <- sum(aovtab[["Sum Sq"]])
    for(i in 1:n_terms){
        SSm <- aovtab[["Sum Sq"]][i]
        DFm <- aovtab[["Df"]][i]
        output[i] <- (SSm-DFm*MSr)/(SSt+MSr)
        if(neg2zero & output[i] < 0){output[i] <- 0}
    }
    names(output) <- rownames(aovtab)[1:n_terms]

    return(output)
}

I had to recently report an $\omega^2$.

partialOmegas <- function(mod){
    aovMod <- mod
    if(!any(class(aovMod) %in% 'aov')) aovMod <- aov(mod)
    sumAov     <- summary(aovMod)[[1]]
    residRow   <- nrow(sumAov)
    dfError    <- sumAov[residRow,1]
    msError    <- sumAov[residRow,3]
    nTotal     <- nrow(model.frame(aovMod))
    dfEffects  <- sumAov[1:{residRow-1},1]
    ssEffects  <- sumAov[1:{residRow-1},2]
    msEffects  <- sumAov[1:{residRow-1},3]
    partOmegas <- abs((dfEffects*(msEffects-msError)) /
                  (ssEffects + (nTotal -dfEffects)*msError))
    names(partOmegas) <- rownames(sumAov)[1:{residRow-1}]
    partOmegas
}

It is a messy function that can easily be cleaned up. It computes the partial $\omega^2$, and should probably only be used on between-subjects factorial designs.

I found an omega squared function in somebody's .Rprofile that they made available online:

http://www.estudiosfonicos.cchs.csic.es/metodolo/1/.Rprofile

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.