2
$\begingroup$

I am using multivariate models in lme4 to try to work out, quantify and compare the effects on a single outcome variable of a large group of fixed effects variables. Because the data are at week and area level, I have included these as fixed effects to avoid pseudo-replication.

So the models will look something like:

model <- lmer(salesvolume ~ var1 + var2 + var3 + 
                  var4 + var5 + var6 + var7 + 
                  var8 + var9 + (1 | week) + (1 | area), 
               data = dataset)

(Note that in some cases, some of the fixed variables may actually be interactions between other variables).

Once the model has run, I need some way of quantifying (even as an approximate estimate) the proportion of variance in salesvolume attributable to each of the fixed variables. I am aware that there are methods of estimating R squared for lmer-type objects and I am also aware that MuMIn has a way of giving separate R-squared variables for the fixed and random effects, however getting an overall R-squared estimate for fixed effects does not help me - I need to partition this for each individual fixed effect in the model.

Are there any existing packages/functions for estimating this (or any alternatives that are straightforward enough to perform, interpret and explain to non-analysts)?

(I am aware that the estimated R-squared is not necessarily the most accurate method for determining effect size of these models, however I work in a business setting and so need measures that can be easily explained to and acted upon by business executives, e.g., "variables 2, 6 and 7 all have a positive effect on sales, but variable 2 accounts for 12% of the variance in sales and variable 6 only accounts for 3%, so we should invest more in variable 2 than 6" or "A 2% increase in Y gives around a 10% increase in Z, but a 2% increase in X only gives a 1% increase in Z." Therefore whilst using complex yet highly validated statistical techniques to get a non-intuitive but highly valid measure of relative importance might not give us answers that are actually usable to the business.)

$\endgroup$
2
  • $\begingroup$ your question has no unique answer. For example, the contribution of var9 depends on which other variables (var1-var8) already in the model. So there are 256 different contribution of var9. Which one do you want? $\endgroup$
    – user158565
    Commented Aug 12, 2019 at 17:27
  • $\begingroup$ you can use this "glmm.hp"package in R cran cran.r-project.org/web/packages/glmm.hp/index.html glmm.hp(output of lme4 or nlmm) $\endgroup$ Commented Apr 3, 2022 at 2:09

2 Answers 2

3
$\begingroup$

If you standardize your variables, then the fixed effects coefficients you will tell you about the relative importance of your variables compared on the same grounds. I.e., one standard deviation increase of var1 increases salesvolume by X, whereas the same increase in var2 increases salesvolume by Y.

$\endgroup$
0
$\begingroup$

You can get the proportions of sum of squares using aov, but this assumes you have the correct model. This is almost the same as using least squares. Define all fixed effects as factors.

n=200
set.seed(123)
var1=rnorm(n,100,5)
var2=rnorm(n,300,2)
week=1:n%%7
area=1:n%%4
salesvolume=round(100+var1*20+var2*35+ifelse(week>3,150,0)+ifelse(area>2,100,0)+rnorm(n,sd=15),0)
dataset=data.frame(salesvolume,var1,var2,week,area)


TSOS=function(x)sum((x-mean(x))^2)  # sum of squares
dataset$weekf=as.factor(dataset$week)
dataset$areaf=as.factor(dataset$area)
fit.lm=lm(salesvolume ~ var1 + var2 +  weekf + areaf, data=dataset)
#summary(fit.lm)
saov=summary.aov(fit.lm)
#aov(salesvolume ~ var1 + var2 +  weekf + areaf, data=dataset)
SSQ=saov[[1]]$`Sum Sq`
names(SSQ)=rownames(saov[[1]])
TSS=TSOS(salesvolume)

data.frame(SSQ/TSS)

#> data.frame(SSQ/TSS)
#                SSQ.TSS
#var1        0.455602782
#var2        0.183044556
#weekf       0.258820190
#areaf       0.093297168
#Residuals   0.009235305

pie(SSQ)
$\endgroup$

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.