1 Ordinal Models
Jan 19, 2018
1
Ordinal Models
2
Ordinal Models
• Estimating gender-specific LLCA with repeated ordinal data
• Examining the effect of time invariant covariates on class membership
• The effect of class membership on a later outcome
3
The data
• 5 repeated measures of bedwetting• 4½, 5½, 6½ ,7½ & 9½ yrs
• 3-level ordinal– Dry– Infrequent wetting (< 2 nights/week)– Frequent wetting (2+ nights/week)
4
4 time point ordinal LLCA (Boys)title: 4 time point LLCA of ordinal bedwetting; data: file is 'C:\Work\bedwet_dsm4_llca\spss\llca_dsm4.txt';
listwise is ON;
variable:
names ID sex nwet_kk2 nwet_kk3 nwet_kk4 nwet_kk5
nwet_km2 nwet_km3 nwet_km4 nwet_km5 nwet_kp2 nwet_kp3 nwet_kp4 nwet_kp5 nwet_kr2 nwet_kr3 nwet_kr4 nwet_kr5 nwet_ku2 nwet_ku3 nwet_ku4 nwet_ku5;
categorical = nwet_kk3 nwet_km3 nwet_kp3 nwet_kr3 nwet_ku3; usevariables nwet_kk3 nwet_km3 nwet_kp3 nwet_kr3 nwet_ku3; missing are nwet_kk3 nwet_km3 nwet_kp3 nwet_kr3 nwet_ku3 (999);
classes = c (4);
useobservations (sex==1);
5
RESULTS IN PROBABILITY SCALELatent Class 1
NWET_KK3 Category 1 0.190 0.030 6.430 0.000 Category 2 0.672 0.033 20.134 0.000 Category 3 0.138 0.026 5.409 0.000 NWET_KM3 Category 1 0.224 0.038 5.929 0.000 Category 2 0.727 0.036 20.254 0.000 Category 3 0.048 0.019 2.533 0.011 NWET_KP3 Category 1 0.160 0.045 3.540 0.000 Category 2 0.823 0.044 18.613 0.000 Category 3 0.017 0.011 1.473 0.141 NWET_KR3 Category 1 0.075 0.064 1.178 0.239 Category 2 0.903 0.061 14.686 0.000 Category 3 0.022 0.011 1.929 0.054 NWET_KU3 Category 1 0.456 0.054 8.486 0.000 Category 2 0.532 0.052 10.269 0.000 Category 3 0.012 0.008 1.501 0.133
6
RESULTS IN PROBABILITY SCALELatent Class 1
NWET_KK3 Category 1 0.190 0.030 6.430 0.000 Category 2 0.672 0.033 20.134 0.000 Category 3 0.138 0.026 5.409 0.000 NWET_KM3 Category 1 0.224 0.038 5.929 0.000 Category 2 0.727 0.036 20.254 0.000 Category 3 0.048 0.019 2.533 0.011 NWET_KP3 Category 1 0.160 0.045 3.540 0.000 Category 2 0.823 0.044 18.613 0.000 Category 3 0.017 0.011 1.473 0.141 NWET_KR3 Category 1 0.075 0.064 1.178 0.239 Category 2 0.903 0.061 14.686 0.000 Category 3 0.022 0.011 1.929 0.054 NWET_KU3 Category 1 0.456 0.054 8.486 0.000 Category 2 0.532 0.052 10.269 0.000 Category 3 0.012 0.008 1.501 0.133
Dry
Infrequent wetting
Frequent wetting
7
Alternative 1 – three dimensions• A 3D plot…
or something made out of plasticine
8
Alternative 2 – two figures
0
0.2
0.4
0.6
0.8
1
NWET_KK5 NWET_KM5 NWET_KP5 NWET_KR5 NWET_KU50
0.2
0.4
0.6
0.8
1
NWET_KK5 NWET_KM5 NWET_KP5 NWET_KR5 NWET_KU5
Infrequent bedwetting Frequent bedwetting
9
Alternative 3 – two figures
0
0.2
0.4
0.6
0.8
1
NWET_KK5 NWET_KM5 NWET_KP5 NWET_KR5 NWET_KU5
Any bedwetting Frequent bedwetting
0
0.2
0.4
0.6
0.8
1
NWET_KK5 NWET_KM5 NWET_KP5 NWET_KR5 NWET_KU5
10
Alternative 3 – two figures
0
0.2
0.4
0.6
0.8
1
NWET_KK5 NWET_KM5 NWET_KP5 NWET_KR5 NWET_KU5
Any bedwetting Frequent bedwetting
0
0.2
0.4
0.6
0.8
1
NWET_KK5 NWET_KM5 NWET_KP5 NWET_KR5 NWET_KU5
(1) A persistent wetting group who mostly wet to a frequent level
(2) A persistent wetting group who mostly wet to an infrequent level
(3) A delayed group comprising mainly infrequent wetters
(4) Normative group
11
Fit statistics - Boys
Boys Girls
# class # parms BIC BLRT Entropy BIC BLRT Entropy
4 43 15055.5 < 0.001 0.841 10173.4 < 0.001 0.883
5 54 15029 < 0.001 0.849 10211.9 0.032 0.893
6 65 15074 0.312 0.842 10267.6 0.76 0.899
7 76 15130.9 0.646 0.838 10344.1 1 0.91
12
5-class model (boys)
0
0.2
0.4
0.6
0.8
1
kk km kp kr ku0
0.2
0.4
0.6
0.8
1
kk km kp kr ku
Any bedwetting Frequent bedwetting
13
5-class model (boys)• Normative (63.8%)
– Mild risk of infrequent wetting at start which soon disappears• Delayed-infrequent (18.2%)
– Delayed attainment of nighttime bladder control but rarely attains frequent levels
• Persistent-infrequent (11.4%)– Persistent throughout period but rarely attains frequent levels
• Persistent-frequent (4.0%)– Persistently and frequently until late into period. Appears to be turning into
lower frequency wetting however over 80% are still wetting to some degree at 9.5yr
• Delayed-frequent (2.7%)– Frequent wetting until half-way through time period, reducing to a lower level
of wetting which appears to be clearing up by 9.5yr
14
Fit statistics – Girls – Oh!
Boys Girls
# class # parms BIC BLRT Entropy BIC BLRT Entropy
4 43 15055.5 < 0.001 0.841 10173.4 < 0.001 0.883
5 54 15029 < 0.001 0.849 10211.9 0.032 0.893
6 65 15074 0.312 0.842 10267.6 0.76 0.899
7 76 15130.9 0.646 0.838 10344.1 1 0.91
15
Fit statistics – Girls – Oh!
Boys Girls
# class # parms BIC BLRT Entropy BIC BLRT Entropy
4 43 15055.5 < 0.001 0.841 10173.4 < 0.001 0.883
5 54 15029 < 0.001 0.849 10211.9 0.032 0.893
6 65 15074 0.312 0.842 10267.6 0.76 0.899
7 76 15130.9 0.646 0.838 10344.1 1 0.91
16
6-class model (girls)
0
0.2
0.4
0.6
0.8
1
kk km kp kr ku0
0.2
0.4
0.6
0.8
1
kk km kp kr ku
Any bedwetting Frequent bedwetting
17
6-class model (girls)• Normative (78.6%)• Delayed-infrequent (11.7%)• Persistent-infrequent (4.6%)• Persistent-frequent (1.6%)• Delayed-frequent (1.3%)
• Relapse (2.0%)– Initial period of dryness followed by a return to infrequent wetting
18
Incorporating covariates
• 2-stage method• Export class probabilities to another package –
Stata• Model class membership as a multinomial model
with probability weighting
• Using classes derived from repeated BW measures with partially missing data (gloss over)
19
Multinomial models (boys)
label values class class_labellabel define class_label /// 1 "Pers INF [1]" /// 2 "DelayFRQ [2]" /// 3 "Normal [3]" /// 4 "Pers FRQ [4]" /// 5 "DelayINF [5]", addtab class
foreach var of varlist bedwet_m bedwet_p […] toilet {tab `var' if class==1xi: mlogit class `var' [iw = boy_weights], rrr test `var'}
20
Typical outputMultinomial logistic regression Number of obs = 5004 LR chi2(4) = 85.09 Prob > chi2 = 0.0000Log likelihood = -5256.9295 Pseudo R2 = 0.0080
------------------------------------------------------------------------------ class | RRR Std. Err. z P>|z| [95% Conf. Interval]-------------+----------------------------------------------------------------Pers INF [1] | bedwet_m | 2.456404 .3459902 6.38 0.000 1.863829 3.237378-------------+----------------------------------------------------------------DelayFRQ [2] | bedwet_m | 3.019243 .6958002 4.79 0.000 1.921915 4.743095-------------+----------------------------------------------------------------Pers FRQ [4] | bedwet_m | 3.795014 .6783016 7.46 0.000 2.673461 5.387073-------------+----------------------------------------------------------------DelayINF [5] | bedwet_m | 1.540813 .2046864 3.25 0.001 1.18761 1.999062------------------------------------------------------------------------------(class==Normal [3] is the base outcome)
( 1) [Pers INF [1]]bedwet_m = 0 ( 2) [DelayDSM [2]]bedwet_m = 0 ( 3) [Pers DSM [4]]bedwet_m = 0 ( 4) [DelayINF [5]]bedwet_m = 0
chi2( 4) = 91.87, Prob > chi2 = 0.0000
21
Selection of covariates (boys)Measure Delay INF Pers INF Delay DSM Pers DSM Chi, p
Mum history of BW 1.54[1.19, 2.00]
2.46[1.86, 3.24]
3.02[1.92, 4.74]
3.8[2.67, 5.39]
91.9,< 0.001
Dad history of BW 1.32[0.97, 1.79]
1.48[1.04, 2.12]
2.14[1.21, 3.78]
2.34[1.47, 3.73]
20.7,< 0.001
Development at 18mn 1.06[0.99, 1.13]
1.05[0.96, 1.14]
1.27[1.08, 1.48]
1.21[1.07, 1.37]
17.9,0.001
Development at 42mn 1.07[0.99, 1.15]
1.17[1.07, 1.28]
1.16[0.98, 1.37]
1.27[1.11, 1.46]
23.3,< 0.001
Birthweight 1[0.93, 1.07]
0.99[0.91, 1.08]
0.97[0.84, 1.13]
0.98[0.87, 1.11]
0.22,0.995
Gestational age 1.01[0.94, 1.09]
0.98[0.89, 1.07]
0.89[0.75, 1.05]
0.93[0.81, 1.06]
3.52,0.475
Maternal age 1.11[1.02, 1.21]
1.1[0.99, 1.23]
1.23[1.00, 1.51]
1.02[0.87, 1.19]
10.0,0.041
Maternal education 1.1[1.04, 1.16]
1.11[1.04, 1.19]
1.12[0.99, 1.27]
0.99[0.90, 1.09]
21.4,< 0.001
22
What if we had used modal-class?
• The further the posterior probabilities for class assignment are from 1 (i.e. the lower the entropy) the poorer the estimates from a model using the modal class
• In this example (partial missing data)– entropy = 0.788
1 2 3 4 5 1 0.800 0.011 0.017 0.020 0.153 2 0.063 0.804 0.000 0.069 0.064 3 0.008 0.001 0.923 0.000 0.068 4 0.049 0.104 0.004 0.813 0.030 5 0.110 0.009 0.170 0.006 0.706
23
Estimates using mod classDelay INF Pers INF Delay FRQ Pers FRQ Chi, p
Weighted model
Mum history of BW 1.54[1.19, 2.00]
2.46 [1.86, 3.24]
3.02 [1.92, 4.74]
3.8 [2.67, 5.39] 91.9, < 0.001
Dad history of BW 1.32 [0.97, 1.79]
1.48 [1.04, 2.12]
2.14 [1.21, 3.78]
2.34 [1.47, 3.73] 20.7, < 0.001
Modal class
Mum history of BW 1.78 [1.37, 2.32]
2.72 [2.06, 3.59]
2.63 [1.60, 4.32]
4.06 [2.91, 5.68] 104.6, < 0.001
Dad history of BW 1.32 [0.96, 1.80]
1.51 [1.05, 2.16]
2.11 [1.17, 3.80]
2.30 [1.46, 3.62] 20.6, < 0.001
Bias depends on class and also covariate
24
A later outcome
• Boys’ data
• Outcomes: – Key Stage 3 at 13-14 yrs– Achieved level 5 or greater in English/Sci/Maths
• English failed = 1210 (27.9%)• Science failed = 895 (20.6%)• Maths failed = 845 (19.5%)
25
2 stage procedure - Statalabel values class class_labellabel define class_label /// 1 "Pers INF [1]" /// 2 "DelayFRQ [2]" /// 3 "Normal [3]" /// 4 "Pers FRQ [4]" /// 5 "DelayINF [5]", add
recode class 3=0foreach var of varlist maths science english { tab `var' if class==1
xi: logit `var' i.class [iw = b_par_p], or test _Iclass_2 _Iclass_3 _Iclass_4 _Iclass_5}
26
KS3 - EnglishLogistic regression Number of obs = 4341 LR chi2(4) = 7.73 Prob > chi2 = 0.1018Log likelihood = -2564.536 Pseudo R2 = 0.0015
------------------------------------------------------------------------------ k3_lev5e | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]-------------+---------------------------------------------------------------- Pers INF | .9896705 .1131557 -0.09 0.928 .7909827 1.238267 Delay FRQ | .8946308 .1964416 -0.51 0.612 .5817527 1.375781 Pers FRQ | 1.474409 .2323757 2.46 0.014 1.082589 2.008041 Delay INF | .9135896 .0852754 -0.97 0.333 .76085 1.096991------------------------------------------------------------------------------
( 1) _Iclass_1 = 0 ( 2) _Iclass_2 = 0 ( 3) _Iclass_4 = 0 ( 4) _Iclass_5 = 0
chi2( 4) = 7.97 Prob > chi2 = 0.0926
27
KS3 - MathsLogistic regression Number of obs = 4341 LR chi2(4) = 11.29 Prob > chi2 = 0.0235Log likelihood = -2133.6412 Pseudo R2 = 0.0026
------------------------------------------------------------------------------ k3_lev5m | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]-------------+---------------------------------------------------------------- Pers INF | .9460608 .1241854 -0.42 0.673 .7314512 1.223637 Delay FRQ | .9601245 .2358923 -0.17 0.868 .5931937 1.554027 Pers FRQ | 1.688991 .2836716 3.12 0.002 1.215249 2.347413 Delay INF | .8976914 .095965 -1.01 0.313 .7280008 1.106935------------------------------------------------------------------------------
( 1) _Iclass_1 = 0 ( 2) _Iclass_2 = 0 ( 3) _Iclass_4 = 0 ( 4) _Iclass_5 = 0
chi2( 4) = 12.05 Prob > chi2 = 0.0170
28
KS3 - ScienceLogistic regression Number of obs = 4341 LR chi2(4) = 8.94 Prob > chi2 = 0.0626Log likelihood = -2203.9946 Pseudo R2 = 0.0020
------------------------------------------------------------------------------ k3_lev5s | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]-------------+---------------------------------------------------------------- Pers INF | .8913295 .1159146 -0.88 0.376 .6907838 1.150097 Delay FRQ | 1.067237 .2482602 0.28 0.780 .6764799 1.683709 Pers FRQ | 1.525329 .2566845 2.51 0.012 1.096786 2.121314 Delay INF | .8888344 .092835 -1.13 0.259 .7242967 1.09075------------------------------------------------------------------------------
( 1) _Iclass_1 = 0 ( 2) _Iclass_2 = 0 ( 3) _Iclass_4 = 0 ( 4) _Iclass_5 = 0
chi2( 4) = 9.34 Prob > chi2 = 0.0531
29
Summary• Fitting ordinal models is similar to binary data however
results (“trajectories”) are harder to interpret graphically
• Resulting classes can be used either as outcomes or categorical predictors using weighted regression in Stata
• Using variables derived from modal class assignment can often introduce very biased estimates