{'fraction_non_alphanumeric': 0.018074383037886686, 'fraction_numerical': 0.0013903371567605145, 'mean_word_length': 4.885480572597137, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Finding patterns and groupings: I. Introduction to latent class analysis

An increasingly common task is to take a set of observations and try to identify the groups that underlie those observations or the different patterns of observations. The observations might be cross-sectional symptoms in which case we look to identify diagnostic categories, either to discover novel categories or to validate existing ones. Or they might be longitudinal symptoms and we want to identify groups of similar trajectories over time. Over the last two decades, the number of techniques for doing tasks like these has been considerably expanded and made available as software. One of the earliest and simplest techniques is latent class analysis (LCA). An LCA attempts to identify a latent categorical variable (or possibly variables) which underlies the relationships between observed or manifest variables which also have to be categorical. The levels of the categorical variable are called classes. When we describe classes as underlying a set of observations we tend to mean that the classes ‘cause’ the similar-looking patterns of observations or associations between observations (the tendency of certain observations to go together). The LCA model says that we have identified a class when within that class there is no association between observations. For example, we find that complaints of headaches are accompanied by complaints of feeling nauseous. Suppose we are able to split the sample into somatisation and non-somatisation classes and find within each class that complaints of nausea are no more less common whether someone complains of headaches or not. Somatisation, we can then say, explains the association. Of course people in the somatisation class will be much more likely to report both headaches and nausea, but no more so than would be expected from the higher rates of nausea and headaches in that class. We can think of fitting an LCA model as partitioning the sample into groups in which there is no association between the variables. There might not be any partition which does the job and even in a successful LCA some associations will usually remain, but nevertheless that is the goal. LCA is sometimes described as a mixture analysis, conveying the idea that what is observed is the product of mixing together responses from different kinds of people. If LCA is a mixture of categorical responses you might expect there to be other types of mixtures and indeed there are: for example, a mixture of continuous responses from different kinds is called a latent profile analysis. Consider the data in panel I of Table 1 which show the relationship between two items which have been answered ‘Yes/No’. The association–expressed as an odds ratio–is 2.04 and the chi-square test indicates that it is significant. (The odds ratio of ‘Yes’ on item B for those who