Skip to content
Prev 12441 / 20628 Next

Confidence interval for relative contribution of random effect variance

Dear all,

based on Bens suggestion (and it has come up again in another post) I made a first try in using bootMer and boot.ci.
I first defined a function that calculates the quotient of the within-subject variance (given by the variable 'ID' in my typical models) relative to the summed within-subject variance (subject is on the highest nesting level in the nested random effects that I currently use):

withinVar.fn <- function (mer.obj, subj= 'ID') {
    vars <- as.data.frame (VarCorr (mer.obj))
    vars [vars [, 'grp'] == subj, 'vcov'] / sum (vars [vars [, 'grp'] != subj, 'vcov'])
}

Then you can run the bootstrap and calculate the confidence interval:

HHbT.boot <- bootMer (HHbT.fin.lmer, withinVar.fn, nsim= 1000, parallel= 'multicore', ncpus= 2)
boot.ci (HHbT.boot, type= 'perc')

I was a bit worried about the distribution of my variable of interest being a quotient and also tried log-ing the division. At least in this example, the distribution seems even worse with the transformation and the results of the percentile confidence interval using the non-transformed quotient seems to give quite reasonable results.

Any hints to where I may have been (too) na?ve in my approach are appreciated.

Many thanks again. Regards, Lorenz