Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicator pro cc #177

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Indicators/Protection-CRF-CC1-1/pro-CC-1-1.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*------------------------------------------------------------------------------*
* WFP Standardized Scripts
* Security Challenges Indicator
*------------------------------------------------------------------------------*

* This script processes the security challenges indicator by assessing
* whether households have experienced any security challenge related to WFP assistance.

* Define variable and value labels.
label variable HHAsstSecurity "Have you or any of your household members experienced any security challenge related to WFP assistance?"
label define HHAsstSecurity_lbl 0 "No" 1 "Yes" 888 "Don't know"
label values HHAsstSecurity HHAsstSecurity_lbl

* Display frequency of HHAsstSecurity.
tabulate HHAsstSecurity

* Create a table of the weighted percentage of HHAsstSecurity.
cap gen WeightHH = 1
tabulate HHAsstSecurity [aw = WeightHH]

* End of Scripts.
31 changes: 31 additions & 0 deletions Indicators/Protection-CRF-CC1-1/pro-CC-1-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#------------------------------------------------------------------------------#
# WFP Standardized Scripts
# Security Challenges Indicator
#------------------------------------------------------------------------------#

# This script processes the security challenges indicator by assessing
# whether households have experienced any security challenge related to WFP assistance.

import pandas as pd
import numpy as np

# Add sample data.
#data = pd.read_csv("~/GitHub/RAMResourcesScripts/Static/PROP_AAP_CRF_Sample_Survey.csv")

# Assign variable and value labels.
data['HHAsstSecurity'] = data['HHAsstSecurity'].astype('category')
data['HHAsstSecurity'].cat.rename_categories({
0: 'No',
1: 'Yes',
888: 'Don\'t know'
}, inplace=True)

# Create a table of the weighted percentage of HHAsstSecurity.
HHAsstSecurity_table = data['HHAsstSecurity'].value_counts(normalize=True).reset_index()
HHAsstSecurity_table.columns = ['HHAsstSecurity', 'Percentage']
HHAsstSecurity_table['Percentage'] *= 100

# Print the table.
print(HHAsstSecurity_table)

# End of Scripts
18 changes: 13 additions & 5 deletions Indicators/Protection-CRF-CC1-1/pro-CC-1-1.sps
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
* Encoding: UTF-8.
********************************************************************************
* WFP Standardized Scripts
* Security Challenges Indicator
********************************************************************************

* define variable and value labels
* This script processes the security challenges indicator by assessing
* whether households have experienced any security challenge related to WFP assistance.

Variable labels HHAsstSecurity ‘Have you or any of your household members experienced any security challenge related to WFP assistance?’.
* Define variable and value labels.

Value labels HHAsstSecurity 1 'Yes' 0 'No '.
VARIABLE LABELS HHAsstSecurity "Have you or any of your household members experienced any security challenge related to WFP assistance?".
VALUE LABELS HHAsstSecurity 1 'Yes' 0 'No' 888 'Don\'t know'.

freq HHAsstSecurity.
* Display frequency of HHAsstSecurity.
FREQUENCIES VARIABLES = HHAsstSecurity.

* End of Scripts.
29 changes: 18 additions & 11 deletions Indicators/Protection-CRF-CC1-1/pro-CC-1-1_tidyverse.R
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
#------------------------------------------------------------------------------#
# WFP Standardized Scripts
# Security Challenges Indicator
#------------------------------------------------------------------------------#

# This script processes the security challenges indicator by assessing
# whether households have experienced any security challenge related to WFP assistance.

library(tidyverse)
library(expss)
library(labelled)

#add sample data
data <- read_csv("~/GitHub/RAMResourcesScripts/Static/PROP_AAP_CRF_Sample_Survey.csv")
# Add sample data.
#data <- read_csv("~/GitHub/RAMResourcesScripts/Static/PROP_AAP_CRF_Sample_Survey.csv")

#assign variable and value labels
# Assign variable and value labels.
var_label(data$HHAsstSecurity) <- "Have you or any of your household members experienced any security challenge related to WFP assistance?"
val_lab(data$HHAsstSecurity) = num_lab("
0 No
1 Yes
888 Don't know
")


#creates a table of the weighted percentage of HHAsstSecurity by
#creating a temporary variable to display value labels
#and providing the option to use weights if needed


# Create a table of the weighted percentage of HHAsstSecurity.
HHAsstSecurity_table_wide <- data %>%
drop_na(HHAsstSecurity) %>%
count(HHAsstSecurity_lab = as.character(HHAsstSecurity)) %>% # if weights are needed use instead the row below
#count(HHAsstSecurity_lab = as.character(HHAsstSecurity), wt = nameofweightvariable)
count(HHAsstSecurity_lab = as.character(HHAsstSecurity)) %>%
mutate(Percentage = 100 * n / sum(n)) %>%
ungroup() %>% select(-n) %>%
pivot_wider(names_from = HHAsstSecurity_lab,
values_from = Percentage,
values_fill = 0)

# Print the table.
print(HHAsstSecurity_table_wide)

# End of Scripts.
21 changes: 21 additions & 0 deletions Indicators/Protection-CRF-CC1-2/pro-CC-1-2.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*------------------------------------------------------------------------------*
* WFP Standardized Scripts
* Access Challenges Indicator
*------------------------------------------------------------------------------*

* This script processes the access challenges indicator by assessing
* whether households have been unable to access WFP assistance one or more times.

* Define variable and value labels.
label variable HHAsstAccess "Have you or any member of your household been unable to access WFP assistance one or more times?"
label define HHAsstAccess_lbl 0 "No" 1 "Yes" 888 "Don't know"
label values HHAsstAccess HHAsstAccess_lbl

* Display frequency of HHAsstAccess.
tabulate HHAsstAccess

* Create a table of the weighted percentage of HHAsstAccess.
cap gen WeightHH = 1
tabulate HHAsstAccess [aw = WeightHH]

* End of Scripts.
31 changes: 31 additions & 0 deletions Indicators/Protection-CRF-CC1-2/pro-CC-1-2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#------------------------------------------------------------------------------#
# WFP Standardized Scripts
# Access Challenges Indicator
#------------------------------------------------------------------------------#

# This script processes the access challenges indicator by assessing
# whether households have been unable to access WFP assistance one or more times.

import pandas as pd
import numpy as np

# Add sample data.
#data = pd.read_csv("Static/PROP_AAP_CRF_Sample_Survey.csv")

# Assign variable and value labels.
data['HHAsstAccess'] = data['HHAsstAccess'].astype('category')
data['HHAsstAccess'].cat.rename_categories({
0: 'No',
1: 'Yes',
888: 'Don\'t know'
}, inplace=True)

# Create a table of the weighted percentage of HHAsstAccess.
HHAsstAccess_table = data['HHAsstAccess'].value_counts(normalize=True).reset_index()
HHAsstAccess_table.columns = ['HHAsstAccess', 'Percentage']
HHAsstAccess_table['Percentage'] *= 100

# Print the table.
print(HHAsstAccess_table)

# End of Scripts.
18 changes: 14 additions & 4 deletions Indicators/Protection-CRF-CC1-2/pro-CC-1-2.sps
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
* Encoding: UTF-8.
********************************************************************************
* WFP Standardized Scripts
* Access Challenges Indicator
********************************************************************************

Variable labels HHAsstAccess ‘Have you or any member of your household been unable to access WFP assistance one or more times?’.
* This script processes the access challenges indicator by assessing
* whether households have been unable to access WFP assistance one or more times.

Value labels HHAsstAccess 1 'Yes' 0 'No ' 888 "Don't know".
* Define variable and value labels.

freq HHAsstAccess.
VARIABLE LABELS HHAsstAccess "Have you or any member of your household been unable to access WFP assistance one or more times?".
VALUE LABELS HHAsstAccess 1 'Yes' 0 'No' 888 'Don\'t know'.

* Display frequency of HHAsstAccess.
FREQUENCIES VARIABLES = HHAsstAccess.

* End of Scripts.
29 changes: 17 additions & 12 deletions Indicators/Protection-CRF-CC1-2/pro-CC-1-2_tidyverse.R
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
#------------------------------------------------------------------------------#
# WFP Standardized Scripts
# Access Challenges Indicator
#------------------------------------------------------------------------------#

# This script processes the access challenges indicator by assessing
# whether households have been unable to access WFP assistance one or more times.

library(tidyverse)
library(expss)
library(labelled)

#add sample data
data <- read_csv("Static/PROP_AAP_CRF_Sample_Survey.csv")
# Add sample data.
#data <- read_csv("Static/PROP_AAP_CRF_Sample_Survey.csv")

#assign variable and value labels
# Assign variable and value labels.
var_label(data$HHAsstAccess) <- "Have you or any member of your household been unable to access WFP assistance one or more times?"
val_lab(data$HHAsstAccess) = num_lab("
0 No
1 Yes
888 Don't know
")


#creates a table of the weighted percentage of HHAsstAccess by
#creating a temporary variable to display value labels
#and providing the option to use weights if needed


# Create a table of the weighted percentage of HHAsstAccess.
HHAsstAccess_table_wide <- data %>%
drop_na(HHAsstAccess) %>%
count(HHAsstAccess_lab = as.character(HHAsstAccess)) %>% # if weights are needed use instead the row below
#count(HHAsstAccess_lab = as.character(HHAsstAccess), wt = nameofweightvariable)
count(HHAsstAccess_lab = as.character(HHAsstAccess)) %>%
mutate(Percentage = 100 * n / sum(n)) %>%
ungroup() %>% select(-n) %>%
pivot_wider(names_from = HHAsstAccess_lab,
values_from = Percentage,
values_fill = 0)


# Print the table.
print(HHAsstAccess_table_wide)

# End of Scripts.
30 changes: 30 additions & 0 deletions Indicators/Protection-CRF-CC1-3/pro-CC-1-3.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
*------------------------------------------------------------------------------*
* WFP Standardized Scripts
* Respect and Dignity in WFP Programmes
*------------------------------------------------------------------------------*

* This script processes the indicators related to whether households feel
* respected and dignified while engaging in WFP programmes.

* Define variable and value labels.
label variable HHAsstRespect "Do you think WFP and/or partner staff have treated you and members of your household respectfully?"
label variable HHDTPDign "Do you think the conditions of WFP programme sites are dignified?"

label define YesNo 1 "Yes" 0 "No"
label values HHAsstRespect HHDTPDign YesNo

* Cross tabulate to see how many are "Yes" in both questions.
tabulate HHAsstRespect HHDTPDign

* Calculate indicator.
gen HHAsstRespectDign = (HHAsstRespect == 1 & HHDTPDign == 1)
replace HHAsstRespectDign = 0 if HHAsstRespectDign == .

label variable HHAsstRespectDign "Treated with respect while engaging in WFP programs"
label define RespectDignity 0 "No" 1 "Yes"
label values HHAsstRespectDign RespectDignity

* Display frequency of HHAsstRespectDign.
tabulate HHAsstRespectDign

* End of Scripts.
39 changes: 39 additions & 0 deletions Indicators/Protection-CRF-CC1-3/pro-CC-1-3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#------------------------------------------------------------------------------#
# WFP Standardized Scripts
# Respect and Dignity in WFP Programmes
#------------------------------------------------------------------------------#

# This script processes the indicators related to whether households feel
# respected and dignified while engaging in WFP programmes.

import pandas as pd
import numpy as np

# Add sample data.
#data = pd.read_csv("Static/PROP_AAP_CRF_Sample_Survey.csv")

# Assign variable and value labels.
data['HHAsstRespect'] = data['HHAsstRespect'].astype('category')
data['HHAsstRespect'].cat.rename_categories({
0: 'No',
1: 'Yes'
}, inplace=True)

data['HHDTPDign'] = data['HHDTPDign'].astype('category')
data['HHDTPDign'].cat.rename_categories({
0: 'No',
1: 'Yes'
}, inplace=True)

# Calculate indicator.
data['HHAsstRespectDign'] = np.where((data['HHAsstRespect'] == 'Yes') & (data['HHDTPDign'] == 'Yes'), 'Yes', 'No')

# Create a table of the weighted percentage of HHAsstRespectDign.
HHAsstRespectDign_table = data['HHAsstRespectDign'].value_counts(normalize=True).reset_index()
HHAsstRespectDign_table.columns = ['HHAsstRespectDign', 'Percentage']
HHAsstRespectDign_table['Percentage'] *= 100

# Print the table.
print(HHAsstRespectDign_table)

# End of Scripts.
45 changes: 29 additions & 16 deletions Indicators/Protection-CRF-CC1-3/pro-CC-1-3.sps
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
* Encoding: UTF-8.
********************************************************************************
* WFP Standardized Scripts
* Respect and Dignity in WFP Programmes
********************************************************************************

Variable labels HHAsstRespect ‘Do you think WFPandor partner staff have treated you and members of your household respectfully? ’.
* This script processes the indicators related to whether households feel
* respected and dignified while engaging in WFP programmes.

Variable labels HHDTPDign ‘Do you think the conditions of WFP programme sites are dignified?’.
* Define variable and value labels.
VARIABLE LABELS
HHAsstRespect "Do you think WFP and/or partner staff have treated you and members of your household respectfully?".
VARIABLE LABELS
HHDTPDign "Do you think the conditions of WFP programme sites are dignified?".

Value labels HHAsstRespect HHDTPDign 1 'Yes' 0 'No'.

* cross tab first to see how many are "Yes" in both questions
VALUE LABELS HHAsstRespect HHDTPDign
1 'Yes'
0 'No'.

* Cross tabulate to see how many are "Yes" in both questions.
CROSSTABS
/TABLES=HHAsstRespect BY HHDTPDign
/FORMAT=AVALUE TABLES
/CELLS=COUNT
/COUNT ROUND CELL.

DO IF (HHAsstRespect = 1) & (HHDTPDign = 1).
COMPUTE HHAsstRespectDign = 1.
ELSE.
COMPUTE HHAsstRespectDign = 0.
END IF.

do if (HHAsstRespect = 1) & (HHDTPDign = 1).
compute HHAsstRespectDign = 1.
Else.
Compute HHAsstRespectDign = 0.
End if.
VARIABLE LABELS
HHAsstRespectDign "Treated with respect while engaging in WFP programs".
VALUE LABELS
HHAsstRespectDign
0 'No'
1 'Yes'.

variable labels HHAsstRespectDign "Treated with respect while engaging in WFP programs".
value labels HHAsstRespectDign
0 "No"
1 "Yes".
* Display frequency of HHAsstRespectDign.
FREQUENCIES VARIABLES = HHAsstRespectDign.

freq HHAsstRespectDign.
* End of Scripts.
Loading