class: center, middle, inverse, title-slide # AHP Implementada em R ## LatiR-2019 ### Luciane Alcoforado, Orlando Longo,
Lyncoln Sousa, Steven Ross,
Alessandra Simão ### Universidade Federal Fluminense
Programa de Pós-Graduação em Engenharia Civil --- <style type="text/css"> body, td { font-size: 14px; } code.r{ font-size: 20px; } pre { font-size: 20px } .remark-slide-content { font-size: 28px; padding: 20px 80px 20px 80px; } .remark-code, .remark-inline-code { background: #000000; } .remark-code { font-size: 16px; } </style> Estudo sobre o método AHP e criação de um pacote. Projeto PIBIC 2018/19 - Universidade Federal Fluminense Grupo de Pesquisa: Estatística com R Início: agosto de 2018 Plataforma Github Linguagem: R --- class: center, middle # Tomar una decisión, establecer una meta ### Comprar un automóvil ### Elige un programa ### Elige un lugar de vacaciones --- class: inverse, middle # ¿Cuales son las alternativas? ### Comprar un automóvil: Modelo A, B o C ### Elige un programa: R, Python, C++ o Java ### Elige un lugar de vacaciones: Rio de Janeiro, Santiago de Chile o Buenos Aires --- class: center, middle # Estoy 100% seguro de que estoy 0% seguro de lo que voy a hacer  --- class: inverse, center, middle # ¿Cuales son los criterios? ###comodidad, precio, prestigio, mantenimiento --- class: inverse, center, middle ## ¿Cuál es el método para tomar una decisión? #Puedes elegir AHP --- class: center, middle # buena elección!  ###El fin de tus dudas --- # Método Utilizado para tomar una decisión **AHP** (Analytic Hierarchy Process) fue creado por Saaty en 1970 se divide en tres pasos: - construcción de niveles jerárquicos; - Establecimiento de prioridades mediante juicios iguales de los criterios establecido ; - evaluación de la coherencia lógica de los juicios de paridad. --- #Prioridades -Calcule los pesos de cada nivel y los pesos de las alternativas -Ranquear as alternativas --- #Matriz de Paridad o Matriz de Juicio <style type="text/css"> .tg {border-collapse:collapse;border-spacing:0;} .tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;} .tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;} .tg .tg-bkfv{font-weight:bold;font-size:28px;background-color:#ffffff;border-color:#000000;text-align:center;vertical-align:top} .tg .tg-zafg{font-size:28px;background-color:#ffffff;border-color:#000000;text-align:center;vertical-align:top} .tg .tg-913x{font-weight:bold;font-size:28px;background-color:#ffffff;border-color:inherit;text-align:center;vertical-align:top} .tg .tg-xpm5{font-size:28px;background-color:#c0c0c0;border-color:#000000;text-align:center;vertical-align:top} </style> <table class="tg"> <tr> <th class="tg-bkfv">Criterios</th> <th class="tg-bkfv"> C1 </th> <th class="tg-bkfv"> C2 </th> <th class="tg-bkfv"> C3 </th> </tr> <tr> <td class="tg-913x"> C1 </td> <td class="tg-xpm5">1</td> <td class="tg-zafg">4</td> <td class="tg-zafg">1/6</td> </tr> <tr> <td class="tg-913x"> C2 </td> <td class="tg-zafg">1/4</td> <td class="tg-xpm5">1</td> <td class="tg-zafg">5</td> </tr> <tr> <td class="tg-913x"> C3 </td> <td class="tg-zafg">6</td> <td class="tg-zafg">1/5</td> <td class="tg-xpm5">1</td> </tr> </table> ###Recíproco de pares: si C1 es más importante que C2, entonces C2 es menos importante que C1 ##juicios coherentes entre pares e entre todos --- #Matriz de Paridad o Matriz de Juicio <style type="text/css"> .tg {border-collapse:collapse;border-spacing:0;} .tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;} .tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;} .tg .tg-bkfv{font-weight:bold;font-size:28px;background-color:#ffffff;border-color:#000000;text-align:center;vertical-align:top} .tg .tg-zafg{font-size:28px;background-color:#ffffff;border-color:#000000;text-align:center;vertical-align:top} .tg .tg-913x{font-weight:bold;font-size:28px;background-color:#ffffff;border-color:inherit;text-align:center;vertical-align:top} .tg .tg-xpm5{font-size:28px;background-color:#c0c0c0;border-color:#000000;text-align:center;vertical-align:top} </style> <table class="tg"> <tr> <th class="tg-bkfv">Criterios</th> <th class="tg-bkfv"> C1 </th> <th class="tg-bkfv"> C2 </th> <th class="tg-bkfv"> C3 </th> </tr> <tr> <td class="tg-913x"> C1 </td> <td class="tg-xpm5">1</td> <td class="tg-zafg">4</td> <td class="tg-zafg">1/6</td> </tr> <tr> <td class="tg-913x"> C2 </td> <td class="tg-zafg">1/4</td> <td class="tg-xpm5">1</td> <td class="tg-zafg">5</td> </tr> <tr> <td class="tg-913x"> C3 </td> <td class="tg-zafg">6</td> <td class="tg-zafg">1/5</td> <td class="tg-xpm5">1</td> </tr> </table> ###C1 es mas importante que C2 que es mas importante que C3 así que C1 es mas importante que C3 C1 a juicio era menos importante que C3 inconsistencia! --- #Probar la consistencia de los juicios IC = <a href="https://www.codecogs.com/eqnedit.php?latex=\dpi{120}&space;\LARGE&space;\frac{\lambda_{max}&space;-n}{n-1}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\dpi{120}&space;\LARGE&space;\frac{\lambda_{max}&space;-n}{n-1}" title="\LARGE \frac{\lambda_{max} -n}{n-1}" /></a> <a href="https://www.codecogs.com/eqnedit.php?latex=\LARGE&space;\lambda&space;_{max}&space;=" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\LARGE&space;\lambda&space;_{max}&space;=" title="\LARGE \lambda _{max} =" /></a> maior autovalor da matriz de paridad n = número de criterios IA = índice de consistencia aleatorio (tabulado) ##Grado de consistencia para cada matriz CR = IC/IA < 0.1 ou 10% --- #Instalación de paquete ```r #install.packages("devtools") #devtools::install_github("Lyncoln/AHP2") library(AHP) ```  --- #Pruebe consistencia de matriz: CR() <style type="text/css"> .tg {border-collapse:collapse;border-spacing:0;} .tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;} .tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;} .tg .tg-bkfv{font-weight:bold;font-size:28px;background-color:#ffffff;border-color:#000000;text-align:center;vertical-align:top} .tg .tg-zafg{font-size:28px;background-color:#ffffff;border-color:#000000;text-align:center;vertical-align:top} .tg .tg-913x{font-weight:bold;font-size:28px;background-color:#ffffff;border-color:inherit;text-align:center;vertical-align:top} .tg .tg-xpm5{font-size:28px;background-color:#c0c0c0;border-color:#000000;text-align:center;vertical-align:top} </style> <table class="tg"> <tr> <th class="tg-bkfv">Criterios</th> <th class="tg-bkfv"> C1 </th> <th class="tg-bkfv"> C2 </th> <th class="tg-bkfv"> C3 </th> </tr> <tr> <td class="tg-913x"> C1 </td> <td class="tg-xpm5">1</td> <td class="tg-zafg">4</td> <td class="tg-zafg">1/6</td> </tr> <tr> <td class="tg-913x"> C2 </td> <td class="tg-zafg">1/4</td> <td class="tg-xpm5">1</td> <td class="tg-zafg">5</td> </tr> <tr> <td class="tg-913x"> C3 </td> <td class="tg-zafg">6</td> <td class="tg-zafg">1/5</td> <td class="tg-xpm5">1</td> </tr> </table> ```r library(AHP) M = cbind(C1 = c(1, 1/4, 6), C2 = c(4, 1, 1/5), C3 = c(1/6, 5, 1)) CR(M) #Inconsistente para CR > 0.1 ``` ``` ## [1] 3.014581 ``` --- #Crea matrices emparejadas y pruebe su consistencia: matrizJulgamento()  **matriz_julgamento(qtd_comparacoes, CR = TRUE, qtd_matrizes = 1)** --- #Bases de datos ejemplos : BD1, BD2, BD3, BD4 - tablas en xlsx ###Jerarquía BD1: comprar un auto, 5 criterios, 3 alternativas 6 tablas: 1 paridad entre criterios e 5 paridad entre alternativas para cada criterio ```r library(AHP) summary(BD1) ``` ``` ## Length Class Mode ## Comprar um carro 5 tbl_df list ## CF 3 tbl_df list ## AQ 3 tbl_df list ## PS 3 tbl_df list ## RV 3 tbl_df list ## MA 3 tbl_df list ``` --- ###Esquematicamente  --- ###Alternativas <style> figure:hover{ -webkit-transform:rotate(-5deg); } figure{ background-color: white; width: 200px; text-align: center; padding: 15px; font-family: 'Comic Sans MS', cursive; border: 1px solid white; margin: auto; } #topo{ text-align: center; } </style> <section id="topo"> <figure id="A"> <img src="figuras//pen.gif"/> <figcaption>A</figcaption> </figure> <figure id="B"> <img src="figuras//dic2.gif"/> <figcaption>B</figcaption> </figure> <figure id="C"> <img src="figuras//ani.gif"/> <figcaption>C</figcaption> </figure> </section> --- #Jerarquía BD1: comprar un auto Cinco criterios (un nivel) ```r library(AHP) BD1[1] #matriz de paridad nível criterios ``` ``` ## $`Comprar um carro` ## # A tibble: 5 x 5 ## ...1 ...2 ...3 ...4 ...5 ## <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 1 0.2 3 0.2 0.333 ## 2 5 1 5 3 3 ## 3 0.333 0.2 1 0.333 0.333 ## 4 5 0.333 3 1 1 ## 5 3 0.333 3 1 1 ``` --- #BD1 comprar un auto ###Cinco criterios: CF (conforto), AQ (aquisição), PS (prestígio), RV (revenda), MA (manutenção) ###Tres Alternativas: A, B e C (modelos de autos) ```r library(AHP) BD1[2] #matriz de paridad critério 1: conforto ``` ``` ## $CF ## # A tibble: 3 x 3 ## ...1 ...2 ...3 ## <dbl> <dbl> <dbl> ## 1 1 0.333 0.167 ## 2 3 1 0.5 ## 3 6 2 1 ``` --- ###Cinco criterios: CF (conforto), AQ (aquisição), PS (prestígio), RV (revenda), MA (manutenção) ###Tres Alternativas: A, B e C (modelos de autos) ```r library(AHP) BD1[3] #matriz de paridad critério 2: aquisição ``` ``` ## $AQ ## # A tibble: 3 x 3 ## ...1 ...2 ...3 ## <dbl> <dbl> <dbl> ## 1 1 0.5 0.5 ## 2 2 1 2 ## 3 2 0.5 1 ``` etcétera ... --- #Cálculo del grado de consistencia: CR() para cada una de las 6 matrices/tablas ```r lapply(BD1, function(x) CR(x)) ``` ``` ## $`Comprar um carro` ## [1] 0.07091014 ## ## $CF ## [1] 4.270089e-16 ## ## $AQ ## [1] 0.05155921 ## ## $PS ## [1] 0.05155921 ## ## $RV ## [1] 0.008848762 ## ## $MA ## [1] 0.03702989 ``` --- #Cálculo de peso matricial: calcula_prioridades() ```r calcula_prioridades(BD1)[1] ``` ``` ## $`Comprar um carro` ## [1] 0.08627388 0.44979358 0.05881037 0.21879372 0.18632845 ```  --- #Pesos ```r calcula_prioridades(BD1) ``` ``` ## $`Comprar um carro` ## [1] 0.08627388 0.44979358 0.05881037 0.21879372 0.18632845 ## ## $CF ## [1] 0.1 0.3 0.6 ## ## $AQ ## [1] 0.1958004 0.4933860 0.3108137 ## ## $PS ## [1] 0.4125989 0.3274800 0.2599210 ## ## $RV ## [1] 0.5396146 0.2969613 0.1634241 ## ## $MA ## [1] 0.6369856 0.1047294 0.2582850 ``` --- #Aplique ahp a una lista de matriz con formato adecuado: ahp_geral() ```r tabela = ahp_geral(BD1) # No tiene subcriterios tabela ``` ``` ## # A tibble: 6 x 6 ## Criterios Pesos A B C CR ## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 ---Comprar um carro 1 0.358 0.352 0.291 7.09e- 2 ## 2 --CF 0.0863 0.00863 0.0259 0.0518 4.27e-16 ## 3 --AQ 0.450 0.0881 0.222 0.140 5.16e- 2 ## 4 --PS 0.0588 0.0243 0.0193 0.0153 5.16e- 2 ## 5 --RV 0.219 0.118 0.0650 0.0358 8.85e- 3 ## 6 --MA 0.186 0.119 0.0195 0.0481 3.70e- 2 ``` **ahp_geral(base, mapeamento = "PADRÃO", nomes_alternativas = "PADRÃO")** --- #Clasifique las alternativas de una tabla ahp: ranque() ```r ranque(tabela) ``` ``` ## # A tibble: 3 x 3 ## Ranque Alternativas Pesos ## <int> <chr> <dbl> ## 1 1 A 0.358 ## 2 2 B 0.352 ## 3 3 C 0.291 ``` <div class="box"> <img src="figuras//pen.gif"/> <span> A </span> </div> <style> div.box { width: 250px; display: inline-block; } </style> --- #Formatea la tabla de resultados para la exportación: formata_tabela() ```r formata_tabela(tabela) ``` <table class="table table-condensed"> <thead> <tr> <th style="text-align:left;"> Criterios </th> <th style="text-align:center;"> Pesos </th> <th style="text-align:center;"> A </th> <th style="text-align:center;"> B </th> <th style="text-align:center;"> C </th> <th style="text-align:center;"> CR </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">---Comprar um carro</span> </td> <td style="text-align:center;"> <span>100% </span> </td> <td style="text-align:center;"> <span style="font-weight: bold; font-size: 130%">35.77%</span> </td> <td style="text-align:center;"> <span>35.16%</span> </td> <td style="text-align:center;"> <span>29.07%</span> </td> <td style="text-align:center;"> <span style="background-color: #B0FFD5; border-radius: 4px; color: black; display: block">7.09%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--CF </span> </td> <td style="text-align:center;"> <span style="background-color: #d6f3e3; border-radius: 4px; color: black; display: block">8.63% </span> </td> <td style="text-align:center;"> <span style="background-color: #b6d4ff; border-radius: 4px; color: black; display: block">0.86% </span> </td> <td style="text-align:center;"> <span style="background-color: #a7cafb; border-radius: 4px; color: black; display: block">2.59% </span> </td> <td style="text-align:center;"> <span style="background-color: #91bcf6; border-radius: 4px; color: black; display: block">5.18% </span> </td> <td style="text-align:center;"> <span style="background-color: #B0FFD5; border-radius: 4px; color: black; display: block">0% </span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--AQ </span> </td> <td style="text-align:center;"> <span style="background-color: #71ca97; border-radius: 4px; color: black; display: block">44.98%</span> </td> <td style="text-align:center;"> <span style="background-color: #72a8ee; border-radius: 4px; color: black; display: block">8.81% </span> </td> <td style="text-align:center;"> <span style="background-color: #0060d3; border-radius: 4px; color: black; display: block">22.19%</span> </td> <td style="text-align:center;"> <span style="background-color: #468ce3; border-radius: 4px; color: black; display: block">13.98%</span> </td> <td style="text-align:center;"> <span style="background-color: #B0FFD5; border-radius: 4px; color: black; display: block">5.16%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--PS </span> </td> <td style="text-align:center;"> <span style="background-color: #def7e9; border-radius: 4px; color: black; display: block">5.88% </span> </td> <td style="text-align:center;"> <span style="background-color: #a8cbfb; border-radius: 4px; color: black; display: block">2.43% </span> </td> <td style="text-align:center;"> <span style="background-color: #accefc; border-radius: 4px; color: black; display: block">1.93% </span> </td> <td style="text-align:center;"> <span style="background-color: #b0d0fd; border-radius: 4px; color: black; display: block">1.53% </span> </td> <td style="text-align:center;"> <span style="background-color: #B0FFD5; border-radius: 4px; color: black; display: block">5.16%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--RV </span> </td> <td style="text-align:center;"> <span style="background-color: #b1e4c7; border-radius: 4px; color: black; display: block">21.88%</span> </td> <td style="text-align:center;"> <span style="background-color: #5898e8; border-radius: 4px; color: black; display: block">11.81%</span> </td> <td style="text-align:center;"> <span style="background-color: #85b5f3; border-radius: 4px; color: black; display: block">6.5% </span> </td> <td style="text-align:center;"> <span style="background-color: #9ec5f9; border-radius: 4px; color: black; display: block">3.58% </span> </td> <td style="text-align:center;"> <span style="background-color: #B0FFD5; border-radius: 4px; color: black; display: block">0.88%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--MA </span> </td> <td style="text-align:center;"> <span style="background-color: #bae8ce; border-radius: 4px; color: black; display: block">18.63%</span> </td> <td style="text-align:center;"> <span style="background-color: #5898e8; border-radius: 4px; color: black; display: block">11.87%</span> </td> <td style="text-align:center;"> <span style="background-color: #accefc; border-radius: 4px; color: black; display: block">1.95% </span> </td> <td style="text-align:center;"> <span style="background-color: #94bef6; border-radius: 4px; color: black; display: block">4.81% </span> </td> <td style="text-align:center;"> <span style="background-color: #B0FFD5; border-radius: 4px; color: black; display: block">3.7% </span> </td> </tr> </tbody> </table> --- ```r formata_tabela(tabela, cores = "BRANCO") ``` <table class="table table-condensed"> <thead> <tr> <th style="text-align:left;"> Criterios </th> <th style="text-align:center;"> Pesos </th> <th style="text-align:center;"> A </th> <th style="text-align:center;"> B </th> <th style="text-align:center;"> C </th> <th style="text-align:center;"> CR </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">---Comprar um carro</span> </td> <td style="text-align:center;"> <span>100% </span> </td> <td style="text-align:center;"> <span style="font-weight: bold; font-size: 130%">35.77%</span> </td> <td style="text-align:center;"> <span>35.16%</span> </td> <td style="text-align:center;"> <span>29.07%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.09%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--CF </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">8.63% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.86% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">2.59% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">5.18% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0% </span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--AQ </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">44.98%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">8.81% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">22.19%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">13.98%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">5.16%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--PS </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">5.88% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">2.43% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.93% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.53% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">5.16%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--RV </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">21.88%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">11.81%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">6.5% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">3.58% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.88%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--MA </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">18.63%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">11.87%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.95% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">4.81% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">3.7% </span> </td> </tr> </tbody> </table> --- ```r formata_tabela(tabela, cores = "CINZA") ``` <table class="table table-condensed"> <thead> <tr> <th style="text-align:left;"> Criterios </th> <th style="text-align:center;"> Pesos </th> <th style="text-align:center;"> A </th> <th style="text-align:center;"> B </th> <th style="text-align:center;"> C </th> <th style="text-align:center;"> CR </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">---Comprar um carro</span> </td> <td style="text-align:center;"> <span>100% </span> </td> <td style="text-align:center;"> <span style="font-weight: bold; font-size: 130%">35.77%</span> </td> <td style="text-align:center;"> <span>35.16%</span> </td> <td style="text-align:center;"> <span>29.07%</span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">7.09%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--CF </span> </td> <td style="text-align:center;"> <span style="background-color: #989898; border-radius: 4px; color: white; display: block">8.63% </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">0.86% </span> </td> <td style="text-align:center;"> <span style="background-color: #979797; border-radius: 4px; color: white; display: block">2.59% </span> </td> <td style="text-align:center;"> <span style="background-color: #8e8e8e; border-radius: 4px; color: white; display: block">5.18% </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">0% </span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--AQ </span> </td> <td style="text-align:center;"> <span style="background-color: #4f4f4f; border-radius: 4px; color: white; display: block">44.98%</span> </td> <td style="text-align:center;"> <span style="background-color: #808080; border-radius: 4px; color: white; display: block">8.81% </span> </td> <td style="text-align:center;"> <span style="background-color: #4f4f4f; border-radius: 4px; color: white; display: block">22.19%</span> </td> <td style="text-align:center;"> <span style="background-color: #6d6d6d; border-radius: 4px; color: white; display: block">13.98%</span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">5.16%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--PS </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">5.88% </span> </td> <td style="text-align:center;"> <span style="background-color: #989898; border-radius: 4px; color: white; display: block">2.43% </span> </td> <td style="text-align:center;"> <span style="background-color: #9a9a9a; border-radius: 4px; color: white; display: block">1.93% </span> </td> <td style="text-align:center;"> <span style="background-color: #9b9b9b; border-radius: 4px; color: white; display: block">1.53% </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">5.16%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--RV </span> </td> <td style="text-align:center;"> <span style="background-color: #7d7d7d; border-radius: 4px; color: white; display: block">21.88%</span> </td> <td style="text-align:center;"> <span style="background-color: #757575; border-radius: 4px; color: white; display: block">11.81%</span> </td> <td style="text-align:center;"> <span style="background-color: #898989; border-radius: 4px; color: white; display: block">6.5% </span> </td> <td style="text-align:center;"> <span style="background-color: #939393; border-radius: 4px; color: white; display: block">3.58% </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">0.88%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--MA </span> </td> <td style="text-align:center;"> <span style="background-color: #848484; border-radius: 4px; color: white; display: block">18.63%</span> </td> <td style="text-align:center;"> <span style="background-color: #757575; border-radius: 4px; color: white; display: block">11.87%</span> </td> <td style="text-align:center;"> <span style="background-color: #999999; border-radius: 4px; color: white; display: block">1.95% </span> </td> <td style="text-align:center;"> <span style="background-color: #8f8f8f; border-radius: 4px; color: white; display: block">4.81% </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">3.7% </span> </td> </tr> </tbody> </table> --- #Lectura de datos: ler() ```r base<- ler("tabelaLR.xlsx") summary(base) ``` ``` ## Length Class Mode ## Elige un programa 2 tbl_df list ## Rendimiento 4 tbl_df list ## Soporte 3 tbl_df list ## Comunidad 4 tbl_df list ## Material 4 tbl_df list ## Popularidad 4 tbl_df list ``` --- #Jerarquía  4 alternativas: R, Python, C++ o Java --- #Organización de datos  mapeamento: 2 critérios no nivel 1: rendimento e soporte Rendimento: 0 subcritérios Soporte: 3 subcritérios mapeamento = c(0,3) --- #Mapeamento Exemplo genérico 3 critérios no nível 1; 10 alternativas Critério 1: 2 subcritérios; Critério 2: 2 subcritérios; Critério 3: 4 subcritérios mapeamento = c(2, 2, 4) 12 tablas em arquivo xlsx em sequencia: M1(3x3), M2(2x2), M3(2x2), M4(4x4), M5 a M12(10x10) --- ###ahp_geral() ```r tabela2 = ahp_geral(base, mapeamento = c(0,3)); tabela2 ``` ``` ## # A tibble: 6 x 7 ## Criterios Pesos A B C D CR ## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 ---Elige un programa 1 0.401 0.273 0.140 0.186 0 ## 2 --Rendimiento 0.6 0.188 0.190 0.0966 0.125 0.0387 ## 3 --Soporte 0.4 0.213 0.0825 0.0430 0.0615 0.0176 ## 4 -Comunidad 0.250 0.155 0.0460 0.0227 0.0264 0.0736 ## 5 -Material 0.0954 0.0406 0.0203 0.0126 0.0219 0.00388 ## 6 -Popularidad 0.0546 0.0175 0.0162 0.00765 0.0133 0.0237 ``` ```r tabela2 = ahp_geral(base, mapeamento = c(0,3), c("R","Python","C++","Java")); tabela2 ``` ``` ## # A tibble: 6 x 7 ## Criterios Pesos R Python `C++` Java CR ## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 ---Elige un programa 1 0.401 0.273 0.140 0.186 0 ## 2 --Rendimiento 0.6 0.188 0.190 0.0966 0.125 0.0387 ## 3 --Soporte 0.4 0.213 0.0825 0.0430 0.0615 0.0176 ## 4 -Comunidad 0.250 0.155 0.0460 0.0227 0.0264 0.0736 ## 5 -Material 0.0954 0.0406 0.0203 0.0126 0.0219 0.00388 ## 6 -Popularidad 0.0546 0.0175 0.0162 0.00765 0.0133 0.0237 ``` --- #Tabela formatada: ```r formata_tabela(tabela2, cores = "CINZA") ``` <table class="table table-condensed"> <thead> <tr> <th style="text-align:left;"> Criterios </th> <th style="text-align:center;"> Pesos </th> <th style="text-align:center;"> R </th> <th style="text-align:center;"> Python </th> <th style="text-align:center;"> C++ </th> <th style="text-align:center;"> Java </th> <th style="text-align:center;"> CR </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">---Elige un programa</span> </td> <td style="text-align:center;"> <span>100% </span> </td> <td style="text-align:center;"> <span style="font-weight: bold; font-size: 130%">40.14%</span> </td> <td style="text-align:center;"> <span>27.25%</span> </td> <td style="text-align:center;"> <span>13.96%</span> </td> <td style="text-align:center;"> <span>18.64%</span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">0% </span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--Rendimiento </span> </td> <td style="text-align:center;"> <span style="background-color: #4f4f4f; border-radius: 4px; color: white; display: block">60% </span> </td> <td style="text-align:center;"> <span style="background-color: #585858; border-radius: 4px; color: white; display: block">18.84%</span> </td> <td style="text-align:center;"> <span style="background-color: #575757; border-radius: 4px; color: white; display: block">19.01%</span> </td> <td style="text-align:center;"> <span style="background-color: #7b7b7b; border-radius: 4px; color: white; display: block">9.66% </span> </td> <td style="text-align:center;"> <span style="background-color: #707070; border-radius: 4px; color: white; display: block">12.49%</span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">3.87%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--Soporte </span> </td> <td style="text-align:center;"> <span style="background-color: #6b6b6b; border-radius: 4px; color: white; display: block">40% </span> </td> <td style="text-align:center;"> <span style="background-color: #4f4f4f; border-radius: 4px; color: white; display: block">21.3% </span> </td> <td style="text-align:center;"> <span style="background-color: #818181; border-radius: 4px; color: white; display: block">8.25% </span> </td> <td style="text-align:center;"> <span style="background-color: #909090; border-radius: 4px; color: white; display: block">4.3% </span> </td> <td style="text-align:center;"> <span style="background-color: #898989; border-radius: 4px; color: white; display: block">6.15% </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">1.76%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Comunidad </span> </td> <td style="text-align:center;"> <span style="background-color: #818181; border-radius: 4px; color: white; display: block">25% </span> </td> <td style="text-align:center;"> <span style="background-color: #656565; border-radius: 4px; color: white; display: block">15.49%</span> </td> <td style="text-align:center;"> <span style="background-color: #8f8f8f; border-radius: 4px; color: white; display: block">4.6% </span> </td> <td style="text-align:center;"> <span style="background-color: #989898; border-radius: 4px; color: white; display: block">2.27% </span> </td> <td style="text-align:center;"> <span style="background-color: #969696; border-radius: 4px; color: white; display: block">2.64% </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">7.36%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Material </span> </td> <td style="text-align:center;"> <span style="background-color: #989898; border-radius: 4px; color: white; display: block">9.54%</span> </td> <td style="text-align:center;"> <span style="background-color: #919191; border-radius: 4px; color: white; display: block">4.06% </span> </td> <td style="text-align:center;"> <span style="background-color: #999999; border-radius: 4px; color: white; display: block">2.03% </span> </td> <td style="text-align:center;"> <span style="background-color: #9c9c9c; border-radius: 4px; color: white; display: block">1.26% </span> </td> <td style="text-align:center;"> <span style="background-color: #989898; border-radius: 4px; color: white; display: block">2.19% </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">0.39%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Popularidad </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">5.46%</span> </td> <td style="text-align:center;"> <span style="background-color: #9a9a9a; border-radius: 4px; color: white; display: block">1.75% </span> </td> <td style="text-align:center;"> <span style="background-color: #9a9a9a; border-radius: 4px; color: white; display: block">1.62% </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">0.76% </span> </td> <td style="text-align:center;"> <span style="background-color: #9b9b9b; border-radius: 4px; color: white; display: block">1.33% </span> </td> <td style="text-align:center;"> <span style="background-color: #9e9e9e; border-radius: 4px; color: white; display: block">2.37%</span> </td> </tr> </tbody> </table> --- #Ranque: ```r ranque(tabela2) ``` ``` ## # A tibble: 4 x 3 ## Ranque Alternativas Pesos ## <int> <chr> <dbl> ## 1 1 R 0.401 ## 2 2 Python 0.273 ## 3 3 Java 0.186 ## 4 4 C++ 0.140 ``` --- #Exemplo BD3 ```r library(AHP); library(magrittr) ahp_geral(BD3, mapeamento = c(3,3,3)) %>% formata_tabela(cores="BRANCO") ``` <table class="table table-condensed"> <thead> <tr> <th style="text-align:left;"> Criterios </th> <th style="text-align:center;"> Pesos </th> <th style="text-align:center;"> A </th> <th style="text-align:center;"> B </th> <th style="text-align:center;"> C </th> <th style="text-align:center;"> D </th> <th style="text-align:center;"> CR </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">---Priorização de Serviço </span> </td> <td style="text-align:center;"> <span>100% </span> </td> <td style="text-align:center;"> <span>6.58% </span> </td> <td style="text-align:center;"> <span>39.16%</span> </td> <td style="text-align:center;"> <span>14.87%</span> </td> <td style="text-align:center;"> <span style="font-weight: bold; font-size: 130%">39.39%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">2.79%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--criterio financeiro </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">17.82%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.56% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.16% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.71% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.38% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">3.7% </span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Tempo de retorno </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.48% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.1% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">2.85% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.45% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">3.08% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.23%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Indice de lucratividade </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">9.1% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.41% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">3.79% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.11% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">3.79% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.83%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Valor presente </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.23% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.05% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.51% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.15% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.51% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.83%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--criterio estratégico </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">75.14%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">4.16% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">29.07%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">12.84%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">29.07%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.21%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Melhorar processos </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">56.13%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">2.51% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">23.4% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">6.83% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">23.4% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.83%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Melhorar reputação </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">8.97% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.43% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.48% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">5.57% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.48% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.83%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Redução de riscos </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">10.04%</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.22% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">4.18% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.45% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">4.18% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.83%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">--criterio tecnológico </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.04% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.86% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">2.94% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.31% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">2.94% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0% </span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Capacidade do time </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.64% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.08% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.27% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.03% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.27% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.83%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Compatibilidade </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">3.2% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.39% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.33% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.14% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.33% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.83%</span> </td> </tr> <tr> <td style="text-align:left;"> <span style="color: grey; font-weight: bold">-Custo total de propriedade</span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">3.2% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.39% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.33% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">0.14% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">1.33% </span> </td> <td style="text-align:center;"> <span style="background-color: #ffffff; border-radius: 4px; color: black; display: block">7.83%</span> </td> </tr> </tbody> </table> --- #Planes para el futuro: - Mejorar el rendimiento computacional de las funciones; - Desarrollar tutorial para las funciones; - Desarrollar la función de imagen jerárquica; - Interatividad con shiny. --- class: inverse, center, middle Gracias!!! e-mail: lucianea@id.uff.br twitter: @alcoforadouff ---