library(knitr)
opts_chunk$set(echo = FALSE, comment = NA)
## Data

dfr <- params$dfr
dfr <- dfr[, c("REP", "INSTN", "STYPE", "SCORE_MEN", "SCORE_WOMEN", "SCORE_GLOBAL")]
colnames(dfr)[4:6] <- c("Men", "Women", "Global")
nr <- length(unique(dfr$REP))
ds <- docomp(dfr, "sum", c("Men", "Women", "Global"), "INSTN")
ds <- tidyr::gather(ds, group, value, Men:Global)

## Sort by number of votes

tmp <- ds[ds$group == "Global", c("INSTN", "value")]
orden <- tmp$INSTN[sort(tmp$value, decreasing = TRUE, index.return = TRUE)$ix]
ds$INSTN <- factor(ds$INSTN, levels = orden)

## Count number of votes

nvm <- sum(ds[ds$group == "Men", "value"], na.rm = TRUE)
nvw <- sum(ds[ds$group == "Women", "value"], na.rm = TRUE)

## Count number of voters

nm <- round(nvm / 6 / nr)
nw <- round(nvw / 6 / nr)

## Compute percentage adjusted by gender

dsp <- ds[ds$group == "Global", ]
dsp$value <- dsp$value / (nvm + nvw)
tmp <- ds[ds$group != "Global", ]
tmp[tmp$group == "Men", "value"] <- tmp[tmp$group == "Men", "value"] / nvm / 2
tmp[tmp$group == "Women", "value"] <- tmp[tmp$group == "Women", "value"] / nvw / 2
tmp <- docomp(tmp, "sum", "value", "INSTN")
tmp$group <- "Global adjusted"
dsp <- rbind(dsp, tmp)
dsp$value <- round(dsp$value * 100, 1)

1. Voting process for the identification of best genotypes at post-harvest stage

A group of farmers, men and women, and other stakeholders are gathered and, after explanation of the overall objectives of the trial, they are asked to identify their three personal favorite genotypes. Then, they are requested to vote by giving:

Votes are recorded for men and women.

2. Best genotypes

The genotypes have been planted following a randomized complete block design with r nr blocks. A group of men and women voted independently for the best genotypes at each block, so each men and women voted r nr times.

ggplot(ds, aes(x = group, y = value, fill = INSTN)) +
  geom_bar(stat = "identity", position = "dodge", color = "black") + 
  labs(title = "Voting for best genotypes at post-harvest stage",
       x = "Group", y = "Number of votes") +
  geom_text(aes(label = value), vjust = 1.6, color = "white",
             position = position_dodge(0.9), size = 3)

Below a percentage graph is shown. On the right panel the percentages are adjusted by gender, thus trying to reflect what would have been obtained if the number of men and women would be the same in the sample.

ggplot(dsp, aes(x = group, y = value, fill = INSTN)) +
  geom_bar(stat = "identity", position = "dodge", color = "black") + 
  labs(title = "Voting for best genotypes at post-harvest stage",
       subtitle = "Percentages unadjusted and adjusted by gender",
       x = "Group", y = "Percentage of votes") +
  geom_text(aes(label = value), vjust = 1.6, color = "white",
             position = position_dodge(0.9), size = 3)

3. Friedman test for genotypes

3.1. Men's votes

friedman.t(dfr, 'Men', 'INSTN', 'REP')

3.2. Women's votes

friedman.t(dfr, 'Women', 'INSTN', 'REP')

3.3. Total votes

friedman.t(dfr, 'Global', 'INSTN', 'REP')


reyzaguirre/pepa documentation built on March 29, 2025, 9:56 p.m.