Page 1 of 1

VPC in a three level random slopes model

Posted: Fri Oct 04, 2013 2:55 pm
by Eagg1986
Hi there,
I am running a three-level growth curve with a random slope of age. I'm unsure whether the VPC should contain just the variance around the constant terms at each level, as follows:
display [RP2]var(cons)/([RP3]var(cons) + [RP2]var(cons) + [RP1]var(cons))

But should the random slope at level 2 also be included in calculations of the VPC?

Re: VPC in a three level random slopes model

Posted: Fri Oct 04, 2013 4:19 pm
by GeorgeLeckie
Hi,

This is more a general multilevel modelling question rather than one specific to runmlwin

Basically the VPC formula is now more complex and is a function of any covariates with random coeficients (here cons and age)

Please see the following article for details

Goldstein, H., Browne, W., & Rasbash, J. (2002). Partitioning variation in multilevel models. Understanding Statistics: Statistical Issues in Psychology, Education, and the Social Sciences, 1, 223-231.

Best wishes

George

Re: VPC in a three level random slopes model

Posted: Tue Oct 08, 2013 1:33 pm
by Eagg1986
Hi George,
Thank you very much for the advice and reference. Is it possible to supply syntax to calculate the VPC with random effects of the constant and age? This is not included in the runmlwin journal article so I'm struggling with how to calculate this.
Many thanks,
Elisabeth

Re: VPC in a three level random slopes model

Posted: Tue Oct 08, 2013 2:10 pm
by GeorgeLeckie
Hi Elizabeth,

Suppose you fitted a two-level random-slope model to repeated measures data

Code: Select all

. runmlwin outcome cons time, level2(individual: cons time) level1(occasion: cons)
You would then generate the level-1 and level-2 variance functions as follows

Code: Select all

. generate l2varfn = [RP2]var(cons) +  2*[RP2]cov(cons\time)*time + [RP2]var(time)*time^2
. generate l1varfn = [RP1]var(cons)
Dividing the level-2 variance function by the total variance function gives the level-2 VPC function

Code: Select all

. generate l2vpc = l2varfn/(l2varfn + l1varfn)
You can then graph the level-2 VPC as a function of time

Code: Select all

. line l2vpc time
The extension to three-levels is straight foward. You would simply have three variance functions, one for each level. You can calculate the VPC function at any level by dividing the corresponding variance function by the total variance function.

I hope that helps

George

Re: VPC in a three level random slopes model

Posted: Wed Oct 09, 2013 12:23 pm
by Eagg1986
Hi George,
Thank you so much for your help, I've done as you suggest and it works perfectly.
Elisabeth

Re: VPC in a three level random slopes model

Posted: Wed Oct 09, 2013 1:14 pm
by GeorgeLeckie
That's great news, and well done on extending the example from the two-level case to your three-level case
Best wishes
George