Package 'VulnerabilityScoreCalibration'

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-06-29 02:46:03 UTC
Source: https://github.com/unhcr-americas/VulnerabilityScoreCalibration

Help Index


conjoint_plot_bar

Description

Plot results per dimension - Average Marginal Component Effects (AMCEs)

Usage

conjoint_plot_bar(.x)

Arguments

.x

A list or atomic vector.

Value

gggplot2 graph

a ggplot2 object

Examples

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")

conjoint_plot_point

Description

Plot results per dimension - Marginal Means

Usage

conjoint_plot_point(.x)

Arguments

.x

A list or atomic vector.

Value

a ggplot2 object

Examples

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")

conjoint_prepare

Description

Generate an xlsform used to perform consultation for conjoint analysis.

Usage

conjoint_prepare(
  opts,
  language = "English (en)",
  form_title = "Conjoint Review",
  id_string = "conjoint_rev",
  outdir = "data-raw",
  outfile = "conjoint_form.xlsx"
)

Arguments

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...

Details

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

Value

a file in xlsform format

Examples

# 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" )

conjoint_review

Description

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

Usage

conjoint_review(kobodata, koboform, duration_min = 10, duration_max = 40)

Arguments

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)

Value

a series of plot

Examples

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"]]

conjoint_walk

Description

Print out a summary from the conjoint analysis

Usage

conjoint_walk(dim, margins, amces, importance, ...)

Arguments

dim

dimension of analysis

margins

margins

amces

amces

importance

importance

...

other argument

Details

* Marginal Means

* Average Marginal Component Effects (AMCEs)

* Average Marginal Component Effects (AMCEs)

* Importance Weights

Value

print some line for a notebook..

Examples

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")

quadratic_prepare

Description

This function aims at quickly building a quadratic voting questionnaire

Usage

quadratic_prepare(indicator)

Arguments

indicator

a dataframe with max 5 groups of 5 indicators

Details

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

Value

a questionnaire...

Examples

indicator <-  system.file("data-demo/indicator_criteria.xlsx", 
                          package = "VulnerabilityScoreCalibration")
#quadratic_prepare(indicator)

Generate Report From Quadratic Voting

Description

Generate Report From Quadratic Voting

Usage

quadratic_report(data = "data.xlsx", form = "form.xlsx", folder = "data-raw")

Arguments

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

Value

nothing the file for the report is generated

Examples

## Example -> the report will be saved in the same folder...
# quadratic_report(data = "data.xlsx",
#                  form = "form.xlsx",
#                  folder = "data-raw")

quadratic_review

Description

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?

Usage

quadratic_review(kobodata, koboform)

Arguments

kobodata

path to data collected through kobotoolbox

koboform

form used to collected through kobotoolbox quadratic survey

Value

list with data and standard plots

Examples

# 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

Description

Run the Shiny Application

Usage

run_app(
  onStart = NULL,
  options = list(),
  enableBookmarking = NULL,
  uiPattern = "/",
  ...
)

Arguments

onStart

A function that will be called before the app is actually run. This is only needed for shinyAppObj, since in the shinyAppDir case, a global.R file can be used for this purpose.

options

Named options that should be passed to the runApp call (these can be any of the following: "port", "launch.browser", "host", "quiet", "display.mode" and "test.mode"). You can also specify width and height parameters which provide a hint to the embedding environment about the ideal height/width for the app.

enableBookmarking

Can be one of "url", "server", or "disable". The default value, NULL, will respect the setting from any previous calls to enableBookmarking(). See enableBookmarking() for more information on bookmarking your app.

uiPattern

A regular expression that will be applied to each GET request to determine whether the ui should be used to handle the request. Note that the entire request path must match the regular expression in order for the match to be considered successful.

...

arguments to pass to golem_opts. See '?golem::get_golem_options' for more details.

Value

a shiny app

Examples

# run_app()