MyNixOS website logo
Description

Transforming and Harmonizing CCHS Variables.

Supporting the use of the Canadian Community Health Survey (CCHS) by transforming variables from each cycle into harmonized, consistent versions that span survey cycles (currently, 2001 to 2018). CCHS data used in this library is accessed and adapted in accordance to the Statistics Canada Open Licence Agreement. This package uses rec_with_table(), which was developed from 'sjmisc' rec(). Lüdecke D (2018). "sjmisc: Data and Variable Transformation Functions". Journal of Open Source Software, 3(26), 754. <doi:10.21105/joss.00754>.

cchsflow

Lifecycle:development License: MIT

cchsflow supports the use of the Canadian Community Health Survey (CCHS) by transforming variables from each cycle into harmonized, consistent versions that span survey cycles (currently, 2001 to 2018).

The CCHS is a population-based cross-sectional survey of Canadians that has been administered every two years since 2001. There are approximately 130,000 respondents per cycle. Studies use multiple CCHS cycles to examine trends over time and increase sample size to examine sub-groups that are too small to examine in a single cycle.

The CCHS is one of the largest and most robust ongoing population health surveys worldwide. The CCHS, administered by Statistics Canada, is Canada's main general population health survey. Information about the survey is found here. The CCHS has a Statistic Canada Open Licence.

Concept

Each cycle of the CCHS contains over 1000 variables that cover the four main topics: sociodemographic measures, health behaviours, health status and health care use. The seemingly consistent questions across CCHS cycles entice you to combine them together to increase sample size; however, you soon realize a challenge...

Imagine you want to use BMI (body mass index) for a study that spans CCHS 2001 to 2018. BMI seems like a straightforward measure that is routinely-collected worldwide. Indeed, BMI is included in all CCHS cycles. You examine the documentation and find the variable HWTAGBMI in the CCHS 2001 corresponds to body mass index, but that in other cycles, the variable name changes to HWTCGBMI, HWTDGBMI, HWTEGBMI, etc. On reading the documentation, you notice that some cycles round the value to one decimal, whereas other cycles round to two digits. Furthermore, some cycles don't calculate BMI for respondents < age 20 or > 64 years. Also, some cycles calculate BMI only if height and weight are within specific ranges. These types of changes occur for almost all CCHS variables. Sometimes the changes are subtle and difficult to find in the documentation, even for seemingly straightforward variables such as BMI. cchsflow harmonizes the BMI variable across different cycles.

Usage

cchsflow creates harmonized variables (where possible) between CCHS cycles. Searching BMI in variables (described in the Introduction section of variableDetails.csv vignette) shows HWTGBMI calculates BMI with two decimal places for all cycles for all respondents using the respondents' untruncated height and weight.

Calculate a harmonized BMI variable for CCHS 2001 cycle

    # load test cchs data - included in cchsflow

    cchs2001_BMI <- rec_with_table(cchs2001_p, "HWTGBMI")
    

Notes printed to console indicate issues that may affect BMI classification for your study.

Loading cchsflow variable_details
Using the passed data variable name as database_name
NOTE for HWTGBMI : CCHS 2001 restricts BMI to ages 20-64
NOTE for HWTGBMI : CCHS 2001 and 2003 codes not applicable and missing 
variables as 999.6 and 999.7-999.9 respectively, while CCHS 2005 onwards codes 
not applicable and missing variables as 999.96 and 999.7-999.99 respectively
NOTE for HWTGBMI : Don't know (999.7) and refusal (999.8) not included
in 2001 CCHS"

Important notes

Combining CCHS across survey cycles will result in misclassification error and other forms of bias that affects studies in different ways. The transformations that are described in this repository have been used in several research projects, but there are no guarantees regarding the accuracy or appropriate uses. Thomas and Wannell describe methodolgy issues when combining CCHS cycles.

Care must be taken to understand how specific variable transformation and harmonization with cchsflow affect your study or use of CCHS data. Across survey cycles, almost all CCHS variables have had at least some change in wording and category responses. Furthermore, there have been changes in survey sampling, response rates, weighting methods and other survey design changes that affect responses.

Installation

    # Install release version from CRAN
    install.packages("cchsflow")

    # Install the most recent version from GitHub
    devtools::install_github("Big-Life-Lab/cchsflow")

New variables not yet added to the CRAN version

You can download and use the latest version of variables.csv and variable_details.csv from GitHub.


What is in the cchsflow package?

cchsflow package includes:

  1. variables.csv - a list of variables that can be transformed across CCHS surveys.
  2. variable_details.csv - information that describes how the variables are recoded.
  3. Vignettes - that describe how to use R to transform or generate new derived variables that are listed in variables.csv. Transformations are performed using rec_with_table(). variables.csv and variable_details.csv can be used with other statistics programs (see issue).
  4. Demonstration CCHS data - cchsflow includes a random sample of 200 respondents from each CCHS PUMF file from 2001 to 2018. These data are used for the vignettes. The CCHS test data is stored in /data as .RData files. They can be read as a package database.
# read the CCHS 2017-2018 PUMF test data

test_data <- cchs2017_2018_p

This repository does not include the full CCHS data. Information on how to access the CCHS data can is here. The Canadian university community can also access the CCHS through ODESI (see health/Canada/Canadian Community Health Survey).

Roadmap

Project on the roadmap can be found on here.

Contributing

Please follow this guide if you would like to contribute to the cchsflow package.

We encourage PRs for additional variable transformations and derived variables that you believe may be helpful to the broad CCHS community.

Currently, cchsflow supports R through the rec_with_table() function. The CCHS community commonly uses SAS, Stata and other statistical packages. Please feel free to contribute to cchsflow by making a PR that creates versions of rec_with_table() for other statistical and programming languages.

Statistics Canada Attribution

CCHS data used in this library is accessed and adapted in accordance to the Statistics Canada Open Licence Agreement.

Source from Statistics Canada, Canadian Community Health Survey 2001 to 2018 PUMF, accessed March 2022. Reproduced and distributed on an "as is" basis with the permission of Statistics Canada.

Adapted from Statistics Canada, Canadian Community Health Surveys 2001 to 2018 PUMF, accessed March 2022. This does not constitute an endorsement by Statistics Canada of this product.

Metadata

Version

2.1.0

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows