Skip to contents

Variable classes and data integrity

The youthvars package includes a number of ready4 framework sub-module classes that form part of the readyforwhatsnext economic model of youth mental health. The primary use of youthvars sub-modules is to quality assure the variables used in model input and output datasets by:

  1. facilitating automated data integrity checks that verify no impermissible values (e.g. utility scores greater than one) are present in source data, transformed data or results; and
  2. implementing rules-based automated selection and application of appropriate methods for each dataset variable.

Included sub-module classes

The initial set of sub-module classes included in the youthvars package are one class for Assessment of Quality of Life (Adolescent) health utility and one for each of the predictors used in the utility prediction algorithms included in the related youthu package.

Assessment of Quality of Life Six Dimension (Adolescent) Health Utility

The youthvars_aqol6d_adol class is defined for numeric vectors with a minimum value of 0.03 and maximum value of 1.0.

## [1] 0.4
## attr(,"class")
## [1] "youthvars_aqol6d_adol" "numeric"
## [1] 0.03 0.20 1.00
## attr(,"class")
## [1] "youthvars_aqol6d_adol" "numeric"

Non numeric objects and values outside these ranges will produce errors.

## Error in make_new_youthvars_aqol6d_adol(x): is.numeric(x) is not TRUE
## Error: All non-missing values in valid youthvars_aqol6d_adol object must be greater than or equal to 0.03.
## Error: All non-missing values in valid youthvars_aqol6d_adol object must be less than or equal to 1.

Child Health Utility Nine Dimension - Australian Adolescent Scoring

The youthvars_chu9d_adolaus class is defined for numeric vectors with a minimum value of -0.2118 and maximum value of 1.0.

## [1] 0.4
## attr(,"class")
## [1] "youthvars_chu9d_adolaus" "numeric"
## [1] 0.03 0.20 1.00
## attr(,"class")
## [1] "youthvars_chu9d_adolaus" "numeric"

Non numeric objects and values outside these ranges will produce errors.

## Error in make_new_youthvars_chu9d_adolaus(x): is.numeric(x) is not TRUE
## Error: All non-missing values in valid youthvars_chu9d_adolaus object must be greater than or equal to -0.2118.
## Error: All non-missing values in valid youthvars_chu9d_adolaus object must be less than or equal to 1.

Behavioural Activation for Depression Scale (BADS)

The youthvars_bads class is defined for integer vectors with a minimum value of 0 and maximum value of 150.

## [1] 143
## attr(,"class")
## [1] "youthvars_bads" "integer"
## [1]   1  15 150
## attr(,"class")
## [1] "youthvars_bads" "integer"

Non-integers and values outside these ranges will produce errors.

## Error in make_new_youthvars_bads(x): is.integer(x) is not TRUE
## Error: All non-missing values in valid youthvars_bads object must be greater than or equal to 0.
## Error: All non-missing values in valid youthvars_bads object must be less than or equal to 150.

Generalised Anxiety Disorder Scale (GAD-7)

The youthvars_gad7 class is defined for integer vectors with a minimum value of 0 and a maximum value of 21.

## [1] 15
## attr(,"class")
## [1] "youthvars_gad7" "integer"
## [1]  0 14 21
## attr(,"class")
## [1] "youthvars_gad7" "integer"

Non-integers and values outside these ranges will produce errors.

## Error in make_new_youthvars_gad7(x): is.integer(x) is not TRUE
## Error: All non-missing values in valid youthvars_gad7 object must be greater than or equal to 0.
## Error: All non-missing values in valid youthvars_gad7 object must be less than or equal to 21.

Kessler Psychological Distress Scale (K6) - Australian Scoring System

The youthvars_k6_aus class is defined for integer vectors with a minimum value of 6 and a maximum value of 30.

## [1] 21
## attr(,"class")
## [1] "youthvars_k6_aus" "integer"
## [1]  6 13 25
## attr(,"class")
## [1] "youthvars_k6_aus" "integer"

Non-integers and values outside these ranges will produce errors.

## Error in make_new_youthvars_k6_aus(x): is.integer(x) is not TRUE
## Error: All non-missing values in valid youthvars_k6_aus object must be greater than or equal to 6.
## Error: All non-missing values in valid youthvars_k6_aus object must be less than or equal to 30.

Kessler Psychological Distress Scale (K6) - US Scoring System

The youthvars_k6 class is defined for integer vectors with a minimum value of 0 and a maximum value of 24.

## [1] 21
## attr(,"class")
## [1] "youthvars_k6" "integer"
## [1]  0 13 24
## attr(,"class")
## [1] "youthvars_k6" "integer"

Non-integers and values outside these ranges will produce errors.

## Error in make_new_youthvars_k6(x): is.integer(x) is not TRUE
## Error: All non-missing values in valid youthvars_k6 object must be greater than or equal to 0.
## Error: All non-missing values in valid youthvars_k6 object must be less than or equal to 24.

Kessler Psychological Distress Scale (K10) - Australian Scoring System

The youthvars_k10_aus class is defined for integer vectors with a minimum value of 10 and a maximum value of 50.

## [1] 21
## attr(,"class")
## [1] "youthvars_k10_aus" "integer"
## [1] 13 25 41
## attr(,"class")
## [1] "youthvars_k10_aus" "integer"

Non-integers and values outside these ranges will produce errors.

## Error in make_new_youthvars_k10_aus(x): is.integer(x) is not TRUE
## Error: All non-missing values in valid youthvars_k10_aus object must be greater than or equal to 10.
## Error: All non-missing values in valid youthvars_k10_aus object must be less than or equal to 50.

Kessler Psychological Distress Scale (K10) - US Scoring System

The youthvars_k10 class is defined for integer vectors with a minimum value of 0 and a maximum value of 40.

## [1] 21
## attr(,"class")
## [1] "youthvars_k10" "integer"
## [1]  0 13 34
## attr(,"class")
## [1] "youthvars_k10" "integer"

Non-integers and values outside these ranges will produce errors.

## Error in make_new_youthvars_k10(x): is.integer(x) is not TRUE
## Error: All non-missing values in valid youthvars_k10 object must be greater than or equal to 0.
## Error: All non-missing values in valid youthvars_k10 object must be less than or equal to 40.

Overall Anxiety Severity and Impairment Scale (OASIS)

The youthvars_oasis class is defined for integer vectors with a minimum value of 0 and a maximum value of 20.

## [1] 15
## attr(,"class")
## [1] "youthvars_oasis" "integer"
## [1]  0 12 20
## attr(,"class")
## [1] "youthvars_oasis" "integer"

Non-integers and values outside these ranges will produce errors.

## Error in make_new_youthvars_oasis(x): is.integer(x) is not TRUE
## Error: All non-missing values in valid youthvars_oasis object must be greater than or equal to 0.
## Error: All non-missing values in valid youthvars_oasis object must be less than or equal to 20.

Patient Health Questionnaire (PHQ-9)

The youthvars_phq9 class is defined for integer vectors with a minimum value of 0 and a maximum value of 27.

## [1] 11
## attr(,"class")
## [1] "youthvars_phq9" "integer"
## [1]  0 13 27
## attr(,"class")
## [1] "youthvars_phq9" "integer"

Non-integers and values outside these ranges will produce errors.

## Error in make_new_youthvars_phq9(x): is.integer(x) is not TRUE
## Error: All non-missing values in valid youthvars_phq9 object must be greater than or equal to 0.
## Error: All non-missing values in valid youthvars_phq9 object must be less than or equal to 27.

The youthvars_scared class is defined for integer vectors with a minimum value of 0 and a maximum value of 82.

## [1] 77
## attr(,"class")
## [1] "youthvars_scared" "integer"
## [1]  0 42 82
## attr(,"class")
## [1] "youthvars_scared" "integer"

Non-integers and values outside these ranges will produce errors.

## Error in make_new_youthvars_scared(x): is.integer(x) is not TRUE
## Error: All non-missing values in valid youthvars_scared object must be greater than or equal to 0.
## Error in make_new_youthvars_scared(x): is.integer(x) is not TRUE

Social and Occupational Functioning Assessment Scale (SOFAS)

The youthvars_sofas class is defined for integer vectors with a minimum value of 0 and a maximum value of 100.

## [1] 44
## attr(,"class")
## [1] "youthvars_sofas" "integer"
## [1]  0 23 89
## attr(,"class")
## [1] "youthvars_sofas" "integer"

Non-integers and values outside these ranges will produce errors.

## Error in make_new_youthvars_sofas(x): is.integer(x) is not TRUE
## Error: All non-missing values in valid youthvars_sofas object must be greater than or equal to 0.
## Error: All non-missing values in valid youthvars_sofas object must be less than or equal to 100.