R package preparation

#install packages
library(ahpsurvey)
## Warning: package 'ahpsurvey' was built under R version 4.4.1
library(dplyr)
library(kableExtra)

Data inputs

Expert responses (raw data) on the Factor groups
nonmon_engagement <- c(7,7,-4,-7,7,-8,-5,-5,5,7,7,2,-7)
nonmon_enterprises <- c(5,5,4,1,7,-6,-3,-6,1,6,-6,1,3)
nonmon_cultural <- c(-5,6,5,-7,5,-5,-7,-7,5,7,8,-5,-6)
nonmon_support <- c(-7,4,1,-3,7,-8,-5,1,-5,6,7,6,6)
nonmon_energy <- c(-7,8,3,4,7,-9,-3,-3,-5,6,1,7,-7)
nonmon_govern <- c(8,5,7,1,9,-8,-3,5,5,8,9,8,7)
nonmon_networks <- c(-5,5,7,-5,8,-8,-7,1,-5,3,-3,4,-5)
nonmon_relations <- c(3,7,7,3,8,1,-4,1,-5,3,8,6,-6)
nonmon_citizen <- c(4,3,-5,-6,8,-7,-4,-3,-5,4,8,6,-6)
nonmon_viablebm <- c(-5,8,-5,-2,7,-6,-7,-4,8,6,8,5,6)
nonmon_financial <- c(7,8,7,8,9,-9,-3,3,8,8,9,8,3)
engagement_enterprises <- c(-5,5,4,4,8,1,-7,-4,-6,2,-6,2,6)
engagement_cultural <- c(-3,6,1,-4,8,-4,-7,-7,-6,3,1,-3,-8)
engagement_support <- c(-3,8,-6,-2,7,5,-4,2,-6,3,1,3,5)
engagement_energy <- c(-7,8,-7,3,8,9,-2,2,-6,5,6,7,-8)
engagement_govern <- c(1,3,-5,6,9,9,-3,5,1,5,6,8,4)
engagement_networks <- c(-5,3,1,1,8,5,-7,2,1,-3,1,3,-8)
engagement_relations <- c(1,6,1,1,8,3,-6,4,-6,-3,5,5,6)
engagement_citizen <- c(1,8,-6,1,8,8,-6,1,1,1,1,5,1)
engagement_viablebm <- c(-5,7,-6,4,7,1,-6,1,4,4,5,7,-6)
engagement_financial <- c(1,3,6,8,9,9,-3,3,6,4,7,9,5)
entreprises_cultural<- c(1,7,5,-5,6,8,5,1,1,-4,1,2,-7)
entreprises_support  <- c(-3,7,4,1,6,9,5,7,-5,-4,1,4,5)
entreprises_energy <- c(1,7,4,3,7,9,4,4,-5,3,5,7,-9)
entreprises_govern <- c(NA,9,6,3,9,9,3,7,1,-5,8,8,6)
entreprises_networks <- c(1,4,-4,1,7,3,3,5,5,-5,1,4,-4)
entreprises_relations <- c(3,5,-4,-3,7,7,2,7,-5,-2,7,5,5)
entreprises_citizen <- c(3,8,1,-3,7,1,5,6,-3,1,1,5,6)
entreprises_viablebm <- c(1,8,1,1,7,1,3,4,5,-4,5,8,3)
entreprises_financial <- c(5,8,6,8,9,9,3,4,7,5,7,9,6)
cultural_support  <- c(1,4,1,4,8,8,-3,7,-5,-4,1,5,7)
cultural_energy <- c(1,4,1,7,8,9,-2,4,3,1,6,8,-5)
cultural_govern <- c(3,7,1,9,9,9,6,7,1,-2,9,8,8)
cultural_networks <- c(-3,7,1,5,8,3,3,5,-4,-5,1,5,7)
cultural_relations <- c(1,5,1,1,8,5,-3,7,1,-4,5,7,8)
cultural_citizen <- c(3,6,1,2,8,4,-3,6,1,2,1,6,8)
cultural_viablebm <- c(1,8,1,9,8,1,-3,4,1,-4,6,7,7)
cultural_financial <- c(3,7,1,9,9,9,3,4,8,4,7,9,8)
support_energy <- c(1,8,-5,4,7,9,2,-3,-2,3,8,7,-9)
support_govern <- c(5,7,1,9,9,9,-2,5,4,4,8,8,1)
support_networks <- c(1,8,-4,1,8,4,3,1,-5,1,1,3,-8)
support_relations <- c(3,7,1,4,8,6,3,1,-3,1,6,4,-7)
support_citizen <- c(1,4,-7,1,8,3,2,-2,4,5,1,4,-8)
support_viablebm <- c(1,5,-4,5,8,2,2,-2,4,6,7,7,4)
support_financial <- c(3,8,-4,9,8,9,3,3,7,7,7,8,6)
energy_govern <- c(5,9,5,1,9,9,-2,7,3,3,5,6,9)
energy_networks <- c(1,3,5,-4,7,7,4,2,1,-3,-7,-5,7)
energy_relations <- c(1,7,5,-6,7,6,2,3,1,3,-7,-4,8)
energy_citizen <- c(1,7,-3,-6,7,4,5,1,4,3,1,-4,8)
energy_viablebm <- c(-3,7,1,1,7,5,3,1,4,4,1,6,8)
energy_financial <- c(3,8,5,6,9,9,-2,1,7,5,7,7,9)
govern_networks <- c(-5,8,-2,-8,-9,-9,3,-4,-4,-5,-8,-7,-8)
govern_relations <- c(-2,2,-2,-8,-9,-7,-6,1,-4,-3,-2,-5,1)
govern_citizen <- c(3,3,-6,-8,-9,-5,-2,-2,1,4,-8,-6,1)
govern_viablebm <- c(-2,8,-5,-6,-9,-3,1,-2,-3,2,1,-3,-8)
govern_financial <- c(1,8,1,1,-9,9,-2,-2,5,6,-5,5,1)
networks_relations <- c(6,4,1,1,8,-6,-2,2,1,4,1,4,6)
networks_citizen <- c(5,5,-4,1,8,-5,-5,1,1,7,5,1,6)
networks_viablebm <- c(1,7,-3,7,-8,-4,-5,1,2,6,8,6,7)
networks_financial <- c(5,7,1,9,9,9,-3,2,5,7,8,7,8)
relations_citizen <- c(1,5,-5,1,1,-6,-2,-2,1,3,1,-4,5)
relations_viablebm <- c(-5,7,-5,7,-6,1,-2,-3,3,3,5,7,4)
relations_financial <- c(-2,7,-5,8,9,9,-2,1,5,7,8,9,6)
citizen_viablebm <- c(-7,8,4,8,6,1,1,-2,3,-6,7,7,-4)
citizen_financial <- c(1,8,6,9,9,9,1,1,5,6,2,9,6)
viablebm_financial <- c(7,6,5,2,9,9,3,3,6,8,1,7,6)

factor_group <- data.frame(nonmon_engagement, nonmon_enterprises, nonmon_cultural, nonmon_support, nonmon_energy, nonmon_govern, nonmon_networks, nonmon_relations, nonmon_citizen, nonmon_viablebm, nonmon_financial, engagement_enterprises, engagement_cultural, engagement_support, engagement_energy, engagement_govern, engagement_networks, engagement_relations, engagement_citizen, engagement_viablebm, engagement_financial, entreprises_cultural, entreprises_support, entreprises_energy, entreprises_govern, entreprises_networks, entreprises_relations, entreprises_citizen, entreprises_viablebm, entreprises_financial, cultural_support, cultural_energy, cultural_govern, cultural_networks, cultural_relations, cultural_citizen, cultural_viablebm, cultural_financial, support_energy, support_govern, support_networks, support_relations, support_citizen, support_viablebm, support_financial, energy_govern, energy_networks, energy_relations, energy_citizen, energy_viablebm, energy_financial, govern_networks, govern_relations, govern_citizen, govern_viablebm, govern_financial, networks_relations, networks_citizen, networks_viablebm, networks_financial, relations_citizen, relations_viablebm, relations_financial, citizen_viablebm, citizen_financial, viablebm_financial)

colnames(factor_group) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59" ,"60","61","62","63","64","65")

rownames(factor_group) <- c("Expert #1", "Expert #2" , "Expert #3" , "Expert #4" ,"Expert #5", 
                                  "Expert #6", "Expert #7" , "Expert #8" , "Expert #9" , "Expert#10" , "Expert #11" , "Expert#12" , "Expert#13")

factor_group
##             1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## Expert #1   7  5 -5 -7 -7  8 -5  3  4 -5  7 -5 -3 -3 -7  1 -5  1  1 -5  1  1 -3
## Expert #2   7  5  6  4  8  5  5  7  3  8  8  5  6  8  8  3  3  6  8  7  3  7  7
## Expert #3  -4  4  5  1  3  7  7  7 -5 -5  7  4  1 -6 -7 -5  1  1 -6 -6  6  5  4
## Expert #4  -7  1 -7 -3  4  1 -5  3 -6 -2  8  4 -4 -2  3  6  1  1  1  4  8 -5  1
## Expert #5   7  7  5  7  7  9  8  8  8  7  9  8  8  7  8  9  8  8  8  7  9  6  6
## Expert #6  -8 -6 -5 -8 -9 -8 -8  1 -7 -6 -9  1 -4  5  9  9  5  3  8  1  9  8  9
## Expert #7  -5 -3 -7 -5 -3 -3 -7 -4 -4 -7 -3 -7 -7 -4 -2 -3 -7 -6 -6 -6 -3  5  5
## Expert #8  -5 -6 -7  1 -3  5  1  1 -3 -4  3 -4 -7  2  2  5  2  4  1  1  3  1  7
## Expert #9   5  1  5 -5 -5  5 -5 -5 -5  8  8 -6 -6 -6 -6  1  1 -6  1  4  6  1 -5
## Expert#10   7  6  7  6  6  8  3  3  4  6  8  2  3  3  5  5 -3 -3  1  4  4 -4 -4
## Expert #11  7 -6  8  7  1  9 -3  8  8  8  9 -6  1  1  6  6  1  5  1  5  7  1  1
## Expert#12   2  1 -5  6  7  8  4  6  6  5  8  2 -3  3  7  8  3  5  5  7  9  2  4
## Expert#13  -7  3 -6  6 -7  7 -5 -6 -6  6  3  6 -8  5 -8  4 -8  6  1 -6  5 -7  5
##            24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
## Expert #1   1 NA  1  3  3  1  5  1  1  3 -3  1  3  1  3  1  5  1  3  1  1  3  5
## Expert #2   7  9  4  5  8  8  8  4  4  7  7  5  6  8  7  8  7  8  7  4  5  8  9
## Expert #3   4  6 -4 -4  1  1  6  1  1  1  1  1  1  1  1 -5  1 -4  1 -7 -4 -4  5
## Expert #4   3  3  1 -3 -3  1  8  4  7  9  5  1  2  9  9  4  9  1  4  1  5  9  1
## Expert #5   7  9  7  7  7  7  9  8  8  9  8  8  8  8  9  7  9  8  8  8  8  8  9
## Expert #6   9  9  3  7  1  1  9  8  9  9  3  5  4  1  9  9  9  4  6  3  2  9  9
## Expert #7   4  3  3  2  5  3  3 -3 -2  6  3 -3 -3 -3  3  2 -2  3  3  2  2  3 -2
## Expert #8   4  7  5  7  6  4  4  7  4  7  5  7  6  4  4 -3  5  1  1 -2 -2  3  7
## Expert #9  -5  1  5 -5 -3  5  7 -5  3  1 -4  1  1  1  8 -2  4 -5 -3  4  4  7  3
## Expert#10   3 -5 -5 -2  1 -4  5 -4  1 -2 -5 -4  2 -4  4  3  4  1  1  5  6  7  3
## Expert #11  5  8  1  7  1  5  7  1  6  9  1  5  1  6  7  8  8  1  6  1  7  7  5
## Expert#12   7  8  4  5  5  8  9  5  8  8  5  7  6  7  9  7  8  3  4  4  7  8  6
## Expert#13  -9  6 -4  5  6  3  6  7 -5  8  7  8  8  7  8 -9  1 -8 -7 -8  4  6  9
##            47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 NA
## Expert #1   1  1  1 -3  3 -5 -2  3 -2  1  6  5  1  5  1 -5 -2 -7  1  7
## Expert #2   3  7  7  7  8  8  2  3  8  8  4  5  7  7  5  7  7  8  8  6
## Expert #3   5  5 -3  1  5 -2 -2 -6 -5  1  1 -4 -3  1 -5 -5 -5  4  6  5
## Expert #4  -4 -6 -6  1  6 -8 -8 -8 -6  1  1  1  7  9  1  7  8  8  9  2
## Expert #5   7  7  7  7  9 -9 -9 -9 -9 -9  8  8 -8  9  1 -6  9  6  9  9
## Expert #6   7  6  4  5  9 -9 -7 -5 -3  9 -6 -5 -4  9 -6  1  9  1  9  9
## Expert #7   4  2  5  3 -2  3 -6 -2  1 -2 -2 -5 -5 -3 -2 -2 -2  1  1  3
## Expert #8   2  3  1  1  1 -4  1 -2 -2 -2  2  1  1  2 -2 -3  1 -2  1  3
## Expert #9   1  1  4  4  7 -4 -4  1 -3  5  1  1  2  5  1  3  5  3  5  6
## Expert#10  -3  3  3  4  5 -5 -3  4  2  6  4  7  6  7  3  3  7 -6  6  8
## Expert #11 -7 -7  1  1  7 -8 -2 -8  1 -5  1  5  8  8  1  5  8  7  2  1
## Expert#12  -5 -4 -4  6  7 -7 -5 -6 -3  5  4  1  6  7 -4  7  9  7  9  7
## Expert#13   7  8  8  8  9 -8  1  1 -8  1  6  6  7  8  5  4  6 -4  6  6

Calculation of aggregated importance weights

atts <- c("nonmon", "engagement", "enterprises", "cultural", "support" , "energy" , "govern" , "networks" , "relations" , "citizen" , "viablebm" , "financial")

Factor_group <- factor_group %>%
  ahp.mat(atts = atts, negconvert = TRUE) %>% 
  ahp.missing(atts, round = T, limit = T) %>%
  ahp.aggpref(atts, method = "arithmetic")



importance_weights <- data.frame(Factor_group)

colnames(importance_weights) <- c("City responses")

rownames(importance_weights) <- c("Availability of non-monetary resources ", "Tenant engagement" , "New forms of non-profit enterprises" , "Cultural sensitivity" , "Support structures" , "Energy efficiency" , "Governmental support" , "Established networks" , "Relationships among stakeholders" , "Citizen engagement framework" , "Viable Business Models" , "Financial subsidies")

importance_weights %>% mutate_if(is.numeric, round, digits=3)
##                                         City responses
## Availability of non-monetary resources           0.083
## Tenant engagement                                0.069
## New forms of non-profit enterprises              0.044
## Cultural sensitivity                             0.040
## Support structures                               0.056
## Energy efficiency                                0.064
## Governmental support                             0.152
## Established networks                             0.055
## Relationships among stakeholders                 0.079
## Citizen engagement framework                     0.070
## Viable Business Models                           0.090
## Financial subsidies                              0.199

Calculation of Consistency ratio

atts <- c("nonmon", "engagement", "enterprises", "cultural", "support" , "energy" , "govern" , "networks" , "relations" , "citizen" , "viablebm" , "financial")

filling.factor_group <- factor_group %>% 
  ahp.mat(atts, negconvert = TRUE) %>%
  ahp.missing(atts, round = T, limit = T)

cr_fg <- filling.factor_group %>% ahp.cr(atts)


cr.value <- c(round(mean(cr_fg),2))

factor_group <- c("Consistency ratio")

cr.frame <- data.frame(factor_group, cr.value)
colnames(cr.frame) <- c("", "Value")
cr.frame
##                     Value
## 1 Consistency ratio  0.26