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
Three level ordinal analysis
-
- Site Admin
- Posts: 432
- Joined: Fri Apr 01, 2011 2:14 pm
Re: Three level ordinal analysis
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
IN TERMS OF YOUR THREE-LEVEL MODEL
You specified
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
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
I hope this helps
George
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))
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))
"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
George
Re: Three level ordinal analysis
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
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
-
- Site Admin
- Posts: 432
- Joined: Fri Apr 01, 2011 2:14 pm
Re: Three level ordinal analysis
Dear Miguel,
You are very welcome
Best wishes
George
You are very welcome
Best wishes
George