Dear All,
I am trying to replicate example of multilevel approach to metaanalysis using runmlwin (http://www.ats.ucla.edu/stat/MLwiN/exam ... apter8.htm).
Please, how can I constrain the lowest level of variance to one.
Thanks.
Frank
How to constrain the lowest level variance to 1

 Posts: 4
 Joined: Sat Sep 03, 2011 4:53 pm

 Site Admin
 Posts: 412
 Joined: Fri Apr 01, 2011 2:14 pm
Re: How to constrain the lowest level variance to 1
Dear Frank,
Consider the first model presented in:
http://www.ats.ucla.edu/stat/mlwin/exam ... apter8.htm
To replicate this model using runmlwin you need the following
where:
(1) the replace command is used to correct a data error in the original data (Study 17 was mistakenly given an ID of 16 rather than 17)
(2) we use Stata's constraint define command to constrain the level1 variance to a value of one
(3) we use constraints(1) option of the runmlwin command to attach the constraint to the model.
One oddity that we hope to fix in a later release is that we have had to use the mlwinsettings(size(100)) option to manually tell MLwiN how big a worksheet it will need. Normally runmlwin works out how big a worksheet you need and there is no need for a manual override. Here you do need to manually override here due to the unusual dimensions of the worksheet (there is a very high ratio of variables to observations).
If you fit this model you should see the following output
Let us know how you get on with replicating the other models
Best wishes
George
Consider the first model presented in:
http://www.ats.ucla.edu/stat/mlwin/exam ... apter8.htm
To replicate this model using runmlwin you need the following
Code: Select all
use "http://www.ats.ucla.edu/stat/stata/examples/mlm_ma_hox/meta20", clear
replace study = 17 if _n==17
constraint define 1 [RP1]var(stderr) = 1
generate cons = 1
generate stderr = sqrt(varofd)
runmlwin d cons, ///
level2(study: cons) ///
level1(d: stderr) ///
constraints(1) ///
mlwinsettings(size(100)) ///
nopause
(1) the replace command is used to correct a data error in the original data (Study 17 was mistakenly given an ID of 16 rather than 17)
(2) we use Stata's constraint define command to constrain the level1 variance to a value of one
(3) we use constraints(1) option of the runmlwin command to attach the constraint to the model.
One oddity that we hope to fix in a later release is that we have had to use the mlwinsettings(size(100)) option to manually tell MLwiN how big a worksheet it will need. Normally runmlwin works out how big a worksheet you need and there is no need for a manual override. Here you do need to manually override here due to the unusual dimensions of the worksheet (there is a very high ratio of variables to observations).
If you fit this model you should see the following output
Code: Select all
. use "http://www.ats.ucla.edu/stat/stata/examples/mlm_ma_hox/meta20", clear
.
. replace study = 17 if _n==17
(1 real change made)
.
. constraint define 1 [RP1]var(stderr) = 1
.
. generate cons = 1
.
. generate stderr = sqrt(varofd)
.
. runmlwin d cons, ///
> level2(study: cons) ///
> level1(d: stderr) ///
> constraints(1) ///
> mlwinsettings(size(100)) ///
> nopause
( 1) [RP1]var(stderr) = 1
MLwiN 2.24 multilevel model Number of obs = 20
Normal response model
Estimation algorithm: IGLS

 No. of Observations per Group
Level Variable  Groups Minimum Average Maximum
+
study  20 1 1.0 1

Run time (seconds) = 1.23
Number of iterations = 4
Log likelihood = 13.899582
Deviance = 27.799164

d  Coef. Std. Err. z P>z [95% Conf. Interval]
+
cons  .5790381 .1049019 5.52 0.000 .3734342 .7846419


Randomeffects Parameters  Estimate Std. Err. [95% Conf. Interval]
+
Level 2: study 
var(cons)  .1315565 .0692808 .0042314 .2673444
+
Level 1: d 
var(stderr)  1 0 1 1

Best wishes
George
*************************
George Leckie
runmlwin developer
Centre for Multilevel Modelling
*************************
George Leckie
runmlwin developer
Centre for Multilevel Modelling
*************************

 Posts: 4
 Joined: Sat Sep 03, 2011 4:53 pm
Re: How to constrain the lowest level variance to 1
Dear George,
Thanks for the prompt and for sending the code. That is exactly what I am looking for you. Please, I run the code, I got the following error message:
estimates post: matrix has missing values
Warning  runmlwin has experienced difficulties importing the standard errors, all standard errors have been set to zero
Warning: getversion plugin could not be loaded
I am using
 Stata 12/IC
 MLwiN 2.24
 runmlwin.ado, George Leckie and Chris Charlton, 01Dec2011
Thanks
Frank Peter
Thanks for the prompt and for sending the code. That is exactly what I am looking for you. Please, I run the code, I got the following error message:
estimates post: matrix has missing values
Warning  runmlwin has experienced difficulties importing the standard errors, all standard errors have been set to zero
Warning: getversion plugin could not be loaded
I am using
 Stata 12/IC
 MLwiN 2.24
 runmlwin.ado, George Leckie and Chris Charlton, 01Dec2011
Thanks
Frank Peter
Code: Select all
use "http://www.ats.ucla.edu/stat/stata/examples/mlm_ma_hox/meta20", clear
. replace study = 17 if _n==17
(1 real change made)
. constraint define 1 [RP1]var(stderr) = 1
. generate cons = 1
. generate stderr = sqrt(varofd)
. runmlwin d cons, ///
> level2(study: cons) ///
> level1(d: stderr) ///
> constraints(1) ///
> mlwinsettings(size(100)) ///
> nopause
( 1) [RP1]var(stderr) = 1
estimates post: matrix has missing values
Warning  runmlwin has experienced difficulties importing the standard errors, all standard errors have been set to zero
Warning: getversion plugin could not be loaded
MLwiN ... multilevel model Number of obs = 20
Normal response model
Estimation algorithm: IGLS

 No. of Observations per Group
Level Variable  Groups Minimum Average Maximum
+
study  20 1 1.0 1

Run time (seconds) = 2.75
Number of iterations = 4
Log likelihood = 13.899582
Deviance = 27.799164

d  Coef. Std. Err. z P>z [95% Conf. Interval]
+
cons  .5790381 0 . . .5790381 .5790381


Randomeffects Parameters  Estimate Std. Err. [95% Conf. Interval]
+
Level 2: study 
var(cons)  .1315565 0 .1315565 .1315565
+
Level 1: d 
var(stderr)  1 0 1 1

.
end of dofile

 Site Admin
 Posts: 412
 Joined: Fri Apr 01, 2011 2:14 pm
Re: How to constrain the lowest level variance to 1
Hi Peter,
Apologies, the current release version of runmlwin (which you are using) has a small bug relating to the standard errors of model parameters when constraints are used.
We have fixed this on our development version and I will email you a copy of this so you can proceed with your analysis.
The next release of runmlwin will be out early January. If anyone else wants the bug fixed version before then, please contact me.
Best wishes
George
Apologies, the current release version of runmlwin (which you are using) has a small bug relating to the standard errors of model parameters when constraints are used.
We have fixed this on our development version and I will email you a copy of this so you can proceed with your analysis.
The next release of runmlwin will be out early January. If anyone else wants the bug fixed version before then, please contact me.
Best wishes
George
*************************
George Leckie
runmlwin developer
Centre for Multilevel Modelling
*************************
George Leckie
runmlwin developer
Centre for Multilevel Modelling
*************************

 Posts: 4
 Joined: Sat Sep 03, 2011 4:53 pm
Re: How to constrain the lowest level variance to 1
Hi George,
Thanks for the prompt reply. It worked fine.
Peter
Thanks for the prompt reply. It worked fine.
Peter