constraints for multilevel ordinal response model

Welcome to the forum for MLwiN users. Feel free to post your question about MLwiN software 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!

Remember to check out our extensive software FAQs which may answer your question: http://www.bristol.ac.uk/cmm/software/s ... port-faqs/
Post Reply
schillsg99
Posts: 11
Joined: Sat Mar 09, 2013 6:11 pm

constraints for multilevel ordinal response model

Post by schillsg99 »

The question I am trying to ask on the user forum concerns setting constraints on variance parameters. I have a 3 level random effects model where the response varialbe is ordered multinomial. The 3 levels are teacher, time and item. Teacher and time are defined as simple random effects. I wish to constrain the variance parameter associated with teacher to 1. When I get the constraint window I fill it out as follows.



My I filled it out as follows
teach1_long:cnst.12/cnst 1
time1_long:cnst.12/cnst 0
to equal 1

Store constraint matrix for random parameters in c117

However, when I say attach random constraints I get the following message.

wrong length random constraint matrix
(RCON)

How do I proceed.
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: constraints for multilevel ordinal response model

Post by ChrisCharlton »

When you set up an ordered multinomial model an extra hidden parameter (see the output of the RAND command) is added to allow estimation. This is not currently taken into account by the constraints window. In order to do this you would have to edit the generated commands to take this into account, i.e. add an extra 0 before the final 1 in the JOIN command and reissue the RCON command. As this has not come up before I suspect that random part constraints for this type of model have not been tested much, so you will need to make sure that your results look sensible.
schillsg99
Posts: 11
Joined: Sat Mar 09, 2013 6:11 pm

Re: constraints for multilevel ordinal response model

Post by schillsg99 »

I tried the following

JOIN 1 0 0 1 C118
RCON C118

but the constraints were not applied. The estimated variance component was 0.153, not 1.0.
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: constraints for multilevel ordinal response model

Post by ChrisCharlton »

In order to fit this model the discrete response macros add their own constraint, which it appears is replacing rather than adding to the one that you have specified. You can confirm this by using the SETT command to see the column that is currently being used for specifying the constraints. The only way that I can see of getting around this is to modify the macros to add in your additional constraint too (see BVAR.MC and NOBVAR.MC in the multicat subdirectory where you installed MLwiN). Sorry I can't provide a better answer.
schillsg99
Posts: 11
Joined: Sat Mar 09, 2013 6:11 pm

Re: constraints for multilevel ordinal response model

Post by schillsg99 »

I think that you are exactly right. When I do SETT I get
RCONstraints in c1488 .

However when I look at the macro bvar.mc, I don't see how it sets that column for the constraints.

I do see b4 and cb4. Does cb4 refer to b4? Is b4 actually c1488?

Any thoughts?

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

Re: constraints for multilevel ordinal response model

Post by ChrisCharlton »

Yes, cb4 will refer to c1488 because of the line:

Code: Select all

rcon b4
The MLwiN help for this command says:
RCON <box> Output the number of the current constraints column to <box>. If no constraints are specified, attach the last unused column on the worksheet to the model as a constraints column and return the column number <box>.
The constraints column will therefore be stored in the box b4 and cb4 will then be the column with the number stored in this box (in your case c1488).

I assume that the constraints are being cleared somewhere else previously, otherwise this command should have put the column that you defined into this box. This appears to happen in nobvar.mc due to the following command:
RCON (with no parameters) Remove any active set of constraints from the random part of the model.
schillsg99
Posts: 11
Joined: Sat Mar 09, 2013 6:11 pm

Re: constraints for multilevel ordinal response model

Post by schillsg99 »

Then the issue is where I can join my constraints to the already existing constraints?

Here's where I think the relevant code is from BVAR.MC

case 1:
note ordered multinomial
switch b9
case :
note 1st iter constrain (p=mvar)
count c1096 b201
switch b201
case 0:
put 1 0.1 c1096
set b201 1
ends
put b201 0 cb4
edit b201 cb4 1
join cb4 1 cb4
leave
ends
Would I add

join 1 0 0 1 cb4

after the last join statement?

Then do I need to do anything to nobvar.mc?

For example do I need to do anything to rcon and eras cb4 in the code below?

case 1:
note ordered multinomial
switch b9
case : note any iteration so erase constraints
rcon
eras cb4
leave
ends
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: constraints for multilevel ordinal response model

Post by ChrisCharlton »

You would want to keep the constraints that the macro has created too, so I suspect that the command you want to add after the existing join is:

Code: Select all

join cb4 1 0 0 1 cb4
It looks like nobvar.mc is only called on the first iteration, or if you have asked for extra-multinomial variation, so I think that you probably shouldn't need to make any changes to that file.
schillsg99
Posts: 11
Joined: Sat Mar 09, 2013 6:11 pm

Re: constraints for multilevel ordinal response model

Post by schillsg99 »

Thanks so much!

That worked!
Post Reply