Hi all,
I am running a longitudinal model on an outcome that was measured and scored using a 1PL IRT model (Rasch). For each observation of the outcome, there is an associated standard error of measurement (SEM). Is it possible to fix or constrain the residual variance in a MLwiN model (via runmlwin or R2MLwiN) based on the SEM (I would use SEM^2)? I know this is doable in the HLM program, but I would much prefer to do this analysis in MLwiN.
Thanks,
Erik
Is it possible to constrain the residual variance in MLwiN?

 Posts: 1282
 Joined: Mon Oct 19, 2009 10:34 am
Re: Is it possible to constrain the residual variance in MLwiN?
runmlwin follows the Stata syntax for defining constraints. See this previous post from George for some details:
viewtopic.php?t=773
For another example using runmlwin and R2MLwiN see Chapter 18 of the MLwiN User Guide replication examples:
runmlwin: https://www.bristol.ac.uk/cmm/software/ ... /examples/
R2MLwiN: https://www.bristol.ac.uk/cmm/software/ ... /examples/
viewtopic.php?t=773
For another example using runmlwin and R2MLwiN see Chapter 18 of the MLwiN User Guide replication examples:
runmlwin: https://www.bristol.ac.uk/cmm/software/ ... /examples/
R2MLwiN: https://www.bristol.ac.uk/cmm/software/ ... /examples/
Re: Is it possible to constrain the residual variance in MLwiN?
Hi George,
Thanks so much.
In the example you linked, the residual variance was set at a single value (scalar).
I would like to set the residual variance to a variable in the dataset given that the SEM is unique to each observation in the data.
Doing so gives me the following error:
Is it that I need to create a vector defined by the sem? Sorry if my terminology is off.
Thanks so much.
In the example you linked, the residual variance was set at a single value (scalar).
Code: Select all
constraint define 1 [RP1]var(cons) = 0.5
Code: Select all
constraint define 1 [RP1]var(cons) = sem
Code: Select all
. runmlwin RIT time_a time_asq coho2 timea_coho2 timeasq_coho2 cons , level2(STUDENT_GRD_KEY: cons time_a time_asq) level
> 1(obs2: cons) nopause constraints(1) sd corr
(note: constraint number 1 caused error r(111))
matrix e(Cns) not found
r(111);

 Posts: 1282
 Joined: Mon Oct 19, 2009 10:34 am
Re: Is it possible to constrain the residual variance in MLwiN?
Sorry, I misunderstood that you wanted to constrain the residual error variance rather than the residual variances themselves.
I had a brief discussion with George about this and he thinks that it might be possible through adding a pseudo level1 for your s.e. measurements with a variance constrained to one. It would however be useful if you could provide the example that you have for doing this with HLM so that we can confirm the approach taken.
I had a brief discussion with George about this and he thinks that it might be possible through adding a pseudo level1 for your s.e. measurements with a variance constrained to one. It would however be useful if you could provide the example that you have for doing this with HLM so that we can confirm the approach taken.

 Site Admin
 Posts: 432
 Joined: Fri Apr 01, 2011 2:14 pm
Re: Is it possible to constrain the residual variance in MLwiN?
Hi Erik,
This would be my guess at what you want to do...
Think you want to specify a threelevel model. So shift the usual twolevel growthcurve model up to level2 and level3
Observations (level1) within observations (level2) within persons (level3)
Then at the new level1 you enter the constrained variance.
First make sure you have a variable in your dataset which stores the SEs associated with the predicted scores from the IRT model
Then make this variable random at level1
Then constrain the variance of this variable to equal 1.
So something like...
. constraint define [RP1]var(sevariable) = 1
. runmlwin y cons time, level3(person: cons time) level2(obs: cons) level1(obs: sevariable) constraints(1)
You mention that you can do what you want in HLM. If there is an example dataset and output floating about on the net it would be good you first trying to replicate that to check that the above approach works. Actually, if you pass on the reference we will try to take a look too.
Best wishes
George
This would be my guess at what you want to do...
Think you want to specify a threelevel model. So shift the usual twolevel growthcurve model up to level2 and level3
Observations (level1) within observations (level2) within persons (level3)
Then at the new level1 you enter the constrained variance.
First make sure you have a variable in your dataset which stores the SEs associated with the predicted scores from the IRT model
Then make this variable random at level1
Then constrain the variance of this variable to equal 1.
So something like...
. constraint define [RP1]var(sevariable) = 1
. runmlwin y cons time, level3(person: cons time) level2(obs: cons) level1(obs: sevariable) constraints(1)
You mention that you can do what you want in HLM. If there is an example dataset and output floating about on the net it would be good you first trying to replicate that to check that the above approach works. Actually, if you pass on the reference we will try to take a look too.
Best wishes
George
Re: Is it possible to constrain the residual variance in MLwiN?
Thanks, Chris and George.
George, I am having trouble locating a web example from HLM. My colleague said that that it involves the fixsigma2 command (setting it to 1) and then specifying a "varianceknown" variable. Below is a snippet of code from a HLM syntax file. It looks like something similar as you proposed is going on. I cannot find information on the varianceknown command in HLM's documentation.
Regarding your suggestion, is the obs variable specified for level2 and level1 the same variable?
Although the suggested model runs, the random slope(s), covariance(s) between the random slope(s) and intercept, and the level2 observation variance are not estimated.
George, I am having trouble locating a web example from HLM. My colleague said that that it involves the fixsigma2 command (setting it to 1) and then specifying a "varianceknown" variable. Below is a snippet of code from a HLM syntax file. It looks like something similar as you proposed is going on. I cannot find information on the varianceknown command in HLM's documentation.
Code: Select all
fixsigma2:1.000000
fixtau2:3
fixtau3:3
accel:5
level1weight:none
level2weight:none
level3weight:none
varianceknown:SEM2
Although the suggested model runs, the random slope(s), covariance(s) between the random slope(s) and intercept, and the level2 observation variance are not estimated.