Three level ordinal analysis

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
migsanse
Posts: 15
Joined: Sat Apr 06, 2013 9:17 am

Three level ordinal analysis

Post by migsanse »

Hi,
I am using runmlwin to run a three-level longitudinal model (area>individual>repeated observation) with a ordinal outcome (1-4). I am able to run the three level model when the outcome variable (Qint) is continuous or a two level model with the ordinal outcome but NOT the three level model. Suggestions?
Outcome: Qint
Level 3: samsstr (area)
Level 2: id (individual)
Level 1: occasion

I run
reshape long Qint, i(id) j(occasion) (should I include the area?)
It works when the outcome is continuous
runmlwin Qint cons, level3(samsstr: cons) level2(id: cons) level1(occasion: cons) nopause (This works well, Qint continuous)

It works when the outcome is ordinal but two levels:
sort id occasion occasion
runmlwin Qintcat4r cons, level2(id: (cons, contrast(1/3))) level1(occasion:) discrete(dist(multinomial) link(ologit) denom(cons) basecategory(4)) nopause

But when I want to do the three levels, it give an error:
sort samsstr id occasion occasion
runmlwin Qintcat4r cons, level3(samsstr: cons) level2(id: (cons, contrast(1/3))) level1(occasion:) discrete(dist(multinomial) link(ologit) denom(cons) basecategory(4))

The error says: IDEN 2 ´occasion´. Unexpanded level 2 ide column(occasion) must not contain consecutive repeated codes, in multivariate or multinomial models. Use the GENErate command to create unique id codes.

Thanks in advance,
Miguel
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Three level ordinal analysis

Post by GeorgeLeckie »

Dear Miguel,

IN TERMS OF YOUR RESHAPE QUESTION

Sound like you initially have one row per individual and the repeated response measursments on each individual are stored in a series of columns.

So yes, do include area when you are reshaping the data from wide to long format

Code: Select all

reshape long Qint, i(area id) j(occasion)

IN TERMS OF YOUR THREE-LEVEL MODEL

You specified

Code: Select all

. runmlwin Qintcat4r cons, ///
    level3(samsstr: cons) ///
    level2(id: (cons, contrast(1/3))) ///
    level1(occasion:) ///
    discrete(dist(multinomial) link(ologit) denom(cons) basecategory(4))
First note, that you have got an extra ) in line three which you should remove.

This gives separate area effects for each log-odds contrast

At least initially, you properly want to start by specifying a common area effect in each log-odds contrast. In which case, the syntax you want is

Code: Select all

. runmlwin Qintcat4r cons, ///
    level3(samsstr: cons, contrast(1/3)) ///
    level2(id: (cons, contrast(1/3)) ///
    level1(occasion:) ///
    discrete(dist(multinomial) link(ologit) denom(cons) basecategory(4))
IN TERMS OF YOUR ERROR MESSAGE

"IDEN 2 ´occasion´. Unexpanded level 2 ide column(occasion) must not contain consecutive repeated codes, in multivariate or multinomial models. Use the GENErate command to create unique id codes."

Sounds like the level-1 variable occasion needs to uniquely identify the level-1 observations. So, immediately before you fit the model, replace occasion with

Code: Select all

. sort samsstr id occaions
. replace occaions = _n
I hope this helps

George
migsanse
Posts: 15
Joined: Sat Apr 06, 2013 9:17 am

Re: Three level ordinal analysis

Post by migsanse »

Dear George,
sorry for the delay reply. It works, thanks , especially the error given.
Take the opportunity to congratulate you for facilitating the work to non-statatistician like me.
Regards,
Miguel
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Three level ordinal analysis

Post by GeorgeLeckie »

Dear Miguel,

You are very welcome

Best wishes

George
Post Reply