VPC in a three level random slopes model

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
Eagg1986
Posts: 14
Joined: Fri Apr 05, 2013 3:24 pm

VPC in a three level random slopes model

Post 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?
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: VPC in a three level random slopes model

Post 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
Eagg1986
Posts: 14
Joined: Fri Apr 05, 2013 3:24 pm

Re: VPC in a three level random slopes model

Post 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
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: VPC in a three level random slopes model

Post 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
Eagg1986
Posts: 14
Joined: Fri Apr 05, 2013 3:24 pm

Re: VPC in a three level random slopes model

Post by Eagg1986 »

Hi George,
Thank you so much for your help, I've done as you suggest and it works perfectly.
Elisabeth
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: VPC in a three level random slopes model

Post 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
Post Reply