Title: | Vulnerability Score Calibration |
---|---|
Description: | Fill a longer description of your package here. |
Authors: | Edouard Legoupil [aut, cre], Alejandra Isabel Garcia Prosperi [ctb], Hisham Galal [ctb] |
Maintainer: | Edouard Legoupil <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.900 |
Built: | 2024-09-15 02:46:44 UTC |
Source: | https://github.com/unhcr-americas/VulnerabilityScoreCalibration |
Plot results per dimension - Average Marginal Component Effects (AMCEs)
conjoint_plot_bar(.x)
conjoint_plot_bar(.x)
.x |
A list or atomic vector. |
gggplot2 graph
a ggplot2 object
kobodata <- system.file("data-demo/conjoint_data.xlsx", package = "VulnerabilityScoreCalibration") koboform <- system.file("data-demo/conjoint_form.xlsx", package = "VulnerabilityScoreCalibration") cj <- conjoint_review(kobodata, koboform) ## Plot AMCES as bar for dimension 2 conjoint_plot_bar( as.data.frame(cj[["cjdata"]][2,][["amces"]])) + ggplot2::labs( subtitle = "Average Marginal Component Effects (AMCEs)") ## Plot importance as bar for dimension 2 conjoint_plot_bar( as.data.frame(cj[["cjdata"]][2,][["importance"]])) + ggplot2::labs( subtitle = "Importance")
kobodata <- system.file("data-demo/conjoint_data.xlsx", package = "VulnerabilityScoreCalibration") koboform <- system.file("data-demo/conjoint_form.xlsx", package = "VulnerabilityScoreCalibration") cj <- conjoint_review(kobodata, koboform) ## Plot AMCES as bar for dimension 2 conjoint_plot_bar( as.data.frame(cj[["cjdata"]][2,][["amces"]])) + ggplot2::labs( subtitle = "Average Marginal Component Effects (AMCEs)") ## Plot importance as bar for dimension 2 conjoint_plot_bar( as.data.frame(cj[["cjdata"]][2,][["importance"]])) + ggplot2::labs( subtitle = "Importance")
Plot results per dimension - Marginal Means
conjoint_plot_point(.x)
conjoint_plot_point(.x)
.x |
A list or atomic vector. |
a ggplot2 object
kobodata <- system.file("data-demo/conjoint_data.xlsx", package = "VulnerabilityScoreCalibration") koboform <- system.file("data-demo/conjoint_form.xlsx", package = "VulnerabilityScoreCalibration") cj <- conjoint_review(kobodata, koboform) conjoint_plot_point( as.data.frame(cj[["cjdata"]][1,][["margins"]])) + ggplot2::labs( subtitle = "Margins)") conjoint_plot_point( as.data.frame(cj[["cjdata"]][1,][["amces"]])) + ggplot2::labs( subtitle = "Average Marginal Component Effects (AMCEs)") conjoint_plot_point( as.data.frame(cj[["cjdata"]][1,][["importance"]])) + ggplot2::labs( subtitle = "Importance")
kobodata <- system.file("data-demo/conjoint_data.xlsx", package = "VulnerabilityScoreCalibration") koboform <- system.file("data-demo/conjoint_form.xlsx", package = "VulnerabilityScoreCalibration") cj <- conjoint_review(kobodata, koboform) conjoint_plot_point( as.data.frame(cj[["cjdata"]][1,][["margins"]])) + ggplot2::labs( subtitle = "Margins)") conjoint_plot_point( as.data.frame(cj[["cjdata"]][1,][["amces"]])) + ggplot2::labs( subtitle = "Average Marginal Component Effects (AMCEs)") conjoint_plot_point( as.data.frame(cj[["cjdata"]][1,][["importance"]])) + ggplot2::labs( subtitle = "Importance")
Generate an xlsform used to perform consultation for conjoint analysis.
conjoint_prepare( opts, language = "English (en)", form_title = "Conjoint Review", id_string = "conjoint_rev", outdir = "data-raw", outfile = "conjoint_form.xlsx" )
conjoint_prepare( opts, language = "English (en)", form_title = "Conjoint Review", id_string = "conjoint_rev", outdir = "data-raw", outfile = "conjoint_form.xlsx" )
opts |
a dataframe containing the options to compare |
language |
what language to use in case of multiple language |
form_title |
Actividad #2: Calificación de perfiles de vulnerabilidad |
id_string |
vulnerability_rating |
outdir |
directory within project where to put the file |
outfile |
path of the file... |
The options that will be compared are the different levels of the section of indicators that should have been filtered through the quadratic voting stage.
One level can actually match multiple response options from the screening questionnaire
a file in xlsform format
# indicator <- system.file("data-demo/indicator_criteria.xlsx", # package = "VulnerabilityScoreCalibration") # opts <- read_excel("cja_opts_SAL.xlsx") # # conjoint_prepare( opts = opts, # language = "Spanish (es)", # form_title = "Actividad #2: Calificación de perfiles de # vulnerabilidad - El Salvador, 23 de marzo, 2023", # id_string = "vulnerability_rating", # outdir = "", # outfile = "form.xlsx" )
# indicator <- system.file("data-demo/indicator_criteria.xlsx", # package = "VulnerabilityScoreCalibration") # opts <- read_excel("cja_opts_SAL.xlsx") # # conjoint_prepare( opts = opts, # language = "Spanish (es)", # form_title = "Actividad #2: Calificación de perfiles de # vulnerabilidad - El Salvador, 23 de marzo, 2023", # id_string = "vulnerability_rating", # outdir = "", # outfile = "form.xlsx" )
What is Conjoint analysis?
Conjoint analysis can speed up expert consultations by offering an __objective mean to compile expert opinions__.
* Conjoint analysis originated in mathematical psychology by psychometricians.
* often used to evaluate how people make decisions between a set of different options when considering a number of criteria at the same time (conjoint features; “trade-offs”).
1. Measurement framework
The Joint Intersectoral Analysis Framework (JIAF) is a theoretical generic measurement framework to be used for Humanitarian needs assessment. It specifies three distinct and complementary components of humanitarian severity and vulnerability indexes:
* Basic Needs & Living standards
* Coping Capacity
* Well Being & Community integration
This generic model can be contextualized: different sub-indicators might be used for each of the 3 components depending on cultural and political situations.
2. Define the combined alternatives to be compared
* participants rate their preferences for profiles with different combinations of the attributes or criteria.
* CA then allows to “decompose” or reverse-engineer these ratings into estimates of how important each criteria or attribute is to a participant’s ranking decisions
3. Utility scales & Agreement levels
Estimating the contribution of each potential answers
* Utility values indicate the overall contribution of each attribute to how the profiles were rated (e.g. whether number of meals is more important in vulnerability scoring than access to safe water).
* A higher _"utility"_ estimate indicates that this level contributes to a higher vulnerability than the level with the lower utility estimate (it does not give an absolute value for the utility of an option, but rather assumes a reference alternative).
* Standard deviation for each level within model allows to better understand how homogeneous the group of experts is with respect to one level.
4. Importance of each criteria
* Importance of each criteria represent the average importance as estimated from all experts.
* Importance values will then be used as the weights for each attribute inside each of our three dimensions.
* Importance values sum to 100
conjoint_review(kobodata, koboform, duration_min = 10, duration_max = 40)
conjoint_review(kobodata, koboform, duration_min = 10, duration_max = 40)
kobodata |
path to data collected through kobotoolbox |
koboform |
form used to collected through kobotoolbox quadratic survey |
duration_min |
used to filter down expert contribution that would have taken less than a certain number of minutes (default is 10) |
duration_max |
used to filter down expert contribution that would have taken more than a certain number of minutes (default is 40) |
a series of plot
kobodata <- system.file("data-demo/conjoint_data.xlsx", package = "VulnerabilityScoreCalibration") koboform <- system.file("data-demo/conjoint_form.xlsx", package = "VulnerabilityScoreCalibration") cj <- conjoint_review(kobodata, koboform) cj[["data_quality"]]
kobodata <- system.file("data-demo/conjoint_data.xlsx", package = "VulnerabilityScoreCalibration") koboform <- system.file("data-demo/conjoint_form.xlsx", package = "VulnerabilityScoreCalibration") cj <- conjoint_review(kobodata, koboform) cj[["data_quality"]]
Print out a summary from the conjoint analysis
conjoint_walk(dim, margins, amces, importance, ...)
conjoint_walk(dim, margins, amces, importance, ...)
dim |
dimension of analysis |
margins |
margins |
amces |
amces |
importance |
importance |
... |
other argument |
* Marginal Means
* Average Marginal Component Effects (AMCEs)
* Average Marginal Component Effects (AMCEs)
* Importance Weights
print some line for a notebook..
kobodata <- system.file("data-demo/conjoint_data.xlsx", package = "VulnerabilityScoreCalibration") koboform <- system.file("data-demo/conjoint_form.xlsx", package = "VulnerabilityScoreCalibration") cj <- conjoint_review(kobodata, koboform) cjdata <- cj[["cjdata"]] ## Get a summary of all dimensions purrr::pwalk(cjdata, conjoint_walk) ## Save a csv extract of the weights # purrr::walk2(cjdata$dim, cjdata$amces, ~write_csv(.y, fs::path(.x, ext = "csv"))) #all <- purrr::walk2(cjdata$amces, ~cbind()) all <-purrr::pwalk(cjdata$amces, rbind) all2 <- dplyr::bind_rows(cjdata$amces, .id = "column_label")
kobodata <- system.file("data-demo/conjoint_data.xlsx", package = "VulnerabilityScoreCalibration") koboform <- system.file("data-demo/conjoint_form.xlsx", package = "VulnerabilityScoreCalibration") cj <- conjoint_review(kobodata, koboform) cjdata <- cj[["cjdata"]] ## Get a summary of all dimensions purrr::pwalk(cjdata, conjoint_walk) ## Save a csv extract of the weights # purrr::walk2(cjdata$dim, cjdata$amces, ~write_csv(.y, fs::path(.x, ext = "csv"))) #all <- purrr::walk2(cjdata$amces, ~cbind()) all <-purrr::pwalk(cjdata$amces, rbind) all2 <- dplyr::bind_rows(cjdata$amces, .id = "column_label")
This function aims at quickly building a quadratic voting questionnaire
quadratic_prepare(indicator)
quadratic_prepare(indicator)
indicator |
a dataframe with max 5 groups of 5 indicators |
The questionnaire comes with limitation as it can process not more than 5 groups of maximum 5 indicators. Each indicators is associated to different levels that will be then assessed through conjoint analysis for the weighting stage
After quadratic voting, it is expected that the facilitation of the result interpretation should allow to reduce the numbers of indicators to a maximum of 12 indicators
a questionnaire...
indicator <- system.file("data-demo/indicator_criteria.xlsx", package = "VulnerabilityScoreCalibration") #quadratic_prepare(indicator)
indicator <- system.file("data-demo/indicator_criteria.xlsx", package = "VulnerabilityScoreCalibration") #quadratic_prepare(indicator)
Generate Report From Quadratic Voting
quadratic_report(data = "data.xlsx", form = "form.xlsx", folder = "data-raw")
quadratic_report(data = "data.xlsx", form = "form.xlsx", folder = "data-raw")
data |
name of the file with data collected through kobotoolbox should be xlsx |
form |
name of the file with form used to collected through kobotoolbox quadratic survey (should be xlsx) |
folder |
folder within your project where to put the generated report. Folder will be created if it does not exist |
nothing the file for the report is generated
## Example -> the report will be saved in the same folder... # quadratic_report(data = "data.xlsx", # form = "form.xlsx", # folder = "data-raw")
## Example -> the report will be saved in the same folder... # quadratic_report(data = "data.xlsx", # form = "form.xlsx", # folder = "data-raw")
Explore the results from a quadratic voting consultations. 1. What are the prioritized Topics? 2. How dispersed participants votes are? 3. Who is expecting or pushing back... on what?
quadratic_review(kobodata, koboform)
quadratic_review(kobodata, koboform)
kobodata |
path to data collected through kobotoolbox |
koboform |
form used to collected through kobotoolbox quadratic survey |
list with data and standard plots
# kobodata <- here::here("", "quadra_data.xlsx") # koboform <- here::here("", "survey_quadraticvoting_CBI_Indicators.xlsx") kobodata <- system.file("data-demo/quadra_data.xlsx", package = "VulnerabilityScoreCalibration") koboform <- system.file("data-demo/quadra_form.xlsx", package = "VulnerabilityScoreCalibration") ## Run the process result <- quadratic_review(kobodata, koboform) ## Review output result[["topic_prioritisation"]] result[["vote_dispersion"]] result[["individual_prioritisation"]]
# kobodata <- here::here("", "quadra_data.xlsx") # koboform <- here::here("", "survey_quadraticvoting_CBI_Indicators.xlsx") kobodata <- system.file("data-demo/quadra_data.xlsx", package = "VulnerabilityScoreCalibration") koboform <- system.file("data-demo/quadra_form.xlsx", package = "VulnerabilityScoreCalibration") ## Run the process result <- quadratic_review(kobodata, koboform) ## Review output result[["topic_prioritisation"]] result[["vote_dispersion"]] result[["individual_prioritisation"]]
Run the Shiny Application
run_app( onStart = NULL, options = list(), enableBookmarking = NULL, uiPattern = "/", ... )
run_app( onStart = NULL, options = list(), enableBookmarking = NULL, uiPattern = "/", ... )
onStart |
A function that will be called before the app is actually run.
This is only needed for |
options |
Named options that should be passed to the |
enableBookmarking |
Can be one of |
uiPattern |
A regular expression that will be applied to each |
... |
arguments to pass to golem_opts. See '?golem::get_golem_options' for more details. |
a shiny app
# run_app()
# run_app()