Page 1 of 1

Three level ordinal analysis

Posted: Thu Apr 11, 2013 11:43 am
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

Re: Three level ordinal analysis

Posted: Fri Apr 12, 2013 11:01 am
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

Re: Three level ordinal analysis

Posted: Mon Apr 22, 2013 8:08 am
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

Re: Three level ordinal analysis

Posted: Mon Apr 22, 2013 9:03 am
by GeorgeLeckie
Dear Miguel,

You are very welcome

Best wishes

George