Author: Cormac Monaghan
Date: 2024-11-19

# lwc2022: Generating the Langa-Weir classification of cognitive function for the 2022 Health and Retirement Study cognition data

#### Cormac Monaghan

#### 2024-11-19

# Introduction

The `lwc2022` package is specifically developed for generation of the Langa-Weir classification of cognitive function for the 2022 Health and Retirement Study (HRS) cognition data. This classification system, developed by researchers David Weir and Kenneth Langa, categorizes individuals into cognitive function groups based on their performance in a set of standardized cognitive assessments.

For previous waves of HRS data (1995 - 2020) there is a researcher contributed dataset of dementia classifications (Langa, 2020). This dataset is widely used in research to study the trajectories of cognitive aging, dementia risk, and related health outcomes in older adults. However, with the recent release of the 2022 HRS data, these classifications have yet to be updated. As such, the `lwc2022` package aims to bridge this gap by providing tools that allow researchers to apply the same methodology to the 2022 cognition data.

# Methodological Overview of Langa-Weir Classifications

The Langa-Weir classification of cognitive function is based on performance in several cognitive domains, including:

- Immediate and delayed word recall: These tests assess episodic memory by asking respondents to recall a list of 10 words both immediately and after a delay.
- Serial subtraction: This task measures working memory and mental flexibility by having participants subtract 7 from 100 up to five times in a row.
- Backwards counting: Respondents are asked to count backwards from 20, which tests their attention and working memory.

The Langa-Weir methodology involves scoring these tasks and then assigning individuals to one of three cognitive function categories:

- Normal cognition
- Cognitively impaired, not demented (CIND)
- Dementia

The classification is based on a total cognitive score that sums the performance across these tasks. Cut-off thresholds are used to determine which category a respondent falls into, with higher scores indicating better cognitive performance.

# What the `lwc2022` package provides

This package offers several key functions to facilitate the generation of the Langa-Weir classifications for the 2022 HRS data. These functions replicate the logic and methodology described in the Langa-Weir Data Description for earlier waves. The following key functions are included:

1. Data extraction: The `extract()` function pulls out the relevant cognitive test variables from the HRS dataset.
2. Scoring: The `score()` function calculates the cognitive test scores for word recall, serial subtraction, and backwards counting.
3. Classification: The `classify()` function generates cognitive function classifications based on the total score, assigning individuals to normal cognition, CIND, or dementia categories.

## Replicating the Methodology

1. Immediate and Delayed Word Recall: Respondents are asked to recall a set of words. The scoring rules applied in `lwc2022` mirror those from prior waves: a score of 1 is given for each word correctly recalled, and a total score for both immediate and delayed recall is computed.

2. Serial Subtraction: Respondents are asked to subtract 7 from 100, then continue subtracting 7 from the resulting number. Points are assigned based on the number of correct subtractions, up to five. The `score_subtraction()` function handles this scoring automatically.

3. Backwards Counting: Respondents are asked to count backwards from 20 to 1. A score of 2 points is given if they succeed on the first try, 1 point if they succeed on the second attempt, and 0 points otherwise. This scoring is incorporated into the `score()` function.

4. Summing the Total Cognitive Score: The total cognitive score is computed by summing the scores across all tests (word recall, serial subtraction, and backwards counting). The total score is used to classify individuals into cognitive function groups:

   - Normal Cognition: A total score of 12 or higher.
   - Cognitively Impaired, Not Demented (CIND): A score between 7 and 11.
   - Dementia: A score of 6 or lower

# Example Workflow

    # Installing package
    # devtools::install_github("C-Monaghan/lwc2022")

    # Loading package
    library(lwc2022)

    # Load the example dataset
    data(cog_data)

    # Alternatively load the real HRS 2022 cognition data
    # cog_data <- haven::read_sav(here::here("../path_to_file.sav"))

    # Extract the relevant cognitive test variables
    extracted_data <- extract(cog_data)

    # Score the cognitive tests
    scored_data <- score(extracted_data)

    # Classify individuals based on their total cognitive score
    classified_data <- classify(scored_data)

    # View the first few rows of the classified data
    head(classified_data)
    #>     HHID PN imrc_imp2022 dlrc_imp2022 ser7_imp2022 bwc20_imp2022
    #> 1 288941 93            9            7            0             0
    #> 2 234057 99            6            7            0             1
    #> 3 224021 72            8            8            0             0
    #> 4 785284 26            6            3            1             0
    #> 5 326317  7            8            7            0             2
    #> 6 465208 42            7            6            0             2
    #>   cogtot27_imp2022 cogfunction2022
    #> 1               16               1
    #> 2               14               1
    #> 3               16               1
    #> 4               10               2
    #> 5               17               1
    #> 6               15               1