Eta / Eta-squared in R

In addition to the graphical linearity estimation (gaze-at-scatterplot method), which is used before applying any technique from the GLM family, there are several ways to make this estimate arithmetically (i.e. without graphs).

Right now I will focus on the ratio of Fisher's correlation coefficients to arithmetic: arithmetically, it is equal to the square of Pearson r (coefficient of determination: r 2 ) if the ratio between the two variables is linear, Therefore, you can compare the values ​​of eta and r and evaluate the type of relationship (linear or not). It provides information about the percent variance of the dependent variable, explained (linearly or not) by the independent variable. Therefore, you can apply it when linearity assumptions are not satisfied.

Simply put: is there a procedure for eta / eta-squared in R?

0
source share
2 answers

I'm still rather stunned, I have to admit ... there’s no simple and easy way to calculate & eta; or & eta; 2 in R... Therefore, I wrote a function on the Wikipedia page . Here:

eta <- function(x, squared = FALSE, ...) {
    stopifnot(is.list(x))
    ## unlist
    y <- unlist(x)
    ## group mean
    mg <- rapply(x, mean, ...)
    ## group size
    ng <- rapply(x, length, ...)
    ## total mean
    mtot <- mean(y, ...)
    ## SSb
    ssb <- sum(ng * (mg - mtot) ^ 2)
    ## SSt
    sst <- sum((y - mtot) ^ 2)
    # get eta-squared
    if (squared) {
      res <- ssb/sst
    # get eta
    } else {
      res <- sqrt(ssb/sst)
    }
    return(res)
}

So, this gives another question, which I am going to publish in the near future ... what do you use to check linearity? However, I cannot calculate the p-values, so if anyone knows how to do this ... please let me know!

+4
source

, "sjstats" . Eta-Squared. , .

-1

Source: https://habr.com/ru/post/1749380/


All Articles