1 Binary Models 1 A (Longitudinal) Latent Class Analysis of Bedwetting
2 How much fun can you have with 5 binary variables?
3 Croudace paper:
4
5 Gender-specific prevalence and levels of missing data 4.5 years5.5 years6.5 years7.5 years9.5 years Boys (n=7217) No bedwetting Bedwetting 1793 (36.4%) 1281 (27.9%) 1061 (24.4%) 844 (20.0%) 526 (13.4%) No response Girls (n=6756) No bedwetting Bedwetting 1074 (23.2%) 691 (16.0%) 586 (14.3%) 420 (10.6%) 225 (5.9%) No response )
6 Latent Class Models Deal with patterns of response e.g = Yes at all five time points = No at all five time points = Yes early on, followed by no = Alternating pattern 11*** = Yes followed by missing 1*0*1 = etc.
7 Latent Class Models
8 Conditional independence manifest variables are independent given latent class, can be written as a product of all the probabilities for the individual items of that pattern. E.g. for a pattern ’01’, if pat(1) to be the first element of a pattern i.e. the first binary variable, then P( pattern = ’01’ | class = i) = P(pat(1) = ‘0’ | class = i)*P(pat(2) = ‘1’ | class = i)
9 Huh? Basically, Bayes’ rule plus conditional independence assumption enable you to calculate the likelihood of each pattern being assigned to each class. By selecting starting values for the probabilities, ot alternatively a starting assignment for the patterns, one can iterate to convergence to find the best solution given your chosen number of classes
10 Distribution of patterns (complete data) | N | | | 1. | | 2. | | 3. | | 4. | | 5. | | | | 6. | | 7. | | 8. | | 9. | | 10. | | | | 11. | | 12. | | 13. | | 14. | | 15. | | | | 16. | | | N | | | 17. | | 18. | | 19. | | 20. | | | | 21. | | 22. | | 23. | | 24. | | 25. | | | | 26. | | 27. | | 28. | | 29. | | 30. | | | | 31. | | 32. | |
11 Distribution of patterns with some missingness | N | | | 1. | | 2. | | 3. | | 4. | | 5. | | | | 6. | | 7. | | 8. | | 9. | | 10. | | | | 11. | | 12. | | 13. | | 14. | | 15. | | | | | N | | | 16. | | 17. | | 18. | | 19. | | 20. | | | | 21. | | 22. | | 23. | | 24. | | 25. | | | | Etc | | 183. | |
12 Thresholds Mplus thinks of binary variables as being a dichotomised continuous latent variable The point at which a continuous N(0,1) variable must be cut to create a binary variable is called a threshold A binary variable with 50% cases corresponds to a threshold of zero A binary variable with 2.5% cases corresponds to a threshold of 1.96
13 Thresholds Figure from Uebersax webpage
14 Categorical variables A categorical variable with n-levels requires n-1 thresholds i.e. you need to make n-1 cuts in a continuous N(0,1) variable to make your observed n-level variable
15 Degrees of freedom 32 possible patterns (missing data patterns don’t count) Each additional class requires –5 df to estimate the 5 prevalence of wetting within that class (i.e. 5 thresholds) –1 df for an additional cut of the latent variable defining the class distribution Hence a 5-class model uses up 5*5 + 4 = 29 degrees of freedom leaving 3 df to test the model
16 Procedure Fit 1-5 class models in turn Output = within class thresholds (prevalences) and latent class distribution Select preferred model using various criteria –Statistical – measures of fit –Ease of interpretation of results –Parsimony –Face validity –Astrology Celebrate
17 How to fit in Mplus – black box way data: file is ‘bedwetting_5tp.txt'; listwise is on; variable: names sex bwt marr m_age parity educ tenure ne_kk ne_km ne_kp ne_kr ne_ku; categorical = ne_kk ne_km ne_kp ne_kr ne_ku; usevariables ne_kk ne_km ne_kp ne_kr ne_ku; missing are ne_kk ne_km ne_kp ne_kr ne_ku (-9); classes = c (4); analysis: type = mixture; starts = ; stiterations = 10; stscale = 20; model: %OVERALL% Is that it????
18 What you’re actually doing: model: %OVERALL% [c#1 c#2 c#3]; %c#1% [ne_kk$1]; [ne_km$1]; [ne_kp$1]; [ne_kr$1]; [ne_ku$1]; %c#2% [ne_kk$1]; [ne_km$1]; [ne_kp$1]; [ne_kr$1]; [ne_ku$1]; %c#3% [ne_kk$1]; [ne_km$1]; [ne_kp$1]; [ne_kr$1]; [ne_ku$1]; %c#4% [ne_kk$1]; [ne_km$1]; [ne_kp$1]; [ne_kr$1]; [ne_ku$1]; 4 class model => 3 estimated threshold for latent class variable 5 more thresholds for each class
19 How many random starts? Depends on –Sample size –Complexity of model Number of manifest variables Number of classes Aim to find consistently the model with the lowest likelihood, within each run
20 Success Not there yet Loglikelihood values at local maxima, seeds, and initial stage start numbers: Loglikelihood values at local maxima, seeds, and initial stage start numbers
21 What the output looks like TESTS OF MODEL FIT Loglikelihood H0 Value H0 Scaling Correction Factor for MLR Information Criteria Number of Free Parameters 23 Akaike (AIC) Bayesian (BIC) Sample-Size Adjusted BIC (n* = (n + 2) / 24) Chi-Square Test of Model Fit for the Binary outcomes Pearson Chi-Square Degrees of Freedom 8 P-Value Likelihood Ratio Chi-Square Degrees of Freedom 8 P-Value
22 Measures of entropy Average Latent Class Probabilities for Most Likely Latent Class Membership (Row) by Latent Class (Column) Entropy (global) 0.844
23 Model based + modal class latent class distribution FINAL CLASS COUNTS AND PROPORTIONS FOR THE LATENT CLASSES BASED ON THE ESTIMATED MODEL Latent classes CLASSIFICATION OF INDIVIDUALS BASED ON THEIR MOST LIKELY LATENT CLASS MEMBERSHIP Class Counts and Proportions Latent classes
24 Model results Estimates S.E. Est./S.E. Latent Class 1 Thresholds NE_KK$ NE_KM$ NE_KP$ NE_KR$ NE_KU$ Latent Class 2 Thresholds NE_KK$ NE_KM$ NE_KP$ NE_KR$ NE_KU$ Estimates S.E. Est./S.E. Latent Class 3 Thresholds NE_KK$ NE_KM$ NE_KP$ NE_KR$ NE_KU$ Latent Class 4 Thresholds NE_KK$ NE_KM$ NE_KP$ NE_KR$ NE_KU$ Categorical Latent Variables Means C# C# C#
25 RESULTS IN PROBABILITY SCALE Latent Class 1 NE_KK Category Category NE_KM Category Category NE_KP Category Category NE_KR Category Category NE_KU Category Category Latent Class 2 NE_KK Category Category NE_KM Category Category NE_KP Category Category NE_KR Category Category NE_KU Category Category
26 These can be plotted In Excel from the probabilities:
27 … or in Mplus plot: type is plot2; series is anybw_t1 (4.5) anybw_t2 (5.5) anybw_t3 (6.5) anybw_t4 (7.5) anybw_t5 (9.5); Then Graph> view graphs> estimated probabilities
28 Yuck!
29 Model fit stats 1 class2 class3 class4 class5 class Estimated params Likelihood BLRT < BIC Entropy
30 Model fit stats - BIC Bayesian Information Criterion = -2*Log-likelihood + (# params)*ln(sample size) Function of likelihood which rewards a more parsimonius model Decrease followed by an increase as extra classes are added
31 Model fit stats - Entropy Measure of the certainty with which patterns (and therefore subjects) are assigned to latent classes. Higher values indicate a greater delineation of classes – ideally approaching 1 (Celeux & Soromenho) 0.62 would indicate 'fuzzyness' (Ramaswamy) Thorough job: –Examine global entropy, –Examine class-specific entropy –Examine the assignment probabilities for each individual pattern
32 Model fit stats - BLRT Bootstrap Likelihood Ratio Test Traditional Δ-likelihood test cannot be used to test nested latent class models as the difference in likelihoods is not chi-square distributed The BLRT empirically estimates the difference distribution providing a p-value for the observed difference which can be used in tests of model fit
33 How to obtain BLRT Fit k-class model Select an optseed which replicates the solution with the lowest likelihood for k-classes Re-fit k-class model using optseed, specifying tech14 in the output section and selecting an appropriate number of runs for bootstrapping k-1starts = ; lrtstarts ; lrtbootstrap 100; Ensure that optimal k-1 class model has been replicated
34 BLRT Output PARAMETRIC BOOTSTRAPPED LIKELIHOOD RATIO TEST FOR 4 (H0) VERSUS 5 CLASSES H0 Loglikelihood Value Times the Loglikelihood Difference Difference in the Number of Parameters 7 Approximate P-Value Successful Bootstrap Draws 100 Does this agree with what you obtained for 4 class run? B LRT p-value implies no improvement in fit when moving from 4 to 5 classes
35 Model fit stats 1 class2 class3 class4 class5 class Estimated params Likelihood BLRT < BIC Entropy BLRT 4 class model is adequate fit to data and there is little improvement in fit when a 5 th class is added BIC attains it’s minimum value at the 4 class model (penalising 5-class for it’s lack of parsimony) Entropy 2-class model has highest entropy, however all values are reasonably high
36 Other considerations - interpretation 4 class model 5 class model
37 Final decision 4 and 5 class model fit the data, parsimony favours 4 class Both 4 and 5 class models make intuitive sense –4 classes: ‘normative’, ‘delayed’, ‘persistent’, ‘relapse’ –5 class brings us ‘severe delay’ 5 class model is in good agreement with Croudace et al (2004) Job’s a good ‘un
38 Conclusions Like EFA, LCA is an exploratory tool with the aim of summarising the variability in the dataset in a simple/interpretable way These results do not prove that there are 4 or 5 groups of children in mere life. LCA will find groupings in the data even if there is no reason to think such groups might exist.
39 Bring on the covariates
40 Predicting class membership One can strengthen the assertion that subjects can be neatly packaged in little groups if one can show that these groups differ with respect to –Co-morbid conditions –Aetiogical factors –Later outcomes Even better if such findings support what is seen in (a) other epidemiological studies, (b) clinical settings
41 Output from LCA: Class distribution Set of probabilities defining the likelihood that each observed pattern can be assigned to each class PatternNormativeDelayedSev delayPersistRelapse
42 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)
43 Save data from Mplus savedata: file is “boys_5class_output_completecase.txt"; save cprob; Don’t forget to add the ID variable: variable: idvariable is ID;
44 Dataset: t1t2t3t4t5IDp(c1)p(c2)p(c3)p(c4)p(c5) Modal class
45 Then what? Merge Mplus output with covariates using ID Mplus will only permit one ID variable. –ALSPAC has one ID to identify parents but two ID’s to identify the kids – parent ID plus another one –Create a composite ID e.g , and then rederive proper ID before matching Read into Stata (or similar)
46 Reshaping the dataset Weighted model requires a reshaping of the dataset so that each child has n-rows (for an n- class model) rather than just 1
47 Pre-shaped – first 20 kids | ID sex dev_18 dev_42 pclass1 pclass2 pclass3 pclass4 pclass5 modclass | | | | male | | male | | male | | male | | male | | | | male | | male | | male | | male | | male | | | | male | | male | | male | | male | | male | | | | male | | male | | male | | male | | male |
48 Pre-shaped – first 20 kids | ID sex dev_18 dev_42 pclass1 pclass2 pclass3 pclass4 pclass5 modclass | | | | male | | male | | male | | male | | male | | | | male | | male | | male | | male | | male | | | | male | | male | | male | | male | | male | | | | male | | male | | male | | male | | male | covariatesPosterior probs Modal class
49 The reshaping reshape long pclass, i(id) j(class) (note: j = ) Data wide -> long Number of obs > Number of variables 66 -> 63 j variable (5 values) -> class xij variables: pclass1 pclass2... pclass5 -> pclass
50 Re-shaped – first 3 kids | id sex dev_18 dev_42 pclass class | | | 1. | male | 2. | male | 3. | male | 4. | male | 5. | male | | | 6. | male | 7. | male | 8. | male | 9. | male | 10. | male | | | 11. | male | 12. | male | 13. | male | 14. | male | 15. | male | First kid Third kid Second kid
51 Multinomial model log using "temperament.log", replace foreach var of varlist activity rhythmicity approach /// adaptability intensity mood persistence distractibility /// threshold { xi: mlogit class `var' [iw = pclass], rrr test `var' xi: mlogit class `var' kz021 [iw = pclass], rrr test `var' xi: mlogit class `var' kz021 b1 b2 b5 b6 b10 b16 b17 i.wisc_70 [iw = pclass], rrr } log close
52 Multinomial model log using "temperament.log", replace foreach var of varlist activity rhythmicity approach /// adaptability intensity mood persistence distractibility /// threshold { xi: mlogit class `var' [iw = pclass], rrr test `var' xi: mlogit class `var' kz021 [iw = pclass], rrr test `var' xi: mlogit class `var' kz021 b1 b2 b5 b6 b10 b16 b17 i.wisc_70 [iw = pclass], rrr } log close Weight by class membership probabilities
53 Typical Output Multinomial logistic regression Number of obs = 9535 LR chi2(4) = Prob > chi2 = Log likelihood = Pseudo R2 = class | RRR Std. Err. z P>|z| [95% Conf. Interval] | adaptability | | adaptability | | adaptability | | adaptability | (class==4 is the base outcome) ( 1) [1]adaptability = 0 ( 2) [2]adaptability = 0 ( 3) [3]adaptability = 0 ( 4) [5]adaptability = 0 chi2( 4) = Prob > chi2 =
54 Summary Can use Latent Class Analysis to summarise the variability in patterns of response to binary longitudinal repeated measures ~ LLCA [Longitudinal LCA] Can use time invariant covariates to predict class membership in a 2-stage model in Stata using posterior probabilities