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:
etasq(SPST1x)
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][1] 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:
etasq(SPST2x)
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.
[1]: Is ETA a good measure for computing the efect size between an ordinal and a nominal variable?