Title: | Mental Health Quality of Life Toolkit |
Version: | 0.14.0 |
Description: | Transforms, calculates, and presents results from the Mental Health Quality of Life Questionnaire (MHQoL), a measure of health-related quality of life for individuals with mental health conditions. Provides scoring functions, summary statistics, and visualization tools to facilitate interpretation. For more details see van Krugten et al.(2022) <doi:10.1007/s11136-021-02935-w>. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
Depends: | R (≥ 4.1.0) |
Imports: | dplyr (≥ 1.1.4), assertthat (≥ 0.2.1), tidyr (≥ 1.3.0), shiny (≥ 1.0.0), shinyalert (≥ 3.1.0), DT (≥ 0.33.0), writexl (≥ 1.5.1), fmsb (≥ 0.7.6) |
Suggests: | here, stats, testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2025-03-20 10:27:34 UTC; 85304spe |
Author: | Stijn Peeters |
Maintainer: | Stijn Peeters <s.b.peeters@eshpm.eur.nl> |
Repository: | CRAN |
Date/Publication: | 2025-03-20 10:40:03 UTC |
A function to calculate the utility of the MHQoL
Description
This function calculates the utility of the MHQoL based on the scores of the different dimensions.
Usage
mhqol(
dimensions,
country = "Netherlands",
metric = c("average", "total"),
ignore_invalid = FALSE,
ignore_NA = FALSE)
Arguments
dimensions |
A dataframe, character vector, numeric vector, or list containing the dimensions of the MHQoL. Must contain the following dimensions: SI (Self-Image), IN (INdependence), MO (MOod), RE (RElationships), DA (Daily Activities), PH (Physical Health), FU (FUture). |
country |
A character value indicating the country for which the utilities should be calculated. Standard is the Netherlands |
metric |
A character value indicating whether to calculate the "total" or "average" utility. |
ignore_invalid |
If TRUE, the function will ignore missing dimensions and continue processing. If FALSE, the function will stop and throw an error. |
ignore_NA |
If TRUE, the function will ignore NA values in the input data. If FALSE, the function will stop and throw an error. |
Value
A dataframe containing the utilities based on the MHQoL valuesets
Examples
# Example usage of the mhqol_utilities function
# Get the utility based on a numeric vector and calculate the total utility,
# not all dimensions and values are present
mhqol(
dimensions = c(IN = 2, MO = 3, RE = 2, DA = NA, PH = 2, FU = 3),
metric = "total",
ignore_invalid = TRUE,
ignore_NA = TRUE
)
# Get the utility based on a dataframe and calculate the average utility
mhqol(
dimensions = data.frame(SI = 1, IN = 2, MO = 3, RE = 2, DA = 1, PH = 2, FU = 3),
metric = "average"
)
A function to calculate the Level Sum Scores (LSS) of the MHQoL
Description
This function calculates the Level Sum Scores (LSS) per dimension of overall
of the MHQoL based on the scores of the different dimensions.
Usage
mhqol_LSS(
dimensions,
metric = c("average", "total"),
ignore_invalid = FALSE,
ignore_NA = TRUE)
Arguments
dimensions |
A dataframe, character vector or list containing the dimensions of the MHQoL. Must contain the following dimensions: SI (Self-Image), IN (INdependence), MO (MOod), RE (RElationships), DA (Daily Activities), PH (Physical Health), FU (FUture). |
metric |
A character value indicating whether to calculate the "total" or "average" LSS. |
ignore_invalid |
If TRUE, the function will ignore missing dimensions and continue processing. If FALSE, the function will stop and throw an error. |
ignore_NA |
If TRUE, the function will ignore NA values in the input data. If FALSE, the function will stop and throw an error. |
Value
A dataframe containing the LSS based on the MHQoL manual.
Examples
# Example usage of the mhqol_LSS function
# Get the LSS based on a character vector and calculate the total LSS,
# not all dimensions are present
mhqol_LSS(
dimensions = c(IN = 2, MO = 3, RE = 2, DA = 1, PH = 2, FU = 3),
metric = "total", ignore_invalid = TRUE)
# Get the LSS based on a dataframe and calculate the average LSS,
# all dimensions are present
mhqol_LSS(
dimensions =
data.frame(SI = 1, IN = 2, MO = 3, RE = 2, DA = 1, PH = 2, FU = 3),
metric = "average")
Provides the states of the MHQoL based on the scores provided (as described in the manual)
Description
This function provides the states of the MHQoL based on the scores provided (as described in the manual).
Usage
mhqol_scores_to_states(
scores,
ignore_invalid = FALSE,
ignore_NA = FALSE,
retain_old_variables = TRUE)
Arguments
scores |
A dataframe, numeric vector, or list containing the scores of the MHQoL. |
ignore_invalid |
If TRUE, the function will ignore missing scores and continue processing. |
ignore_NA |
If TRUE, the function will ignore NA values in the input data. |
retain_old_variables |
If TRUE, the function will retain the old variables in the output. |
Value
A dataframe containing the states of the MHQoL based on the scores provided.
Examples
# Example usage of the mhqol_scores_to_states function
# Get the states based on a numeric vector, not all scores are present
mhqol_scores_to_states(
scores = c(IN = 2, DA = 1, PH = 2, FU = 3),
ignore_invalid = TRUE
)
# Get the states based on a dataframe
mhqol_scores_to_states(
scores = data.frame(
SI = 1,
IN = 2,
MO = 3,
RE = 2,
DA = 1,
PH = 2,
FU = 3
)
)
Provides the scores of the MHQoL based on the textual input (as described in the manual)
Description
This function provides the scores of the MHQoL based on textual input as described in the manual of the MHQoL.
Usage
mhqol_states_to_scores(
states,
ignore_invalid = FALSE,
ignore_NA = FALSE,
retain_old_variables = TRUE)
Arguments
states |
A dataframe, character vector or list containing the states of the MHQoL. Must contain the following states: SI (Self-Image), IN (INdependence), MO (MOod), RE (RElationships), DA (Daily Activities), PH (Physical Health), FU (FUture). |
ignore_invalid |
If TRUE, the function will ignore missing states and continue processing. If FALSE, the function will stop and throw an error. |
ignore_NA |
If TRUE, the function will ignore NA values in the input data. If FALSE, the function will stop and throw an error. |
retain_old_variables |
If TRUE, the function will return the original states along with the new scores. If FALSE, the function will only return the new scores. |
Value
A dataframe containing the new scores based on the MHQoL manual.
Examples
# Example usage of the mhqol_scores function
# Get the MHQoL scores based on a character vector and do not retain old values
mhqol_states_to_scores(
states = c(
SI = "I think very positively about myself",
IN = "I am very satisfied with my level of independence",
MO = "I do not feel anxious, gloomy, or depressed",
RE = "I am very satisfied with my relationships",
DA = "I am very satisfied with my daily activities",
PH = "I have no physical health problems",
FU = "I am very optimistic about my future"
),
retain_old_variables = FALSE
)
# Get the MHQoL scores based on a DataFrame and retain old values
# Define a sample DataFrame before using it
df <- data.frame(
SI = "I think positively about myself",
IN = "I am satisfied with my level of independence",
MO = "I feel a little anxious, gloomy, or depressed",
RE = "I am satisfied with my relationships",
DA = "I am satisfied with my daily activities",
PH = "I have some physical health problems",
FU = "I am optimistic about my future"
)
# Get the MHQoL scores based on a DataFrame
mhqol_states_to_scores(states = df)
# Get the MHQoL scores based on a DataFrame and ignore missing states
mhqol_states_to_scores(states = df, ignore_invalid = TRUE)
Provides the scores of the MHQoL based on the textual input (as described in the manual)
Description
This function provides the utilities of the MHQoL based on
textual, as described in the manual, or numeric input of the MHQoL.
Usage
mhqol_utilities(
dimensions,
country = "Netherlands",
ignore_invalid = FALSE,
ignore_NA = TRUE,
retain_old_variables = TRUE)
Arguments
dimensions |
A dataframe, character vector, numeric vector, or list containing the character or numeric dimensions of the MHQoL. Must contain the following dimensions: SI (Self-Image), IN (INdependence), MO (MOod), RE (RElationships), DA (Daily Activities), PH (Physical Health), FU (FUture). |
country |
The country for which the utilities should be calculated. For now the only option is "Netherlands". |
ignore_invalid |
If TRUE, the function will ignore missing dimensions and continue processing. If FALSE, the function will stop and throw an error. |
ignore_NA |
If TRUE, the function will ignore NA values in the input data. If FALSE, the function will stop and throw an error. |
retain_old_variables |
If TRUE, the function will return the original dimensions along with the new utilities. If FALSE, the function will only return the new utilities. |
Value
A dataframe containing the new utilities based on the MHQoL manual.
Examples
# Example usage of the mhqol_utilities function
# Get the MHQoL utilities based on a character vector and do not retain old values
mhqol_utilities(
dimensions = c(
SI = "I think very positively about myself",
IN = "I am very satisfied with my level of independence",
MO = "I do not feel anxious, gloomy, or depressed",
RE = "I am very satisfied with my relationships",
DA = "I am very satisfied with my daily activities",
PH = "I have no physical health problems",
FU = "I am very optimistic about my future"
),
retain_old_variables = FALSE
)
# Get the MHQoL utilities based on a numeric vector and ignore missing dimensions
mhqol_utilities(
dimensions = c(IN = 2, MO = 1, RE = 0, DA = 3, PH = 2, FU = 1),
ignore_invalid = TRUE
)
Provides the scores of the MHQoL based on the utilities provided (as described in the valueset)
Description
This function provides the scores of the MHQoL based on the utilities provided (as described in the valueset).
Usage
mhqol_utilities_to_scores(
utilities,
country = "Netherlands",
ignore_invalid = FALSE,
ignore_NA = TRUE,
retain_old_variables = TRUE)
Arguments
utilities |
A dataframe, numeric vector, or list containing the utilities of the MHQoL. |
country |
The country for which the utilities should be calculated. For now the only option is "Netherlands". |
ignore_invalid |
If TRUE, the function will ignore missing utilities and continue processing. |
ignore_NA |
If TRUE, the function will ignore NA values in the input data. |
retain_old_variables |
If TRUE, the function will retain the old variables in the output. |
Value
A dataframe containing the scores of the MHQoL based on the utilities provided.
Examples
# Example usage of the mhqol_utilities_to_scores function
# Get the scores based on a numeric vector, not all utilities are present
mhqol_utilities_to_scores(
utilities = c(IN = -0.018, DA = -0.021, PH = -0.064, FU = -0.106),
ignore_invalid = TRUE
)
# Get the scores based on a dataframe
mhqol_utilities_to_scores(
utilities = data.frame(
SI = -0.137,
IN = -0.184,
MO = -0.063,
RE = -0.172,
DA = -0.021,
PH = -0.243,
FU = -0.170
)
)
Provides the states of the MHQoL based on the utilities provided (as described in the valueset)
Description
This function provides the states of the MHQoL based on the utilities provided (as described in the valueset).
Usage
mhqol_utilities_to_states(
utilities,
country = "Netherlands",
ignore_invalid = FALSE,
ignore_NA = FALSE,
retain_old_variables = TRUE)
Arguments
utilities |
A dataframe, numeric vector, or list containing the utilities of the MHQoL. |
country |
The country for which the utilities should be calculated. For now the only option is "Netherlands". |
ignore_invalid |
If TRUE, the function will ignore missing utilities and continue processing. |
ignore_NA |
If TRUE, the function will ignore NA values in the input data. |
retain_old_variables |
If TRUE, the function will retain the old variables in the output. |
Value
A dataframe containing the states of the MHQoL based on the utilities provided.
Examples
# Example usage of the mhqol_utilities_to_states function
# Get the states based on a numeric vector, not all states are present
mhqol_utilities_to_states(
utilities = c(IN = -0.018, DA = -0.021, PH = -0.064, FU = -0.106),
ignore_invalid = TRUE
)
# Get the states based on a dataframe
mhqol_utilities_to_states(
utilities = data.frame(
SI = -0.137,
IN = -0.184,
MO = -0.063,
RE = -0.172,
DA = -0.021,
PH = -0.243,
FU = -0.170
)
)
Provides the valueset of the MHQoL based on the country specified
Description
This function provides the valueset of the MHQoL based on the country specified.
Usage
mhqol_valueset(country)
Arguments
country |
A character value indicating the country for which the valueset should be provided. For now only the Netherlands is available. |
Value
A dataframe containing the valueset of the MHQoL based on the country specified.
Examples
# Example usage of the mhqol_valueset function
# Get the valueset for the Netherlands
mhqol_valueset(country = "Netherlands")
Launch Shiny MHQoL Interface
Description
shiny_mhqol
launches a Shiny interface for browser-based MHQoL calculations.
Usage
shiny_mhqol(display.mode = "normal")
Arguments
display.mode |
The display mode to be passed to runApp. Default is "normal". |
Details
This function starts the Shiny app for Mental Health Quality of Life (MHQoL) scoring, allowing users to interactively input data and calculate utility scores.
Value
NULL (launches the Shiny app).
Examples
if(interactive()) {
shiny_mhqol()
shiny_mhqol(display.mode = "normal")
}