How to specify level 1 (co)variance matrices for each level 2

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
bpeterlucas
Posts: 8
Joined: Sun Jan 29, 2012 5:55 pm

How to specify level 1 (co)variance matrices for each level 2

Post by bpeterlucas »

Users -

I am conducting a 'longtitudinal' or 'repeated measures' meta-analysis.

Using summary data from multiple studies, my goal is to determine an estimate of the quadratic change in a continuous variable (blood volume) over time.

The observations I have from each study contain 3 variables:

1. time point (hours after treatment)
2. mean blood volume
3. variance (this is calculated from the total number of subjects at each point)

The number of observations (time points) varies from 1 to 6 for each study.

One method (Ishak KJ, et al. Clinical Trials 2007;4:525) is to specify the variance of each level one observation. (A recent publication using this method used SAS (Loerup et al. BMC Medicine 2019;17:167); I am hoping to use Stata/runmlwin.)

This method requires that the variance-covariance matrices of level 1 are specified. (Because only the variances at each time point are provided in the studies, I would be either setting the covariances to zero or assuming a AR1 structure.)

So my question is: is there a way to specify (co)variance matrices for EACH INDIVIDUAL level two grouping, when dealing with repeated measures in runmlwin? (In other words, not to model the matrices, but to constrain the matrices to specific values up front?)

If there is no way to do this, is there a way to weight level 1 observations? (Stata's mixed command only allows analytic weights at level 2 and above.)

Thank you.
Brian
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: How to specify level 1 (co)variance matrices for each level 2

Post by ChrisCharlton »

We think that you should be able to do this through constraining the level-1 variance. Could you however provide any further details regarding the model that you wish to fit? It would be particularly useful if you could write out the equation of your desired model in full.
bpeterlucas
Posts: 8
Joined: Sun Jan 29, 2012 5:55 pm

Re: How to specify level 1 (co)variance matrices for each level 2

Post by bpeterlucas »

Thank you for your response.

I am attempting to run a random quadratic trend model with level 2 defined by study_i and level 1 defined by aggregated blood volume measurements across several time points.

(Note that, if I had complete individual patient data, this could be a 3 level model with level 3 = study, level 2 = patient, and level 1 = blood volume measurements over time.)

I apologize if my presentation of the model is not what you expected. I will gladly present differently if needed.

Within study model
BV_ij = b_0i + b_1i(HOUR_ij) + b_2i(HOUR_ij)^2 + e_ij
i = 1 . . . k studies
j = 1 . . . ni observations (max = 6) for study i
b_0i = The studyi-specific baseline blood volume (BV).
b_1i = The studyi-specific hourly linear change in BV.
b_2i = The studyi-specific hourly quadratic change in BV.

Between study model
b_0i = β_0 + ν_0i
b_1i = β_1 + ν_1i
b_2i = β_2 + ν_2i
β_0 = The average baseline BV.
β_1 = The average hourly linear change in BV.
β_2 = The average hourly quadratic change in BV.
ν_0i = The studyi-specific deviation in baseline BV from the average baseline BV.
ν_1i = The studyi-specific deviation in hourly linear change from the average hourly linear change.
ν_2i = The studyi-specific deviation in quadratic linear change from the average hourly quadratic change.

The assumptions for this model are:
(1) The population distribution of the baseline, linear change, and quadratic change components is assumed to be multivariate normal with the typical variance-covariance matrix for level 2 random effects (with covariances between random intercepts, random linear slopes, and random quadratic slopes).

(2) The level 1 errors are normally and conditionally independently distributed in the population with zero mean and a variance that is known: the reported variances of the blood volume measurements obtained from each time point.
e_ij ~ N(0,Ω)
Ω=diag(Σ_1,Σ_1,…,Σ_k )
where Σi is the study-specific covariance matrix. The study specific covariance matrices will have variances of the aggregated blood volume measurements for each time point along the diagonals and the off-diagonals (the covariances between these aggregated blood volume timepoints) will be set to zero. (This is a simplifying assumption that I could relax based on data found from unaggregated individual patient data -- as described by Goldstein and Yang. Appl Statist 2000;49, Part 3, 399 to 412).

Thank you

I really appreciate your time and advice.

Brian Lucas
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: How to specify level 1 (co)variance matrices for each level 2

Post by ChrisCharlton »

I am passing the following on from George, who currently does not have access to a computer, so sorry if anything gets garbled in translation. You should be able to do this by setting up a two level random model with a level-1 variance function. You do this by entering a series of dummies for the variance function - one for each time point (observation), and then declare the level-1 variance function to be diagonal. Finally you constrain the level-1 variances to your desired values.

You can find examples of setting up a variance function in chapter 7 of the MLwiN User guide examples (see https://www.bristol.ac.uk/cmm/software/ ... /examples/).

You can find examples of constraining parameters in chapter 18 of this guide, although runmlwin follows the standard Stata syntax so you may find the help for that more useful (see https://www.stata.com/help.cgi?constrain).
bpeterlucas
Posts: 8
Joined: Sun Jan 29, 2012 5:55 pm

Re: How to specify level 1 (co)variance matrices for each level 2

Post by bpeterlucas »

Thanks to both of you. Extremely helpful.

One remaining issue. Below is the code that I ran successfully with RIGLS based on your advice. As you'll see, this is a two-level random linear trend model.

Each constraint define command sets a variance for an aggregated measurement for a particular time point in an individual study.

So, for example, constraint define 11 [RP1]var(e15_1_2) = 6.2 sets the variance for time point number 2 in study 15_1 to 6.2.

constraint drop _all
constraint define 2 [RP1]var(e10_1_2) = 21.2
constraint define 3 [RP1]var(e10_2_2) = 12.5
constraint define 4 [RP1]var(e11_1_2) = 11.6
constraint define 5 [RP1]var(e12_1_2) = 8.8
constraint define 6 [RP1]var(e12_2_3) = 9.4
constraint define 7 [RP1]var(e13_1_2) = 9.5
constraint define 8 [RP1]var(e13_2_2) = 8.0
constraint define 9 [RP1]var(e14_1_2) = 12.7
constraint define 10 [RP1]var(e14_1_3) = 8.9
constraint define 11 [RP1]var(e15_1_2) = 6.2
constraint define 12 [RP1]var(e15_1_3) = 6.2
constraint define 13 [RP1]var(e18_1_2) = 5.0
constraint define 14 [RP1]var(e18_1_3) = 10.8
constraint define 15 [RP1]var(e18_1_4) = 11.8
constraint define 16 [RP1]var(e18_1_5) = 11.8
constraint define 17 [RP1]var(e18_1_6) = 5.0
constraint define 18 [RP1]var(e19_1_2) = 7.6
constraint define 19 [RP1]var(e19_1_3) = 7.0
constraint define 20 [RP1]var(e19_1_4) = 6.2
constraint define 21 [RP1]var(e19_1_5) = 4.5
constraint define 22 [RP1]var(e19_1_6) = 5.0

#delimit ;
runmlwin bv_delt_pct
cons
hours
if aggr == 1
,
level2(id_aggr: hours)
level1(cons: e10_1_2
e10_2_2
e11_1_2
e12_1_2
e12_2_3
e13_1_2
e13_2_2
e14_1_2
e14_1_3
e15_1_2
e15_1_3
e18_1_2
e18_1_3
e18_1_4
e18_1_5
e18_1_6
e19_1_2
e19_1_3
e19_1_4
e19_1_5
e19_1_6
, diagonal
)
nopause
rigls
constraints(2/22)
;
#delimit cr

The remaining issue is that I would like to run this model with MCMC (instead of (R)IGLS).

So, my question is: can level 1 constraints be used with MCMC?

It appears from the runmlwin help file that the constraints() option is only available in (R)IGLS. Can the fvconstraints() option be used with MCMC to constrain the variances like above? (if so, do you have an example of this being done?)

Thank you again for your time.

Brian Lucas
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: How to specify level 1 (co)variance matrices for each level 2

Post by ChrisCharlton »

Unfortunately there is currently no way to constrain parameters using MCMC in MLwiN. The fvconstraints() is related to factor analysis (see chapter 20 of the MCMC guide).

I thought you might be able to do something similar by specifying informative priors, with the values being those you want to set the parameters to, but you also can't set priors for the level-1 (co)variance matrix. You might be able to add a pseudo level-1, and push everything up a level, but this is not something that we have investigated.

Sorry that is isn't much help.
bpeterlucas
Posts: 8
Joined: Sun Jan 29, 2012 5:55 pm

Re: How to specify level 1 (co)variance matrices for each level 2

Post by bpeterlucas »

Chris -

Even if you didn't give me answer I was hoping for, this is excellent information.

Much, much appreciated. You have saved me a lot of time trying to sort this out on my own.

Thank you.

Brian Lucas
Post Reply