Author: Miguel Menéndez
Date: 2019-05-31

# MedDietCalc

#### Miguel Menéndez1

#### 2019-05-31

    knitr::opts_chunk$set(encoding = "UTF-8")

# Objective and vignette plan

This vignette shows the use of MedDietCalc package both at individual and epidemiological level.

1. Check individual level adherence to Mediterranean Diet (MedDiet)
2. Supose a nutriepidemiological study where scores are involved
   - compute cardiovascular risk, as dependent variable
   - compute MedDiet adherence, as study variable
   - measure agreement between MedDiet adherence scores

# 1. Use at individual Level

Supose two people whose weekly food intake is the following. We have stored it as servings:

    MaleA <- data.frame(Bread = 14, WholeBread = 14, Potatoes = 3, Pasta = 5,
                        Fruits = 14, Legumes = 3, Nuts = 5, Vegetables = 21,
                        Oil = "Olive Oil", OliveOil = 25, Dairy = 14,
                        WholeDairy = 7, Fish = 2, Poultry = 2, Eggs = 4, Meat = 3, Wine = 7)

    MaleB <- data.frame(Bread = 6, WholeBread = 0, Potatoes = 6, Pasta = 4,
                        Fruits = 5, Legumes = 1, Nuts = 1, Vegetables = 10,
                        Oil = "Olive and Seeds Oil", OliveOil = 14, Dairy = 28,
                        WholeDairy = 28, Fish = 4, Poultry = 4, Eggs = 8, Meat = 5, Wine = 0)

    library(knitr)
    kable(t(rbind(MaleA = MaleA, MaleB = MaleB)))

| MaleA | MaleB
--- | --- | ---
Bread | 14 | 6
WholeBread | 14 | 0
Potatoes | 3 | 6
Pasta | 5 | 4
Fruits | 14 | 5
Legumes | 3 | 1
Nuts | 5 | 1
Vegetables | 21 | 10
Oil | Olive Oil | Olive and Seeds Oil
OliveOil | 25 | 14
Dairy | 14 | 28
WholeDairy | 7 | 28
Fish | 2 | 4
Poultry | 2 | 4
Eggs | 4 | 8
Meat | 3 | 5
Wine | 7 | 0

A first look at this table shows that MaleA is reasonably adherent to MedDiet: he uses olive oil as dietary fat, eats legumes 3 times a week, has a high intake of fruits and vegetables, also a hich intake of bread and pasta, eats nuts regularly, and his meat intake is not prominent. Last, he has a moderate wine consumption.

Male B is clearly less adherent to MedDiet tenets: olive oil and seeds oil are used, legumes and nuts intake is scarce, also bread and pasta are eate but not daily, fruits and vegetables intake is not high, has a high intake of dairy, and meat and eggs are more prominent than fish and pultry. Last, he doesn’t drink wine regularly.

We want to somehow measure this adherence, computing two MedDiet scores for them. For this example we are using the score according to Pitsavos et al2 and the literature based one according to Sofi et al3:

First we trasnsform variable Oil, which informs about the procedence of dietary oil (seeds oil, olive oil, or both seeds and olive oil) to be usable by formula

    levels(MaleA$Oil)[levels(MaleA$Oil) == "Olive Oil"] <- 2
    levels(MaleB$Oil)[levels(MaleB$Oil) == "Olive and Seeds Oil"] <- 1

- Compute 2 MedDiet scores for MaleA

    library(MedDietCalc)

    MaleA1 <- computePitsavos(data = MaleA, WholeCereals = WholeBread, Fruit = Fruits,
                              Vegetables = Vegetables, Potatoes = Potatoes, Legumes = Legumes,
                              OliveOil = OliveOil, OOmeasure = "serving", Fish = Fish,
                              Meat = Meat, Poultry = Poultry, WholeDairy = WholeDairy,
                              Wine = Wine, output = "percent", frequency = "weekly")

    MaleA2 <- computeSofi(data = MaleA, Fruit = Fruits, Vegetables = Vegetables,
                          Legumes = Legumes, Cereals = Bread + Pasta, Fish = Fish,
                          Meat = Meat, Dairy = Dairy, Alcohol = Wine, OliveOil = Oil,
                          output = "percent", frequency = "weekly")

- Compute 2 MedDiet scores for MaleB

    MaleB1 <- computePitsavos(data = MaleB, WholeCereals = WholeBread, Fruit = Fruits,
                              Vegetables = Vegetables, Potatoes = Potatoes, Legumes = Legumes,
                              OliveOil = OliveOil, OOmeasure = "serving", Fish = Fish,
                              Meat = Meat, Poultry = Poultry, WholeDairy = WholeDairy,
                              Wine = Wine, output = "percent", frequency = "weekly")

    MaleB2 <- computeSofi(data = MaleB, Fruit = Fruits, Vegetables = Vegetables,
                          Legumes = Legumes, Cereals = Bread + Pasta, Fish = Fish,
                          Meat = Meat, Dairy = Dairy, Alcohol = Wine, OliveOil = Oil,
                          output = "percent", frequency = "weekly")

    kable(data.frame(MaleA = c(MaleA1, MaleA2), MaleB = c(MaleB1, MaleB2),
                     row.names = c("score1", "score2")))

| MaleA | MaleB
--- | --- | ---
score1 | 69.1 | 56.4
score2 | 83.3 | 50.0

We can notice that both scores agree considering MaleA more adherent to MedDiet than MaleB.

Both scores more or less agree in the score of MaleB (50% vs 56%), but differences in measuring MaleA diet are higher (69% vs 83%).

If we advise MaleB to change his diet, becoming more adherent to MedDiet, we could use this scores to measure changes.

# 2. Use at epidemiological level

## Hypothetical nutriepidemiological study

Let’s imagine we are conducting a study in which we want to test the hypothesis:

> MedDiet is associated with lower cardiovascular risk.

To test it, we have collected data from four Spanish regions.

As dependent variable we plan to use the 10-year cardiovascular risk, computed with a risk score developed in Spanish population4. As study variable we want to use MedDiet adherence, measured with a score, but which score to use?

This package provides functions to compute the following MedDiet adherence scores:

- Cardioprotective Mediterranean Diet Index, from Martínez-González et al.5 in function computeCardio()
- Score according to Goulet et al. in 20036 in function computeGoulet
- MAI (Mediterranean Adequacy Index) according to Alberti-Fidanza et al., 19997 in function computeMAI99()
- MDP (Mediterranean Dietary Pattern), 20028 in function computeMDP02
- MDQI (Mediterranean Diet Quality Index)9 in function computeMDQI()
- MDS 1995, fist Mediterranean Adherence score index, developed by Trichopoulou et al.10 in function computeMDS95()
- MDS as modified in 200311 in function computeMDS03()
- MDS as modified in 200512 in function computeMDS05()
- MDS as modified in 201213 in function computeMDS12()
- MSDPS (Mediterranean-Style Dietary Pattern Score)14 in function computeMSDPS()
- Score according to Pitsavos et al. in 200515 in function computePitsavos(). This score can also be found in the literature as Dietary Score16 17, it can also be found in Waijers et al.18 considered as a derivate from MDS and called MDS-a IV. We have preferred to call it by the name of paper’s first author.
- Score used in PreDiMed trial (Prevención con Dieta Mediterránea, Spanish which means Prevention with Mediterranean Diet)19 in function computePredimed()
- RMED (Revised Mediterranean Diet adherence score)20 in function computeRMED()
- Score according to the literature review by Sofi et al. in 201421 in function computeSofi()

Some scores have more than one version, or subtle differences can be found in the Literature in different papers. When this has be found, a number finishes the function’s name, to make it clear which score version has been used. For instance, the function computeMDS95() is the MDS score in its 1995 version.

## Compute dependent variable

We compute risk of fatal vascular event according to FRESCO score.

With the outcome arguement we can compute just coronary risk (outcome = “Coronary”) or stroke risk (outcome = “Stroke”), or both cerebrovascular and cardiovascular risk. We are set outome = “All”.

    data(nutriSample)

    risk <- computeFRESCO(data = nutriSample,
        outcome = "All", simplified = TRUE,
        Sex = SEXO, Age = EDAD, Smoker = ifelse(nutriSample$FUMADOR == 1, 1, 0),
        BMI = nutriSample$peso/(nutriSample$altura)^2,
        men = "Hombre", women = "Mujer")

    hist(risk, main = "10-year estimated \n cardiovascular risk")

We can see that high risk is infrequent in our sample. Which could be expected in our Spanish low risk population.

## Which MedDiet adherence score to use?

As there are a lot of them, and it has been suggested that they had sometimes low correlation22, we are going to test the scores in our sample.

The first MedDiet score I am going to use is the 2005 version of MDS, an update of the landmark first mediterranean diet adherence score developed by Antonia Trichopoulou and coleagues.

With this questionnaire we will look at the ‘output’ argument, with it we can ask the formula to provide the ouput in one of three ways:

- a numeric index of adherence, which is the usual in the literature
- this adherence as percentage, according to the maximum score possible to reach. This way is more intuitive to quickly read the output (for instance, the above example of MaleA and MaleB, we didn’t need to know the scale of this scores, and with a percentage we have quickly compared them)
- as a data frame, which additionaly informs us of the individual points reached in each score item. Thus, it provides a bit more insight about the performing of the score in our sample.

This step (to set output argument to ‘data.frame’) should be performed with each score, as it can show inconsistencies, or too high or too low scores in specific score items, but to make the vignette brief, we will show it just with this frist score.

### MDS

I set output as ‘data.frame’, to check wether inconsistencies are apparent

    MDS05 <- computeMDS05(data = nutriSample,
            Vegetables = P41grCom + P42grCom,
            Legumes =  P46grCom,
            FruitAndNuts =  P50grCom + P52grCom + P53grCom,
            Cereals = P55grCom + P56grCom + P57grCom + P59grCom +
              P60grCom + P61grCom + P62grCom,
            Fish = P35grCom + P36grCom + P37grCom + P38grCom,
            Meat = P29grCom + P30grCom + P31grCom + P32grCom,
            Dairy = P19grCom + P20grCom + P22grCom + P23grCom +
              P24grCom + P25grCom + P26grCom + P27grCom,
            Alcohol =  12 * (P94rac + P96rac + P97rac + P98rac + P99rac),
            Potatoes =  NULL,
            MUFA =  totalGrasaMonoins,
            PUFA =  totalGrasaPoliins,
            SFA =  totalGrasaSat,
            Sex =  SEXO, men = "Hombre", women = "Mujer", frequency = "daily",
            output = "data.frame", rm.na = FALSE)

    ## [1] "NOTE: Potatoes consumption has not been included in cereals scoring -as currently suggested-, because 'Potatoes' argument has not been provided"

We get a NOTE informing us than potatoes have not been computed, and we agree. When MDS questionnaire was developed in 1990s, potatoes were think to have a relevant role in health outcomes, and were computed with cereals, but later research has challenged this view. This formula allows the user to compute potatoes with cereals, although probably at present no researcher will want to combine them.

    kable(head(MDS05))

Vscore | Lscore | Frscore | Cscore | Fiscore | Mscore | Dscore | Ascore | Fatscore | absolute | percent
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 | 33.3
0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 7 | 77.8
NA | NA | NA | NA | NA | NA | NA | 0 | NA | NA | NA
1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 4 | 44.4
1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 8 | 88.9
1 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 5 | 55.6

    kable(round(apply(MDS05, 2, mean),2))

| x
--- | ---
Vscore | NA
Lscore | NA
Frscore | NA
Cscore | NA
Fiscore | NA
Mscore | NA
Dscore | NA
Ascore | NA
Fatscore | NA
absolute | NA
percent | NA

In this table, each row is a person, the columns are the individual items that conform this score: ‘Vscore’ is the points people have obtained in ‘Vegetables’ item, ‘Lscore’ in Legumes, ‘Frscore’ in Fruits, and so on. For further details, references of each score development should be consulted.

Last columns are:

- ‘absolute’, the total score each person has got, and the output when ouput = ‘score’. Usually absolute socre is the sum of each individual items, but scoring schema could vary among questionnaires. To understand the meaning of this ‘absolute’ number -for instance, 3 for the first person-, you need to know that maximun possible is 9. Studies developing or using MedDiet scores tend to use absolute adherence scores.

- ‘percent’, which is the same score but as a percentage. For the first person, who had 3 points out of 10 possible points, it is 33.3%.

Now we can look for variables with too many missing data, or with too high or too low scores. For instance, if legumes consumption receives full score too often it’s reasonable to check data for units mistakes, or wether if the sample has special patterns of feeding.

Now that we have checked it for unexpected behaviour, we keep just the percent of adherence, which is more intuitive.

    MDS05 <- MDS05$percent

I compute others, each of them with their particularities

### MDS 2012 update

    MDS12 <-
      computeMDS12(data = nutriSample,
                   Vegetables = P41grCom + P42grCom,
                   Legumes =  P46grCom,
                   FruitAndNuts =  P50grCom + P52grCom + P53grCom,
                   Cereals = P55grCom + P56grCom + P57grCom + P59grCom +
                     P60grCom + P61grCom + P62grCom,
                   Fish = P35grCom + P36grCom + P37grCom + P38grCom,
                   Meat = P29grCom + P30grCom + P31grCom + P32grCom,
                   Dairy = P19grCom + P20grCom + P22grCom + P23grCom +
                     P24grCom + P25grCom + P26grCom + P27grCom,
                   Alcohol =  12 * (P94rac + P96rac + P97rac + P98rac + P99rac),
                   Potatoes =  NULL,
                   OOprincipal = ifelse(nutriSample$AceiteTipo == 1, 1, 0),
                   Sex =  SEXO, men = "Hombre", women = "Mujer",
                   frequency = "daily", output = "percent", rm.na = FALSE)

    ## [1] "NOTE: Potatoes consumption has not been included in cereals scoring -as currently suggested-, because 'Potatoes' argument has not been provided"

We get the same NOTE about potatoes.

### Pitsavos

    Pitsavos <- computePitsavos(data = nutriSample,
      WholeCereals = P56rac + ifelse(nutriSample$P63_2 == 2, nutriSample$P61rac, 0),
      Fruit = P50rac + P52rac,
      Vegetables = P41rac + P42rac,
      Potatoes = P43rac + P44rac + P45rac,
      Legumes = P46rac,
      OliveOil = Aceitegr,
      OOmeasure = "gr",
      Fish = P35rac + P36rac + P37rac + P38rac,
      Meat = P29rac + P30rac + P31rac + P32rac,
      Poultry = P33rac,
      WholeDairy = P19grCom + P22grCom,
      Wine = P96rac,
      output = "percent", frequency = "daily", rm.na = FALSE)

### Predimed

    Predimed <- computePredimed(data = nutriSample, OliveOil = Aceitegr, OOmeasure = "gr",
                      OOprincipal = ifelse(nutriSample$AceiteTipo == 1, 1, 0),
                      Vegetables = P41rac + P42rac,
                      Fruit = P50rac + P52rac,
                      RedMeat = P29rac + P31rac,
                      Butter = P79rac,
                      SoftDrinks = P89rac + P90rac,
                      Wine = P96rac,
                      Legumes = P46rac,
                      Fish = P35rac + P36rac + P37rac + P38rac,
                      Pastries = P69rac + P70rac + P71rac + P72rac + P73rac,
                      Nuts = P53rac,
                      WhiteMeat = ifelse(nutriSample$P30rac > nutriSample$P29rac, 1, 0),
                      Sofritos = rep(0, nrow(data)), # data lacks this variable,
                                                     # so we go on without it
                      output = "percent", rm.na = FALSE, frequency = "daily")

Our data lacks one item of this score, which is ‘sofrito’ consumption. Sofritos are a slow cooked sauce, usually with onion and garlic or other vegetables 23.

Predimed score gives more weight to olive oil consumption than to other foods, as olive oil is scored more than once: it is asked if olive oil is principal (yes or no), the amount of olive oil consumed, and sofrito consumption, which is very rich in olive oil.

### MAI

    MAI <- computeMAI99(data = nutriSample,
      Bread = P55Kcal + P56Kcal + P57Kcal,
      Cereals = P55Kcal + P56Kcal + P57Kcal + P59Kcal + P60Kcal + P61Kcal + P62Kcal,
      Legumes = P46Kcal,
      Potatoes = P43Kcal + P44Kcal + P46Kcal,
      Vegetables = P41Kcal + P42Kcal,
      FruitAndNuts = P50Kcal + P52Kcal + P53Kcal,
      Fish = P35Kcal + P36Kcal + P37Kcal + P38Kcal,
      Wine = P96Kcal,
      Oil = AceiteKcal,
      Milk = P19Kcal + P20Kcal + P21Kcal,
      Cheese = P26Kcal + P27Kcal,
      Meat = P29Kcal + P30Kcal + P31Kcal + P32Kcal,
      Eggs = P28Kcal,
      AnimalFats = P29grGrasa + P30grGrasa + P31grGrasa +
        P32grGrasa + P33grGrasa + P34grGrasa ,
      SoftDrinks = P89Kcal + P90Kcal,
      Pastries = P69Kcal + P70Kcal + P71Kcal + P72Kcal + P73Kcal,
      Sugar = P84Kcal,
      Kcal = totalKcal,
      output = "index", rm.na = FALSE)

This score is different, as it has not the same schema, and we have not coerced it as percentage.

### MDQI

    MDQI <- computeMDQI(data = nutriSample,
                          FruitAndVegetables = P50grCom + P52grCom + P41grCom + P42grCom,
                          OliveOil = Aceitegr,
                          OOmeasure = "gr",
                          Fish = P35grCom + P36grCom + P37grCom + P38grCom,
                          Cereals = P55grCom + P56grCom + P57grCom + P59grCom +
                            P60grCom + P61grCom + P62grCom,
                          Meat = P29grCom + P30grCom + P31grCom + P32grCom,
                          SatFats = totalGrasaSat,
                          Cholesterol = totalCol,
                          Kcal = totalKcal,
                          invert = TRUE,
                          frequency = "daily", output = "percent", rm.na = FALSE)

### Cardio

    Cardio <- computeCardio(data = nutriSample,
                              OliveOil = Aceitegr,
                              OOmeasure = "gr",
                              Fruit = P50rac + P52rac,
                              Vegetables = P41rac + P42rac,
                              Legumes = P46rac,
                              Fish = P35rac + P36rac + P37rac + P38rac,
                              Wine = P96rac,
                              Meat = P29rac + P30rac + P31rac + P32rac,
                              RefinedBread = P55rac,
                              RefinedRice = P61rac,
                              WholeBread = P56rac,
                              frequency = "daily", output = "percent", rm.na = FALSE)

### MDP02

    MDP02 <- computeMDP02(data = nutriSample,
                            OliveOil = Aceitegr,
                            OOmeasure = "gr",
                            Fiber = totalFibra,
                            Fruit = P50grCom,
                            Vegetables = P41grCom + P42grCom,
                            Fish = P35grCom + P36grCom + P37grCom + P38grCom,
                            Alcohol = 12 * (P94rac + P96rac + P97rac + P98rac + P99rac),
                            Meat = P29grCom + P30grCom + P31grCom + P32grCom,
                            RefinedCereals = P55grCom + P61grCom,
                            output = "percent", rm.na = FALSE, frequency = "daily")

### RMed

    RMed <- computeRMED(data = nutriSample,
                          Kcal = totalKcal,
                          FruitAndNuts = P50grCom + P52grCom + P53grCom,
                          Vegetables = P41grCom + P42grCom,
                          Legumes = P46grCom,
                          Cereals = P55grCom + P56grCom + P57grCom + P59grCom +
                            P60grCom + P61grCom + P62grCom,
                          Fish = P35grCom + P36grCom + P37grCom + P38grCom,
                          OliveOil = Aceitegr,
                          Meat = P29grCom + P30grCom + P31grCom + P32grCom,
                          Dairy= P19grCom + P20grCom + P22grCom + P23grCom +
                            P24grCom + P25grCom + P26grCom + P27grCom,
                          Alcohol = 12 * (P94rac + P96rac + P97rac + P98rac + P99rac),
                          Sex = SEXO, men = "Hombre", women = "Mujer",
                          frequency = "daily", output = "percent", rm.na = FALSE)

### Sofi

    # kind of Olive Oil consumded is stored in a different way than asked by formula:
      # data has: 1 = olive oil, 2 = seeds oil, 3 = both,
      # formula wants use of olive oil: 0 = occasional use, 1 = frequent use, 2 = regular use
      # so we first change it:
    Oil <- ifelse(nutriSample$AceiteTipo == 2, 0,
                  ifelse(nutriSample$AceiteTipo == 3, 1,
                         ifelse(nutriSample$AceiteTipo == 1, 2, 0)))

    Sofi <- computeSofi(data = nutriSample,
                  Fruit = P50rac + P52rac,
                  Vegetables = P41rac +  P42rac,
                  Legumes = P46rac,
                  Cereals = P55rac + P56rac + P57rac + P59rac + P60rac + P61rac + P62rac,
                  Fish = P35rac + P36rac + P37rac + P38rac,
                  Meat = P29rac + P30rac + P31rac + P32rac,
                  Dairy = P19rac + P20rac + P20rac + P22rac + P23rac +
                    P24rac + P25rac + P26rac + P27rac,
                  Alcohol = P94rac + P96rac + P97rac + P98rac + P99rac,
                  OliveOil = Oil,
                  output = "percent", rm.na = FALSE, frequency = "daily")
    rm(Oil)

### Goulet

    Goulet <- computeGoulet(data = nutriSample,
      WholeCereals = P56rac + ifelse(nutriSample$P63_2 == 2, nutriSample$P61rac, 0),
      Vegetables = P41rac + P42rac,
      Fruit = P50rac + P52rac,
      LegumesAndNuts = P46rac + P53rac + P75rac,
      OliveOil = Aceitegr,
      OOmeasure = "gr",
      Olives = P54rac,
      Dairy = P19rac + P20rac + P20rac + P22rac + P23rac + P24rac + P25rac + P26rac + P27rac,
      Fish = P35rac + P36rac + P37rac + P38rac,
      Poultry = P33rac,
      Eggs = P28rac,
      Sweets = P69rac + P70rac + P71rac + P72rac + P73rac,
      Meat = P29rac + P30rac + P31rac + P32rac,
      output = "percent", frequency = "daily", rm.na = FALSE)

### MSDPS

    # kind of Olive Oil consumded is stored in a different way than asked by formula:
      # data has: 1 = olive oil, 2 = seeds oil, 3 = both,
      # formula wants:
        # 0 = olive oil is not usually consumed.
        # 1 = olive oil and other vegetable oils are usually consumed.
        # 2 = only olive oil is usually consumed
      # so we first change it:
    Oil <- ifelse(nutriSample$AceiteTipo == 2, 0,
                  ifelse(nutriSample$AceiteTipo == 3, 1,
                         ifelse(nutriSample$AceiteTipo == 1, 2, 0)))

    MSDPS <- computeMSDPS(data = nutriSample,
            # group of arguments about food consumption:
               WholeCereals = P56rac + ifelse(nutriSample$P63_2 == 2, nutriSample$P61rac, 0),
               Fruit = P50rac + P52rac,
               Vegetables = P41rac + P42rac,
               Dairy = P19rac + P20rac + P20rac + P22rac + P23rac +
                 P24rac + P25rac + P26rac + P27rac,
               Wine = P96rac,
               Fish = P35rac + P36rac + P37rac + P38rac,
               Poultry = P33rac,
               LegumesAndMore = P46rac + P53rac + P54rac,
               Potatoes = P43grCom +  P44grCom +  P45grCom,
               Eggs = P28rac,
               Sweets = P69rac + P70rac + P71rac + P72rac + P73rac,
               Meat = P29rac + P30rac + P31rac + P32rac,
               OOprincipal = Oil,

            # group of arguments about energy intake to compute correction factor:
               WholeCerealsK = P56Kcal + ifelse(nutriSample$P63_2 == 2, nutriSample$P61Kcal, 0),
               FruitK = P50Kcal + P52Kcal,
               VegetablesK = P41Kcal + P42Kcal,
               DairyK = P19Kcal + P20Kcal + P21Kcal + P22Kcal + P23Kcal +
                 P24Kcal + P25Kcal + P26Kcal + P27Kcal,
               WineK = P96Kcal,
               FishK = P35Kcal + P36Kcal + P37Kcal + P38Kcal,
               PoultryK = P33Kcal,
               LegumesAndMoreK = P46Kcal + P53Kcal + P54Kcal,
               PotatoesK = P43grCom +  P44grCom +  P45grCom,
               EggsK = P28Kcal,
               SweetsK = P69Kcal + P70Kcal + P71Kcal + P72Kcal + P73Kcal,
               MeatK = P29Kcal + P30Kcal + P31Kcal + P32Kcal,
               OliveOilK = AceiteKcal,
               Kcal = totalKcal,

            # final arguments:
               Sex = SEXO, men = "Hombre", women = "Mujer",
               output = "percent", frequency = "daily", rm.na = FALSE)

### We store them together

We store all computed scores in the same data frame

    scores <- data.frame(MDS05, MDS12, Pitsavos, Predimed, MDQI, Cardio,
                         MDP02, RMed, Sofi, Goulet, MSDPS, MAI)

    knitr::kable(head(scores))

MDS05 | MDS12 | Pitsavos | Predimed | MDQI | Cardio | MDP02 | RMed | Sofi | Goulet | MSDPS | MAI
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
33.3 | 50.0 | 65.5 | 42.9 | 57.1 | 66.7 | 55.0 | 61.1 | 50.0 | 47.7 | 30.2 | 2.18
77.8 | 61.1 | 78.2 | 50.0 | 64.3 | 77.8 | 57.5 | 55.6 | 72.2 | 70.5 | 33.3 | 6.76
NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
44.4 | 50.0 | 63.6 | 50.0 | 50.0 | 55.6 | 62.5 | 38.9 | 44.4 | 40.9 | 22.3 | 2.21
88.9 | 72.2 | 67.3 | 71.4 | 78.6 | 66.7 | 82.5 | 83.3 | 83.3 | 70.5 | 28.8 | 5.05
55.6 | 55.6 | 61.8 | 50.0 | 71.4 | 55.6 | 75.0 | 44.4 | 61.1 | 61.4 | 24.7 | 2.79

We have not incluided MAI score, as it has not a percentage.

## Do they correlate?

As we said above, it has been pointed out that different scores do not correlate as it could be desirable.

Here we are doing a correlation matrix of the scores in our sample:

    knitr::kable(round(cor(scores, use = "pairwise.complete.obs"), 2))

| MDS05 | MDS12 | Pitsavos | Predimed | MDQI | Cardio | MDP02 | RMed | Sofi | Goulet | MSDPS | MAI
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
MDS05 | 1.00 | 0.47 | 0.44 | 0.62 | 0.56 | 0.58 | 0.65 | 0.75 | 0.69 | 0.55 | 0.34 | 0.53
MDS12 | 0.47 | 1.00 | 0.29 | 0.62 | 0.49 | 0.36 | 0.50 | 0.55 | 0.73 | 0.32 | 0.26 | 0.40
Pitsavos | 0.44 | 0.29 | 1.00 | 0.29 | 0.36 | 0.51 | 0.56 | 0.47 | 0.48 | 0.39 | 0.24 | 0.49
Predimed | 0.62 | 0.62 | 0.29 | 1.00 | 0.55 | 0.50 | 0.59 | 0.61 | 0.60 | 0.56 | 0.34 | 0.47
MDQI | 0.56 | 0.49 | 0.36 | 0.55 | 1.00 | 0.35 | 0.51 | 0.59 | 0.58 | 0.66 | 0.35 | 0.45
Cardio | 0.58 | 0.36 | 0.51 | 0.50 | 0.35 | 1.00 | 0.75 | 0.56 | 0.56 | 0.46 | 0.45 | 0.39
MDP02 | 0.65 | 0.50 | 0.56 | 0.59 | 0.51 | 0.75 | 1.00 | 0.62 | 0.66 | 0.55 | 0.35 | 0.47
RMed | 0.75 | 0.55 | 0.47 | 0.61 | 0.59 | 0.56 | 0.62 | 1.00 | 0.68 | 0.57 | 0.47 | 0.60
Sofi | 0.69 | 0.73 | 0.48 | 0.60 | 0.58 | 0.56 | 0.66 | 0.68 | 1.00 | 0.47 | 0.40 | 0.46
Goulet | 0.55 | 0.32 | 0.39 | 0.56 | 0.66 | 0.46 | 0.55 | 0.57 | 0.47 | 1.00 | 0.46 | 0.53
MSDPS | 0.34 | 0.26 | 0.24 | 0.34 | 0.35 | 0.45 | 0.35 | 0.47 | 0.40 | 0.46 | 1.00 | 0.09
MAI | 0.53 | 0.40 | 0.49 | 0.47 | 0.45 | 0.39 | 0.47 | 0.60 | 0.46 | 0.53 | 0.09 | 1.00

Correlations are not as high as expected.

Know, we are plotting histograms of the different scores, all measured as percentage.

    for(i in 1:ncol(scores)){
      hist(scores[ ,i], main="", xlab=names(scores)[i], xlim=c(0,100))
    }

It is clear that some of them tend to provide higher scores than others, and also that some of them have wider bars than others. MAI, as it has been said, is quite different.

We expect that if different scores are used along samples, our understanding of the advantages and flaws of each one could improve. This way we could better measure such a difficult thing to measure as MedDiet adherence.

1. Scientific Support Unit, Hospital 12 de Octubre, Madrid, Spain↩

2. Pitsavos, Christos, Demosthenes B. Panagiotakos, Natalia Tzima, Christina Chrysohoou, Manolis Economou, Antonis Zampelas, and Christodoulos Stefanadis. 2005. “Adherence to the Mediterranean Diet Is Associated with Total Antioxidant Capacity in Healthy Adults: The ATTICA Study”. The American Journal of Clinical Nutrition 82 (3): 694-99. http://ajcn.nutrition.org/content/82/3/694↩

3. Sofi, Francesco, Claudio Macchi, Rosanna Abbate, Gian Franco Gensini, and Alessandro Casini. 2014. ‘Mediterranean Diet and Health Status: An Updated Meta-Analysis and a Proposal for a Literature-Based Adherence Score’. Public Health Nutrition 17 (12): 2769-82. https://www.cambridge.org/core/journals/public-health-nutrition/article/mediterranean-diet-and-health-status-an-updated-meta-analysis-and-a-proposal-for-a-literature-based-adherence-score/FCD121A09BB103DFB55237479D5CB659↩

4. Marrugat J, Subirana I, Ramos R, Vila J, Marín-Ibañez A, Guembe MJ, et al. Derivation and validation of a set of 10-year cardiovascular risk predictive functions in Spain: the FRESCO Study. Prev Med. 2014 Apr;61:66–74.↩

5. Martinez-Gonzalez, M. A., E. Fernandez-Jarne, M. Serrano-Martinez, M. Wright, and E. Gomez-Gracia. 2004. ‘Development of a Short Dietary Intake Questionnaire for the Quantitative Estimation of Adherence to a Cardioprotective Mediterranean Diet’. European Journal of Clinical Nutrition 58 (11): 1550-52. http://www.nature.com/ejcn/journal/v58/n11/full/1602004a.html↩

6. Goulet, Julie, Benoıt Lamarche, Genevieve Nadeau, and Simone Lemieux. 2003. ‘Effect of a Nutritional Intervention Promoting the Mediterranean Food Pattern on Plasma Lipids, Lipoproteins and Body Weight in Healthy French-Canadian Women’. Atherosclerosis 170 (1): 115-24. http://europepmc.org/abstract/med/12957689↩

7. Alberti-Fidanza, A., F. Fidanza, M. P. Chiuchiù, G. Verducci, and D. Fruttini. 1999. “Dietary Studies on Two Rural Italian Population Groups of the Seven Countries Study. 3. Trend Of Food and Nutrient Intake from 1960 to 1991.” European Journal of Clinical Nutrition 53 (11): 854–60↩

8. Martinez-Gonzalez, Miguel A., Elena Fernandez-Jarne, Manuel Serrano-Martinez, Amelia Marti, J. Alfredo Martinez, and Jose M. Martin-Moreno. 2002. ‘Mediterranean Diet and Reduction in the Risk of a First Acute Myocardial Infarction: An Operational Healthy Dietary Score’. European Journal of Nutrition 41 (4): 153-60. http://link.springer.com/article/10.1007/s00394-002-0370-6↩

9. Scali, Jacqueline, Aurelia Richard, and Mariette Gerber. 2001. ‘Diet Profiles in a Population Sample from Mediterranean Southern France’. Public Health Nutrition 4 (02): 173-182. https://www.cambridge.org/core/journals/public-health-nutrition/article/diet-profiles-in-a-population-sample-from-mediterranean-southern-france/C224E7CA8F130EF5B2385A8143705AB0↩

10. Trichopoulou, A., A. Kouris-Blazos, M. L. Wahlqvist, C. Gnardellis, P. Lagiou, E. Polychronopoulos, T. Vassilakou, L. Lipworth, and D. Trichopoulos. 1995. “Diet and Overall Survival in Elderly People.” BMJ (Clinical Research Ed.) 311 (7018): 1457–60↩

11. Trichopoulou, Antonia, Tina Costacou, Christina Bamia, and Dimitrios Trichopoulos. 2003. “Adherence to a Mediterranean Diet and Survival in a Greek Population.” New England Journal of Medicine 348 (26): 2599–2608. http://www.nejm.org/doi/full/10.1056/NEJMoa025039↩

12. Trichopoulou, Antonia, Philippos Orfanos, Teresa Norat, Bas Bueno-de-Mesquita, Marga C. Ocke, Petra HM Peeters, Yvonne T. van der Schouw, et al. 2005. “Modified Mediterranean Diet and Survival: EPIC-Elderly Prospective Cohort Study.” BMJ 330 (7498): 991. http://www.bmj.com/content/early/2004/12/31/bmj.38415.644155.8F↩

13. Sofi, Francesco, Rosanna Abbate, Gian Franco Gensini, Alessandro Casini, Antonia Trichopoulou, and Christina Bamia. 2012. ‘Identification of Change-Points in the Relationship between Food Groups in the Mediterranean Diet and Overall Mortality: An “a Posteriori” Approach’. European Journal of Nutrition 51 (2): 167–72. http://link.springer.com/article/10.1007%2Fs00394-011-0202-7↩

14. Rumawas, Marcella E., Johanna T. Dwyer, Nicola M. Mckeown, James B. Meigs, Gail Rogers, and Paul F. Jacques. 2009. ‘The Development of the Mediterranean-Style Dietary Pattern Score and Its Application to the American Diet in the Framingham Offspring Cohort’. The Journal of Nutrition 139 (6): 1150-56. http://jn.nutrition.org/content/139/6/1150.long↩

15. Pitsavos, Christos, Demosthenes B. Panagiotakos, Natalia Tzima, Christina Chrysohoou, Manolis Economou, Antonis Zampelas, and Christodoulos Stefanadis. 2005. “Adherence to the Mediterranean Diet Is Associated with Total Antioxidant Capacity in Healthy Adults: The ATTICA Study”. The American Journal of Clinical Nutrition 82 (3): 694-99. http://ajcn.nutrition.org/content/82/3/694↩

16. Mila-Villarroel, Raimon, Anna Bach-Faig, Josep Puig, Anna Puchal, Andreu Farran, Lluis Serra-Majem, and Josep Lluis Carrasco. 2011. “Comparison and Evaluation of the Reliability of Indexes of Adherence to the Mediterranean Diet.” Public Health Nutrition 14 (12A): 2338-45. https://www.cambridge.org/core/services/aop-cambridge-core/content/view/S1368980011002606↩

17. D’Alessandro, Annunziata, and Giovanni De Pergola. 2015. “Mediterranean Diet and Cardiovascular Disease: A Critical Evaluation of A Priori Dietary Indexes.” Nutrients 7 (9): 7863-88. http://www.mdpi.com/2072-6643/7/9/5367↩

18. Waijers, Patricia M. C. M., Edith J. M. Feskens, and Marga C. Ocke. 2007. “A Critical Review of Predefined Diet Quality Scores.” British Journal of Nutrition 97 (2): 219-231. https://www.cambridge.org/core/services/aop-cambridge-core/content/view/S0007114507250421↩

19. Martinez-Gonzalez, Miguel Angel, Dolores Corella, Jordi Salas-Salvado, Emilio Ros, Maria Isabel Covas, Miquel Fiol, Julia Warnberg, et al. 2012. “Cohort Profile: Design and Methods of the PREDIMED Study.” International Journal of Epidemiology 41 (2): 377-385. http://ije.oxfordjournals.org/content/41/2/377.short.↩

20. Buckland, Genevieve, Carlos A. Gonzalez, Antonio Agudo, Mireia Vilardell, Antoni Berenguer, Pilar Amiano, Eva Ardanaz, et al. 2009. ‘Adherence to the Mediterranean Diet and Risk of Coronary Heart Disease in the Spanish EPIC Cohort Study’. American Journal of Epidemiology, January, kwp282. https://academic.oup.com/aje/article-lookup/doi/10.1093/aje/kwp282↩

21. Sofi, Francesco, Claudio Macchi, Rosanna Abbate, Gian Franco Gensini, and Alessandro Casini. 2014. ‘Mediterranean Diet and Health Status: An Updated Meta-Analysis and a Proposal for a Literature-Based Adherence Score’. Public Health Nutrition 17 (12): 2769-82. https://www.cambridge.org/core/journals/public-health-nutrition/article/mediterranean-diet-and-health-status-an-updated-meta-analysis-and-a-proposal-for-a-literature-based-adherence-score/FCD121A09BB103DFB55237479D5CB659↩

22. Milà-Villarroel R, Bach-Faig A, Puig J, Puchal A, Farran A, Serra-Majem L, et al. Comparison and evaluation of the reliability of indexes of adherence to the Mediterranean diet. Public Health Nutr. 2011 Dec;14(12A):2338–45.↩

23. https://en.wikipedia.org/wiki/Sofrito↩