I have a linear model with both continuous and categorical (>2 categories) variables. I am aware of other statistics (e.g., AIC sum of weights and lmg from R package relaimpo) that can be used to compare relative influence of predictor variables, but for various reasons cannot be used for my situation. I calculated eta squared using R package heplots (function etasq). Below is a simplified version of my slightly more complex model:

SPS_Jn5$REGION <- as.factor(SPS_Jn5$REGION)

SPST1x <- lm(PINDX ~ FChange * PLAND_42 + REGION, data = SPS_Jn5)

I get the following output for eta squared:


                 Partial eta^2
FChange            0.007043574
PLAND_42           0.158118552
REGION             0.148318074
FChange:PLAND_42   0.013788113
Residuals                   NA

However, I am not sure whether it is valid to use eta squared to compare categorical and continuous variables present in the same model, particularly because a categorical variable (with >2 categories) involves more than 1 degree of freedom. I searched online but could not find any documentation. This post states that using eta is not appropriate when ordinal and nominal data are present, but does not specifically answer my question. The R documentation for heplots does not talk about categorical variables.

I tried using eta squared by reassigning my categorical variable (REGION) as a continuous variable (the observations were region numbers so could be used as a continuous data). I got a different output:

                 Partial eta^2
FChange             0.01788473
PLAND_42            0.18224738
REGION              0.07655448
FChange:PLAND_42    0.01962085
Residuals                   NA

Here the influence of my categorical variable is obviously low. Presumably, the function was able to recognize between a categorical and a continuous variable. However, this does not either support or reject the use of eta squared for models that have both categorical (specifically >2 categories) and continuous variables. I tried to study the codes for eta squared using getAnywhere(etasq.lm) but my knowledge is not sufficient to understand the details of the code. Thank you.


2 Answers 2



^this article helps to explain eta and partial eta squared a bit more. Eta squared is intended for use with categorical independent variables and continuous DVs.

"Eta squared measures the proportion of the total variance in a dependent variable that is associated with the membership of different groups defined by an independent variable" (Richardson, 2011, p. 135)

I'm a bit turned around by your question since it almost seems the question should be is it valid to use eta squared with continuous predictors not is it valid to use it with categorical predictors.

My suggestion would be to calculate and use the betas as a means of comparing the relative influence of predictor variables. Betas help to show the strength of a predictor and can be used for comparing predictor variables in regression.


@Brittany Hite:

Be carefull not to use betas directly to assess the influence/strength of predictor variables, since they depend on the unit used to measure the variable. For example, if you want to see the influence of X1 = the height and X2 = wage on a variable Y, beta1 will be 100 times larger when X1 is measured in cm vs m, and beta2 will be 12.000 times smaller if you measure X2 with annual wage in € vs monthly wage in k€. One solution could be to normalize the data prior to regression.

  • $\begingroup$ I think the OP knows that but is interested in $\eta^2$ which your answer does not mention. $\endgroup$
    – mdewey
    Aug 8, 2022 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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