Exploring potential associations between childhood undernutrition and the Standardized Precipitation Evapotranspiration Index (SPEI) in Brazilian municipalities (2008–2019)

Author

Arthur R. Magalhães, Daniel Vartanian & Aline Martins de Carvalho

Published

2025-01-29

Overview

This report explores potential associations between childhood undernutrition and the Standardized Precipitation Evapotranspiration Index (SPEI) in Brazilian municipalities (2008–2019). It is part of the Sustentarea Research and Extension Group’s project titled Global syndemic: The impact of anthropogenic climate change on the health and nutrition of children under five years old served by Brazil’s public health system (SUS).

Please note that this report is designed to support decision-making and may not include all the details of the analysis.

Any additional analyses or updates will be incorporated into the report in future revisions, if necessary.

Question

This analysis seeks to address the following question:

Does the Standardized Precipitation Evapotranspiration Index (SPEI) significantly improve the prediction of childhood undernutrition in Brazilian municipalities?

Methods

Approach and Procedure Method

This study employed the hypothetical-deductive method, also known as the method of conjecture and refutation (Popper, 1979, p. 164), as its problem-solving approach. Procedurally, it applied an enhanced version of Null Hypothesis Significance Testing (NHST), grounded on the original ideas of Neyman-Pearson framework for data testing (Neyman & Pearson, 1928a, 1928b; Perezgonzalez, 2015).

The analysis was conducted using Generalized Additive Models (GAMs) to model and control for potential effects, alongside visual inspections of the data. Results are also presented for each cluster of the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) (Carvalho et al., 2021; Norde et al., 2023).

Source of Data/Information

The data used in this analysis have as sources:

Some data are imported directly from the source, while others rely on external data files available in the data directory of the code repository.

Data Wrangling

Data wrangling and analysis followed the data science framework outlined by Wickham et al. (2023), as illustrated in Figure 1. All processes were made using the R programming language (R Core Team, n.d.), RStudio IDE (Posit Team, n.d.), and several R packages.

The tidyverse and rOpenSci peer-reviewed package ecosystem and other R packages adherents of the tidy tools manifesto (Wickham et al., 2023) were prioritized. All processes were made in order to provide result reproducibility and to be in accordance with the FAIR principles (Wilkinson et al., 2016).

Figure 1: Model of the data science process created by Wickham, Çetinkaya-Runde, and Grolemund.

Source: Reproduced from Wickham et al. (2023).

The Tidyverse code style guide and design principles were followed to ensure consistency and enhance readability.

All the analyses are 100% reproducible and can be run again at any time. See the README file in the code repository to learn how to run them.

Model Parameters

The models were built using the mgcv R package (Wood, n.d.). Since the dependent variables are relative frequencies (continuous), we used the beta distribution family (Figure 2) with a logit link function (Equation 1)(Figure 3)(see Casella & Berger (2002)[p. 591). The REML (Restricted Maximum Likelihood) method was used to estimate the smoothing parameters.

\[ \text{logit}(P) = \ln\left(\frac{P}{1 - P}\right) = \beta_{0} + \beta_{1} X_{1} + \cdots + \beta_{k} X_{k} \tag{1}\]

Code
list <- 
  dplyr::tibble(
    alpha = c(0.5, 5, 1, 2, 2),
    beta = c(0.5, 1, 3, 2, 5),
    color = c(
      "a = b == 0.5",
      "a = 5, b = 1",
      "a = 1, b = 3",
      "a = 2, b = 2",
      "a = 2, b = 5"
    )
  ) %>%
  split(., seq(nrow(.)))

plot <- 
  ggplot2::ggplot(NULL, ggplot2::aes(x = x, color = color)) +
  ggplot2::labs(
    x = "x", 
    y = "Probability Density Function (PDF)",
    color = "Parameters"
  ) +
  ggplot2::scale_y_continuous(limits = c(0, 2.5))+
  scale_color_brand_d()

for (i in list) {
  plot <-
    plot +
    ggplot2::stat_function(
      data = dplyr::tibble(x = 0:1, color = factor(i$color)),
      fun = stats::dbeta,
      args = list(shape1 = i$alpha, shape2 = i$beta),
      n = 1000,
      linewidth = 1.5
    )
}

plot |> print() |> rutils::shush()
Figure 2: Examples of beta distributions with different parameters.

Source: Created by the authors.

Code
ggplot2::ggplot() +
  ggplot2::stat_function(
    data = dplyr::tibble(x = 0:1, color = factor(i$color)),
    fun = stats::qlogis,
    args = list(location = 0, scale = 1, log = FALSE),
    n = 1000,
    linewidth = 1.5,
    color = get_brand_color("red")
  ) +
  ggplot2::geom_hline(
    yintercept = 0, 
    linewidth = 0.25,
    linetype = "dashed",
    color = get_brand_color("grey")
  ) +
  ggplot2::geom_vline(
    xintercept = 0.5, 
    linewidth = 0.25,
    linetype = "dashed",
    color = get_brand_color("grey")
  ) +
  ggplot2::lims(
    x = c(0, 1),
    y = c(-6, 6)
  ) +
  ggplot2::labs(
    x = "Probability",
    y = "Logit(0,1)"
  )
Figure 3: Example of a logit function (i.e., the quantile function of the logistic distribution).

Source: Created by the authors.

Hypothesis Testing

We tested whether SPEI significantly improves model fit when predicting MBEPR & BEIPR (stunting) and MAPER & MPEPR (wasting) with nested models. We compared a restricted model (excluding SPEI) with a full model (including SPEI). To ensure practical significance, we applied a Minimum Effect Size (MES) criterion, following the original Neyman-Pearson framework for hypothesis testing (Neyman & Pearson, 1928a, 1928b; Perezgonzalez, 2015).

The MES was set at Cohen’s threshold for small effects (\(f^2 = 0.02\), equivalent to \(\text{R}^2 = 0.01960784\)). Thus, SPEI was considered significant only if its inclusion accounted for at least \(1.960784\%\) of the variance in the dependent variable.

The test was structured as follows:

  • Null hypothesis (\(\text{H}_{0}\)): Adding SPEI does not meaningfully improve the model’s fit, indicated by a negligible change in the adjusted \(\text{R}^{2}\) or a non-significant F-test (with a Type I error probability (\(\alpha\)) of \(0.05\)).

  • Alternative Hypothesis (\(\text{H}_{a}\)): Adding SPEI meaningfully improves the model’s fit, indicated by an increase in the adjusted \(\text{R}^{2}\) exceeding the MES and a significant F-test (with \(\alpha < 0.05\)).

Formally:

\[ \begin{cases} \text{H}_{0}: \Delta \ \text{Adjusted} \ \text{R}^{2} \leq \text{MES} \quad \text{or} \quad \text{F-test is not significant} \ (\alpha \geq 0.05) \\ \text{H}_{a}: \Delta \ \text{Adjusted} \ \text{R}^{2} > \text{MES} \quad \text{and} \quad \text{F-test is significant} \ (\alpha < 0.05) \end{cases} \]

Where:

\[ \Delta \ \text{Adjusted} \ \text{R}^{2} = \text{Adjusted} \ \text{R}^{2}_{\text{full}} - \text{Adjusted} \ \text{R}^{2}_{\text{restricted}} \]

The restricted model is the same as the first model presented in this document, minus the SPEI variable: ~ te(gini_index, gdp_per_capita) + s(year) (Continuous year).

Interpretation of Results

Standardized Precipitation Evapotranspiration Index (SPEI)

Since the original SPEI authors (Vicente-Serrano et al., 2010) did not establish definitive thresholds for SPEI values and their corresponding drought conditions, we adopt the benchmark values provided by Mehr et al. (2020) (Table 1).

Table 1: Classifications of wet and dry conditions using SPI and SPEI indices.
Classification SPI Threshold SPEI Threshold
Extremely wet 2.0 ≤ SPI 1.83 ≤ SPEI
Severely wet 2.0 > SPI ≥ 1.5 1.82 > SPEI ≥ 1.43
Moderately wet 1.49 > SPI ≥ 1.0 1.42 > SPEI ≥ 1.0
Near normal -1.0 ≤ SPI ≤ 1.0 -1.0 ≤ SPEI ≤ 1.0
Moderate drought (MoD) -1.49 ≤ SPI < -1.0 -1.42 ≤ SPEI < -1.0
Severe drought (SD) -2.0 ≤ SPI < -1.5 -1.82 ≤ SPEI < -1.43
Extreme drought (ED) SPI < -2.0 SPEI < -1.83

Source: Reproduced from Mehr et al. (2020).

Revised Multidimensional Index for Sustainable Food Systems (MISFS-R)

Results are also presented for each cluster of the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) (Figure 4).

The MISFS is a tool designed to assess the sustainability of food systems at a subnational level in Brazil, incorporating local behaviors and practices. The MISFS-R is a revised version that introduces new indicators and a refined methodology for calculating the index (Figure 4). For more details, see Carvalho et al. (2021) and Norde et al. (2023).

Figure 4: Dendrogram for cluster analysis between Brazilian states considering all the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) indicators and geographical location of each cluster.

Source: Reproduced from Norde et al. (2023).

Pratical Significance

To ensure practical significance, the adjusted \(\text{R}^2\) of the models are analysed for their effect sizes considering a confidence interval of \(95\%\). We use Cohen (1988) benchmark for interpretation.

A \(\text{R}^2\) less than \(\approx 0.0196\) is considered negligeble.

SMALL EFFECT SIZE: \(f^2 = .02\). Translated into \(\text{R}^{2}\) or partial \(\text{R}^{2}\) for Case 1, this gives \(.02 / (1 + .02) = .0196\). We thus define a small effect as one that accounts for 2% of the \(\text{Y}\) variance (in contrast with 1% for \(r\)), and translate to an \(\text{R} = \sqrt{0196} = .14\) (compared to .10 for \(r\)). This is a modest enough amount, just barely escaping triviality and (alas!) all too frequently in practice represents the true order of magnitude of the effect being tested (Cohen, 1988, p. 413).

[…] in many circumstances, all that is intended by “proving” the null hypothesis is that the ES [Effect Size] is not necessarily zero but small enough to be negligible […]. (Cohen, 1988, p. 461).

Setting the Enviroment

Code
source(here::here("R", "cohens_f_squared.R"))
source(here::here("R", "get_and_aggregate_sidra_by_year.R"))
source(here::here("R", "gam_misfs.R"))
source(here::here("R", "plot_brazil.R"))
source(here::here("R", "plot_dist.R"))
source(here::here("R", "plot_gam.R"))
source(here::here("R", "plot_ggally.R"))
source(here::here("R", "summarise_coefs.R"))
source(here::here("R", "summarise_r2.R"))
source(here::here("R", "tabset_panel_brazil_municipality.R"))
source(here::here("R", "tabset_panel_gam.R"))
source(here::here("R", "tabset_panel_gam_by_misfs.R"))
source(here::here("R", "tabset_panel_var_distribution.R"))
source(here::here("R", "tabset_panel_var_distribution_by_misfs.R"))
source(here::here("R", "utils.R"))
source(here::here("R", "utils-plots.R"))

Importing and Tidying the Data

Nutrition Data

Based on SISVAN Nutritional Status dataset (Sistema de Vigilância Alimentar e Nutricional, n.d.).

Code
nutrition_data <-
  here::here("data", "Banco_dados_malnutritio_clima - Adaptado.csv") |>
  readr::read_csv(col_types = readr::cols(.default = "c")) |>
  janitor::clean_names() |>
  dplyr::rename(
    year = ano,
    municipality_code = code_muni,
    sisvan_cover = cobrs,
    number_of_children = n_ao_de_criana_as_municipio_x,
    n_mbepr = muito_baixa_e_i_n_x,
    n_beipr = baixa_e_i_n_x,
    n_maper = magreza_acentuada_p_e_n_x,
    n_mpepr = magreza_p_e_n_x
  ) |>
  dplyr::select(
    year, municipality_code, misf, number_of_children, sisvan_cover,
    n_mbepr, n_beipr, n_maper, n_mpepr
  ) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::all_of(
        c("number_of_children", "n_mbepr", "n_beipr", "n_maper", "n_mpepr")
      ),
      .fns = ~ 
        dplyr::case_when(
          !(as.numeric(.x) %% 1 == 0) ~ stringr::str_remove(.x, "\\."),
          TRUE ~ .x
        ) |>
        as.integer()
    )
  ) |>
  dplyr::mutate(
    # year = as.integer(year),
    year =
      year |>
      factor(
        levels = year |> unique() |> sort(),
        ordered = TRUE
      ),
    municipality_code = as.integer(municipality_code),
    misf = factor(misf, levels = c("A", "B", "C", "D"), ordered = FALSE),
    sisvan_cover = as.numeric(sisvan_cover),
    mbepr = n_mbepr,
    beipr = n_beipr,
    n_mbepr_beipr = n_mbepr + n_beipr,
    mbepr_beipr = n_mbepr_beipr,
    maper = n_maper,
    mpepr = n_mpepr,
    n_maper_mpepr = n_maper + n_mpepr,
    maper_mpepr = n_maper_mpepr
  ) |>
  dplyr::filter(
    dplyr::between(sisvan_cover, 0, 1),
    number_of_children >= 0,
    number_of_children > n_mbepr,
    number_of_children > n_beipr,
    number_of_children > mbepr_beipr,
    number_of_children > n_maper,
    number_of_children > n_mpepr,
    number_of_children > maper_mpepr
  ) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::all_of(
        c("mbepr", "beipr", "mbepr_beipr", "maper", "mpepr", "maper_mpepr")
      ),
      .fns = ~
        .x  %>%
      `/`(number_of_children * sisvan_cover)
    ),
    dplyr::across(
      .cols = dplyr::all_of(
        c("mbepr", "beipr", "mbepr_beipr", "maper", "mpepr", "maper_mpepr")
      ),
      .fns = ~ pmax(0.00001, pmin(.x, 0.99999))
    )
  ) |>
  dplyr::select(
    year, municipality_code, misf, number_of_children, sisvan_cover, 
    n_mbepr, mbepr, n_beipr, beipr, n_mbepr_beipr, mbepr_beipr,
    n_maper, maper, n_mpepr, mpepr, n_maper_mpepr, maper_mpepr
  )

GDP Per Capita Data

Source: IBGE-SIDRA Table 5938 – Gross domestic product at current prices, taxes net of subsidies on products at current prices, and gross value added at current prices, total and by economic activity, and their respective shares - Reference year 2010 (Instituto Brasileiro de Geografia e Estatística, n.d.-b).

Code
tictoc::tic()

ibge_table_5938 <- 
  get_and_aggregate_sidra_by_year(
    years = nutrition_data$year |> unique(),
    api_start = "/t/5938/n6/all/v/37/p/",
    api_end = "/d/v37%200"
  ) |>
  regularize_col_names()

tictoc::toc()

beepr::beep(1)
Sys.sleep(3)
Code
# Last download: 2025-01-22 (~6m1s)

ibge_table_5938 |> 
  saveRDS(here::here("data", "ibge-table-5938.rds"))

ibge_table_5938 |> 
  readr::write_csv(here::here("data", "ibge-table-5938.csv"))

Source: IBGE-SIDRA Table 6579 – Estimated resident population (Instituto Brasileiro de Geografia e Estatística, n.d.-c).

Code
tictoc::tic()

ibge_table_6579 <- 
  get_and_aggregate_sidra_by_year(
    years = nutrition_data$year |> unique(),
    api_start = "/t/6579/n6/all/v/all/p/",
    api_end = ""
  ) |>
  regularize_col_names()

tictoc::toc()

beepr::beep(1)
Sys.sleep(3)
Code
# Last download: 2025-01-22 (~4m42s)

ibge_table_6579 |> 
  saveRDS(here::here("data", "ibge-table-6579.rds"))

ibge_table_6579 |> 
  readr::write_csv(here::here("data", "ibge-table-6579.csv"))
Code
gdp_data <- 
  ibge_table_5938 |>
  dplyr::left_join(
    ibge_table_6579,
    by = c("year", "municipality_code")
  ) |>
  dplyr::select(year, municipality_code, municipality.x, value.x, value.y) |>
  dplyr::rename(
    gdp = value.x,
    population = value.y,
    municipality = municipality.x
  ) |>
  dplyr::filter(gdp >= 0, population >= 0) |>
  dplyr::mutate(
    # year = as.integer(year),
    year =
      year |>
      factor(
        levels = year |> unique() |> sort(),
        ordered = TRUE
      ),
    gdp = gdp * 1000,
    gdp_per_capita = gdp / population,
    municipality_code = municipality_code |> as.integer()
  )

Gini Index Data

The Brazilian Institute of Geography and Statistics (IBGE) Automatic Retrieval System (SIDRA) provides GINI data by municipality only for the year 1991 (Table 115) (Instituto Brasileiro de Geografia e Estatística, n.d.-a). However, we found data processed by the Institute for Applied Economic Research (IPEA), which had access to census data for the years 2000 and 2010 (Instituto Brasileiro de Geografia e Estatística et al., n.d.).

Source: IBGE/IPEA – Gini Index of per capita household income by municipality: Period: 1991, 2000, and 2010 (Instituto Brasileiro de Geografia e Estatística, n.d.-c).

Code
gini_data <-
  "http://tabnet.datasus.gov.br/cgi/ibge/censo/bases/ginibr.csv" |>
  readr::read_delim(
    delim = ";",
    col_names = FALSE,
    col_types = readr::cols(.default = "c"),
    # locale = readr::locale(decimal_mark = ","),
    trim_ws = TRUE,
    skip = 3
  ) |>
  dplyr::rename_with(~ c("municipality", "x1991", "x2000", "x2010")) |>
  dplyr::slice(1:5565) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::everything(),
      .fns = ~ iconv(.x, from = "latin1", to = "UTF-8")
    ),
    dplyr::across(
      .cols = dplyr::starts_with("x"),
      .fns = ~ dplyr::case_when(
        .x == "..." ~ NA,
        TRUE ~ .x |> stringr::str_replace_all(",", ".")
      )
    ),
    dplyr::across(
      .cols = dplyr::starts_with("x"),
      .fns = as.numeric
    )
  ) |>
  tidyr::pivot_longer(
    cols = starts_with("x"),
    names_to = "year",
    values_to = "gini_index"
  ) |>
  dplyr::mutate(
    year = year |> stringr::str_remove("x") |> as.integer(),
    municipality_code = 
      municipality |> 
      stringr::str_extract("\\d*") |> 
      as.integer(),
    municipality = 
      municipality |> 
      stringr::str_remove("\\d*") |> 
      stringr::str_trim()
  )|>
  dplyr::relocate(year, municipality_code, .before = municipality)

SPEI Data

Based on WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Code
spei_data <- 
  here::here("data", "spei_Extreme_drought_event_municipality_year2.csv") |>
  readr::read_csv(col_types = readr::cols(.default = "c")) |>
  janitor::clean_names() |>
  dplyr::rename(municipality_code = code_muni) |>
  dplyr::select(
    municipality_code, 
    dplyr::all_of(paste0("spei_12m_", nutrition_data$year |> unique()))
  ) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::starts_with("spei_12m"),
      .fns = as.numeric
    )
  ) |>
  tidyr::pivot_longer(
    cols = starts_with("spei_12m"),
    names_to = "year",
    values_to = "spei_12m"
  ) |>
  dplyr::mutate(
    year =
      year |>
      stringr::str_remove("spei_12m_") |>
      as.integer(),
    year = 
      year |>
      factor(
        levels = year |> unique() |> sort(),
        ordered = TRUE
      ),
    municipality_code = municipality_code |> as.integer()
  )

Analysis Data

Code
data <- 
  nutrition_data |>
  dplyr::mutate(year = year |> as.character()) |>
  # In order to adapt the data to the municipalities in the nutrition and
  # gini data, since they do not have the check digit.
  dplyr::rename(temp_municipality_code = municipality_code) |>
  dplyr::left_join(
    y = gdp_data |> 
      dplyr::mutate(
        year = year |> as.character(),
        temp_municipality_code =
          municipality_code |>
          stringr::str_sub(end = -2) |>
          as.integer()
      ),
    by = c("year", "temp_municipality_code")
  ) |>
  dplyr::left_join(
    y = 
      gini_data |> 
      dplyr::filter(year == 2010) |>
      dplyr::select(municipality_code, gini_index) |>
      dplyr::rename(temp_municipality_code = municipality_code),
    by = c("temp_municipality_code"),
    relationship = "many-to-one"
  ) |>
  dplyr::left_join(
    y = spei_data |>
      dplyr::mutate(
        year = year |> as.character(),
        temp_municipality_code =
          municipality_code |>
          stringr::str_sub(end = -2) |>
          as.integer()
      ),
    by = c("year", "temp_municipality_code")
  ) |>
  dplyr::rename(
    municipality_code = municipality_code.x
  ) |>
  dplyr::select(
    year, municipality_code, municipality, misf, 
    number_of_children, sisvan_cover, 
    mbepr, beipr, mbepr_beipr, maper, mpepr, maper_mpepr,
    gini_index, gdp_per_capita, spei_12m
  ) |>
  dplyr::mutate(
    # year = as.integer(year),
    year =
      year |>
      factor(
        levels = year |> unique() |> sort(),
        ordered = TRUE
      )
  ) |>
  dplyr::filter(sisvan_cover >= 0.05) |>
  tidyr::drop_na(number_of_children, sisvan_cover)

data
Code
dplyr::tibble(
  n = data |> nrow(),
  n_sisvan_cover_less_than_0_05 = 
    data |> 
    dplyr::filter(sisvan_cover < 0.05) |> 
    nrow(),
  n_sisvan_cover_more_than_1 =
    data |> 
    dplyr::filter(sisvan_cover > 1) |> 
    nrow(),
  n_brazil_municipalities =
    geobr::read_municipality(year = 2022, showProgress = FALSE) |> 
    dplyr::pull(code_muni) |> 
    length() |>
    rutils::shush(),
  missing_municipalities = 
    geobr::read_municipality(year = 2022, showProgress = FALSE) |> 
    dplyr::pull(code_muni) |> 
    as.integer() |>
    setdiff(data |> dplyr::pull(municipality_code)) |>
    length() |>
    rutils::shush()
) |>
  tidyr::pivot_longer(cols = dplyr::everything())

Dictionary

  • year: Year of data collection.
  • municipality_code: Brazilian Institute of Geography and Statistics (IBGE) municipality code.
  • misf: Cluster of the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) (A, B, C, or D).
  • number_of_children: Number of children under five years old in the municipality.
  • sisvan_cover: Proportion of children under five covered by the Brazilian Food and Nutrition Surveillance System (SISVAN) in the municipality.
  • mbepr: Relative frequency of children under five years old with Very Short Stature for Age (Muito Baixa Estatura Para a Idade) in the municipality.
  • beipr: Relative frequency of children under five years old with Short Stature for Age (Baixa Estatura Para Idade) in the municipality.
  • mbepr_beipr: Relative frequency of children under five years old with Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade) in the municipality.
  • maper: Relative frequency of children under five years old with Severe Thinness for Height (Magreza Acentuada Para a Estatura) in the municipality.
  • mpepr: Relative frequency of children under five years old with Thinness for Height (Magreza Por Estatura) in the municipality.
  • maper_mpepr: Relative frequency of children under five years old with Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura) in the municipality.
  • gini_index: Gini index of per capita household income in the municipality at 2010. Due to limited data availability at the municipal level, all values are based on the 2010 Brazilian Census.
  • gdp_per_capita: Gross Domestic Product (GDP) per capita in the municipality in Brazilian Reais (BRL) based at current prices on 2010.
  • spei_12m: Standardised Precipitation Evapotranspiration Index (SPEI) in a 12-month times cale for the municipality.

Checking SISVAN Cover

Code
brand_div_palette <- function(x) {
  make_color_vector(
    n_prop = x, 
    colors = c(
      get_brand_color("dark-red"),
      # get_brand_color("white"),
      get_brand_color_mix(
        position = 950,
        color_1 = "dark-red",
        color_2 = "dark-red-triadic-blue",
        alpha = 0.5
      ),
      get_brand_color("dark-red-triadic-blue")
    )
  )
}
Code
# Run this chunk to produce the plots and the animation.

data |> 
  dplyr::mutate(sisvan_cover = sisvan_cover * 100) |>
  animate_plot_brazil_municipality(
    col_fill = "sisvan_cover",
    col_group = "year",
    group_label = "Year",
    comparable_areas = TRUE
    suffix = NULL,
    width = 1344,
    height = 960,
    dpi = 150,
    transform = "identity",
    breaks = seq(0, 100, 25),
    reverse = FALSE,
    limits = c(0, 100),
    palette = brand_div_palette
  )
Figure 5: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2008-2019).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 6: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2008).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 7: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2009).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 8: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2010).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 9: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2011).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 10: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2012).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 11: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2013).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 12: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2014).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 13: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2015).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 14: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2016).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 15: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2017).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 16: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2018).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Figure 17: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2019).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-c).

Checking SPEI Variations

Year-to-Year comparison

Code
# Run this chunk to produce the plots and the animation.

data |> 
  animate_plot_brazil_municipality(
    col_fill = "spei_12m",
    col_group = "year",
    group_label = "Year",
    comparable_areas = TRUE
    suffix = NULL,
    width = 1344,
    height = 960,
    dpi = 150,
    transform = "identity",
    # breaks = c(-2, -1.83, -1.43, -1, 1, 1.42, 1.82, 2),
    breaks = seq(-2 , 2, 0.5),
    reverse = FALSE,
    limits = c(-2, 2),
    palette = brand_div_palette
  )
Figure 18: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2008-2019).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 19: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2008).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 20: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2009).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 21: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2010).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 22: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2011).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 23: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2012).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 24: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2013).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 25: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2014).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 26: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2015).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 27: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2016).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 28: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2017).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 29: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2018).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 30: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2019).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Comparison with External Data

Figure 31 presents an independent analysis for comparison, while our results are shown in Figure 32.

Figure 31: Average Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)).

Source: Reproduced from Food and Agriculture Organization of the United Nations et al. (2025, fig. VI.1, p. 185).

Code
plot <- 
  data |>
  dplyr::filter(year >= 2010, year <= 2019) |>
  plot_brazil_municipality(
    col_fill = "spei_12m",
    comparable_areas = TRUE,
    transform = "identity",
    binned = FALSE,
    breaks = seq(-2 , 2, 0.5),
    reverse = FALSE,
    limits = c(-2, 2),
    print = FALSE,
    quiet = TRUE,
    palette = function(x) {
      make_color_vector(
        n_prop = x, 
        colors = c(
          "#6F0322",
          "#BC2D32",
          "#E28668",
          "#F9D0BC",
          "#F1F1F3",
          "#BBDAE9",
          "#65A9D1",
          "#266DB1",
          "#0D2648"
        )
      )
    }
  ) +
  ggplot2::labs(title = "2010-2019") +
  ggplot2::theme(plot.title = element_text(hjust = 0.5))

plot |> print() |> rutils::shush()
Figure 32: Average Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Checking Distributions

General Distributions

Code
data |>
  summarytools::freq(
    var = year,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 2: Frequencies of the year variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
2008 4996 7.96 7.96 7.96 7.96
2009 5253 8.37 16.33 8.37 16.33
2010 5274 8.40 24.73 8.40 24.73
2011 5266 8.39 33.12 8.39 33.12
2012 5288 8.43 41.55 8.43 41.55
2013 5143 8.19 49.74 8.19 49.74
2014 5164 8.23 57.97 8.23 57.97
2015 5229 8.33 66.30 8.33 66.30
2016 5280 8.41 74.72 8.41 74.72
2017 5263 8.39 83.10 8.39 83.10
2018 5271 8.40 91.50 8.40 91.50
2019 5335 8.50 100.00 8.50 100.00
<NA> 0 0.00 100.00
Total 62762 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data |>
  plot_bar(
    col = "year",
    y_label = "year"
  )
Figure 33: Bar plot of the year variable.

Source: Created by the authors.

Code
data |>
  summarytools::freq(
    var = misf,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 3: Frequencies of the misf variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
A 7934 12.64 12.64 12.64 12.64
B 31734 50.56 63.20 50.56 63.20
C 20324 32.38 95.59 32.38 95.59
D 2770 4.41 100.00 4.41 100.00
<NA> 0 0.00 100.00
Total 62762 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data |>
  plot_bar(
    col = "misf",
    y_label = "misf"
  )
Figure 34: Bar plot of the misf variable.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = number_of_children,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 4: Statistics for the number_of_children variable.
  number_of_children
Mean 2498.50
Std.Dev 9764.47
Min 41.00
Q1 399.00
Median 910.00
Q3 2009.00
Max 797644.00
MAD 911.80
IQR 1610.00
CV 3.91
Skewness 32.79
SE.Skewness 0.01
Kurtosis 1888.84
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "number_of_children",
    jitter = FALSE
  )
Figure 35: Histogram of the number_of_children variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = sisvan_cover,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 5: Statistics for the sisvan_cover variable.
  sisvan_cover
Mean 0.41
Std.Dev 0.23
Min 0.05
Q1 0.23
Median 0.38
Q3 0.57
Max 1.00
MAD 0.25
IQR 0.34
CV 0.55
Skewness 0.51
SE.Skewness 0.01
Kurtosis -0.55
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "sisvan_cover",
    jitter = FALSE
  )
Figure 36: Histogram of the sisvan_cover variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = mbepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 6: Statistics for the mbepr variable.
  mbepr
Mean 0.06
Std.Dev 0.05
Min 0.00
Q1 0.03
Median 0.05
Q3 0.07
Max 0.89
MAD 0.03
IQR 0.04
CV 0.81
Skewness 3.16
SE.Skewness 0.01
Kurtosis 23.36
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "mbepr",
    jitter = FALSE
  )
Figure 37: Histogram of the mbepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 7: Statistics for the beipr variable.
  beipr
Mean 0.07
Std.Dev 0.04
Min 0.00
Q1 0.04
Median 0.06
Q3 0.08
Max 0.69
MAD 0.03
IQR 0.04
CV 0.54
Skewness 1.42
SE.Skewness 0.01
Kurtosis 5.80
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "beipr",
    jitter = FALSE
  )
Figure 38: Histogram of the beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = mbepr_beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 8: Statistics for the mbepr_beipr variable.
  mbepr_beipr
Mean 0.12
Std.Dev 0.07
Min 0.00
Q1 0.08
Median 0.11
Q3 0.15
Max 1.00
MAD 0.06
IQR 0.08
CV 0.58
Skewness 1.77
SE.Skewness 0.01
Kurtosis 6.89
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "mbepr_beipr",
    jitter = FALSE
  )
Figure 39: Histogram of the mbepr_beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = maper,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 9: Statistics for the maper variable.
  maper
Mean 0.02
Std.Dev 0.03
Min 0.00
Q1 0.01
Median 0.02
Q3 0.03
Max 0.75
MAD 0.02
IQR 0.02
CV 1.05
Skewness 5.34
SE.Skewness 0.01
Kurtosis 68.42
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "maper",
    jitter = FALSE
  )
Figure 40: Histogram of the maper variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 10: Statistics for the mpepr variable.
  mpepr
Mean 0.03
Std.Dev 0.02
Min 0.00
Q1 0.02
Median 0.03
Q3 0.04
Max 0.58
MAD 0.02
IQR 0.02
CV 0.67
Skewness 2.14
SE.Skewness 0.01
Kurtosis 23.16
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "mpepr",
    jitter = FALSE
  )
Figure 41: Histogram of the mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = maper_mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 11: Statistics for the maper_mpepr variable.
  maper_mpepr
Mean 0.05
Std.Dev 0.04
Min 0.00
Q1 0.03
Median 0.05
Q3 0.07
Max 0.91
MAD 0.03
IQR 0.04
CV 0.73
Skewness 3.14
SE.Skewness 0.01
Kurtosis 27.23
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "maper_mpepr",
    jitter = FALSE
  )
Figure 42: Histogram of the maper_mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = gini_index,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 12: Statistics for the gini_index variable.
  gini_index
Mean 0.50
Std.Dev 0.07
Min 0.28
Q1 0.46
Median 0.50
Q3 0.55
Max 0.81
MAD 0.06
IQR 0.09
CV 0.13
Skewness 0.22
SE.Skewness 0.01
Kurtosis 0.56
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "gini_index",
    jitter = FALSE
  )
Figure 43: Histogram of the gini_index variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = gdp_per_capita,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 13: Statistics for the gdp_per_capita variable.
  gdp_per_capita
Mean 18045.58
Std.Dev 20454.91
Min 301.61
Q1 7485.60
Median 12703.63
Q3 22238.03
Max 815697.80
MAD 9267.71
IQR 14751.90
CV 1.13
Skewness 8.75
SE.Skewness 0.01
Kurtosis 179.42
N.Valid 57487.00
Pct.Valid 91.60

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "gdp_per_capita",
    jitter = FALSE
  )
Figure 44: Histogram of the gdp_per_capita variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = spei_12m,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 14: Statistics for the spei_12m variable.
  spei_12m
Mean -0.18
Std.Dev 0.41
Min -1.75
Q1 -0.48
Median -0.17
Q3 0.11
Max 1.03
MAD 0.44
IQR 0.59
CV -2.27
Skewness -0.08
SE.Skewness 0.01
Kurtosis -0.44
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "spei_12m",
    jitter = FALSE
  )
Figure 45: Histogram of the spei_12m variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

By MISFS-R Clusters

Code
categories <- c("A", "B", "C", "D")

for (i in categories) {
  i_data_name  <- paste0("data_misfs_", tolower(i))
  
  assign(
    i_data_name,
    data |> dplyr::filter(misf == i)
  )
}

A

Code
data_misfs_a |>
  summarytools::freq(
    var = year,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 15: Frequencies of the year variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
2008 615 7.75 7.75 7.75 7.75
2009 662 8.34 16.10 8.34 16.10
2010 663 8.36 24.45 8.36 24.45
2011 666 8.39 32.85 8.39 32.85
2012 665 8.38 41.23 8.38 41.23
2013 667 8.41 49.63 8.41 49.63
2014 670 8.44 58.08 8.44 58.08
2015 669 8.43 66.51 8.43 66.51
2016 663 8.36 74.87 8.36 74.87
2017 662 8.34 83.21 8.34 83.21
2018 663 8.36 91.57 8.36 91.57
2019 669 8.43 100.00 8.43 100.00
<NA> 0 0.00 100.00
Total 7934 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_bar(
    col = "year",
    y_label = "year"
  )
Figure 46: Bar plot of the year variable.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::freq(
    var = misf,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 16: Frequencies of the misf variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
A 7934 100.00 100.00 100.00 100.00
B 0 0.00 100.00 0.00 100.00
C 0 0.00 100.00 0.00 100.00
D 0 0.00 100.00 0.00 100.00
<NA> 0 0.00 100.00
Total 7934 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_bar(
    col = "misf",
    y_label = "misf"
  )
Figure 47: Bar plot of the misf variable.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = number_of_children,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 17: Statistics for the number_of_children variable.
  number_of_children
Mean 1877.77
Std.Dev 5272.84
Min 59.00
Q1 325.00
Median 682.50
Q3 1554.00
Max 94954.00
MAD 651.60
IQR 1228.50
CV 2.81
Skewness 9.42
SE.Skewness 0.03
Kurtosis 117.89
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "number_of_children",
    jitter = FALSE
  )
Figure 48: Histogram of the number_of_children variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = sisvan_cover,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 18: Statistics for the sisvan_cover variable.
  sisvan_cover
Mean 0.34
Std.Dev 0.18
Min 0.05
Q1 0.20
Median 0.30
Q3 0.44
Max 1.00
MAD 0.16
IQR 0.24
CV 0.54
Skewness 0.98
SE.Skewness 0.03
Kurtosis 0.79
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "sisvan_cover",
    jitter = FALSE
  )
Figure 49: Histogram of the sisvan_cover variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = mbepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 19: Statistics for the mbepr variable.
  mbepr
Mean 0.06
Std.Dev 0.05
Min 0.00
Q1 0.03
Median 0.05
Q3 0.08
Max 0.78
MAD 0.03
IQR 0.04
CV 0.79
Skewness 3.77
SE.Skewness 0.03
Kurtosis 33.23
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "mbepr",
    jitter = FALSE
  )
Figure 50: Histogram of the mbepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 20: Statistics for the beipr variable.
  beipr
Mean 0.07
Std.Dev 0.04
Min 0.00
Q1 0.04
Median 0.06
Q3 0.08
Max 0.69
MAD 0.03
IQR 0.04
CV 0.56
Skewness 2.01
SE.Skewness 0.03
Kurtosis 16.06
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "beipr",
    jitter = FALSE
  )
Figure 51: Histogram of the beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = mbepr_beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 21: Statistics for the mbepr_beipr variable.
  mbepr_beipr
Mean 0.13
Std.Dev 0.07
Min 0.00
Q1 0.08
Median 0.11
Q3 0.16
Max 1.00
MAD 0.06
IQR 0.08
CV 0.57
Skewness 2.25
SE.Skewness 0.03
Kurtosis 12.63
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "mbepr_beipr",
    jitter = FALSE
  )
Figure 52: Histogram of the mbepr_beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = maper,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 22: Statistics for the maper variable.
  maper
Mean 0.03
Std.Dev 0.03
Min 0.00
Q1 0.01
Median 0.02
Q3 0.04
Max 0.59
MAD 0.02
IQR 0.02
CV 1.03
Skewness 5.40
SE.Skewness 0.03
Kurtosis 61.28
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "maper",
    jitter = FALSE
  )
Figure 53: Histogram of the maper variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 23: Statistics for the mpepr variable.
  mpepr
Mean 0.03
Std.Dev 0.02
Min 0.00
Q1 0.02
Median 0.03
Q3 0.04
Max 0.46
MAD 0.02
IQR 0.02
CV 0.67
Skewness 2.53
SE.Skewness 0.03
Kurtosis 26.20
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "mpepr",
    jitter = FALSE
  )
Figure 54: Histogram of the mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = maper_mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 24: Statistics for the maper_mpepr variable.
  maper_mpepr
Mean 0.06
Std.Dev 0.04
Min 0.00
Q1 0.04
Median 0.05
Q3 0.08
Max 0.91
MAD 0.03
IQR 0.04
CV 0.71
Skewness 4.02
SE.Skewness 0.03
Kurtosis 41.22
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "maper_mpepr",
    jitter = FALSE
  )
Figure 55: Histogram of the maper_mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = gini_index,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 25: Statistics for the gini_index variable.
  gini_index
Mean 0.52
Std.Dev 0.06
Min 0.37
Q1 0.48
Median 0.52
Q3 0.56
Max 0.78
MAD 0.06
IQR 0.08
CV 0.12
Skewness 0.52
SE.Skewness 0.03
Kurtosis 0.61
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "gini_index",
    jitter = FALSE
  )
Figure 56: Histogram of the gini_index variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = gdp_per_capita,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 26: Statistics for the gdp_per_capita variable.
  gdp_per_capita
Mean 22058.96
Std.Dev 20696.45
Min 3522.11
Q1 11119.05
Median 16237.33
Q3 25444.64
Max 362079.97
MAD 9273.49
IQR 14319.14
CV 0.94
Skewness 5.12
SE.Skewness 0.03
Kurtosis 47.82
N.Valid 7271.00
Pct.Valid 91.64

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "gdp_per_capita",
    jitter = FALSE
  )
Figure 57: Histogram of the gdp_per_capita variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = spei_12m,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 27: Statistics for the spei_12m variable.
  spei_12m
Mean -0.31
Std.Dev 0.41
Min -1.64
Q1 -0.60
Median -0.27
Q3 -0.03
Max 1.03
MAD 0.42
IQR 0.57
CV -1.31
Skewness -0.20
SE.Skewness 0.03
Kurtosis -0.31
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "spei_12m",
    jitter = FALSE
  )
Figure 58: Histogram of the spei_12m variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

B

Code
data_misfs_b |>
  summarytools::freq(
    var = year,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 28: Frequencies of the year variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
2008 2539 8.00 8.00 8.00 8.00
2009 2662 8.39 16.39 8.39 16.39
2010 2689 8.47 24.86 8.47 24.86
2011 2668 8.41 33.27 8.41 33.27
2012 2663 8.39 41.66 8.39 41.66
2013 2556 8.05 49.72 8.05 49.72
2014 2560 8.07 57.78 8.07 57.78
2015 2619 8.25 66.04 8.25 66.04
2016 2665 8.40 74.43 8.40 74.43
2017 2664 8.39 82.83 8.39 82.83
2018 2710 8.54 91.37 8.54 91.37
2019 2739 8.63 100.00 8.63 100.00
<NA> 0 0.00 100.00
Total 31734 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_bar(
    col = "year",
    y_label = "year"
  )
Figure 59: Bar plot of the year variable.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::freq(
    var = misf,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 29: Frequencies of the misf variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
A 0 0.00 0.00 0.00 0.00
B 31734 100.00 100.00 100.00 100.00
C 0 0.00 100.00 0.00 100.00
D 0 0.00 100.00 0.00 100.00
<NA> 0 0.00 100.00
Total 31734 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_bar(
    col = "misf",
    y_label = "misf"
  )
Figure 60: Bar plot of the misf variable.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = number_of_children,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 30: Statistics for the number_of_children variable.
  number_of_children
Mean 2433.14
Std.Dev 11344.02
Min 41.00
Q1 305.00
Median 647.00
Q3 1627.00
Max 797644.00
MAD 644.93
IQR 1322.00
CV 4.66
Skewness 36.48
SE.Skewness 0.01
Kurtosis 1983.24
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "number_of_children",
    jitter = FALSE
  )
Figure 61: Histogram of the number_of_children variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = sisvan_cover,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 31: Statistics for the sisvan_cover variable.
  sisvan_cover
Mean 0.38
Std.Dev 0.24
Min 0.05
Q1 0.18
Median 0.32
Q3 0.54
Max 1.00
MAD 0.24
IQR 0.36
CV 0.64
Skewness 0.74
SE.Skewness 0.01
Kurtosis -0.45
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "sisvan_cover",
    jitter = FALSE
  )
Figure 62: Histogram of the sisvan_cover variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = mbepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 32: Statistics for the mbepr variable.
  mbepr
Mean 0.04
Std.Dev 0.04
Min 0.00
Q1 0.02
Median 0.04
Q3 0.06
Max 0.89
MAD 0.03
IQR 0.04
CV 0.94
Skewness 3.80
SE.Skewness 0.01
Kurtosis 32.09
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "mbepr",
    jitter = FALSE
  )
Figure 63: Histogram of the mbepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 33: Statistics for the beipr variable.
  beipr
Mean 0.06
Std.Dev 0.03
Min 0.00
Q1 0.04
Median 0.05
Q3 0.07
Max 0.49
MAD 0.02
IQR 0.03
CV 0.56
Skewness 1.45
SE.Skewness 0.01
Kurtosis 6.36
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "beipr",
    jitter = FALSE
  )
Figure 64: Histogram of the beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = mbepr_beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 34: Statistics for the mbepr_beipr variable.
  mbepr_beipr
Mean 0.10
Std.Dev 0.06
Min 0.00
Q1 0.06
Median 0.09
Q3 0.12
Max 0.89
MAD 0.05
IQR 0.06
CV 0.61
Skewness 2.16
SE.Skewness 0.01
Kurtosis 10.79
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "mbepr_beipr",
    jitter = FALSE
  )
Figure 65: Histogram of the mbepr_beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = maper,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 35: Statistics for the maper variable.
  maper
Mean 0.02
Std.Dev 0.02
Min 0.00
Q1 0.01
Median 0.01
Q3 0.03
Max 0.75
MAD 0.01
IQR 0.02
CV 1.22
Skewness 5.57
SE.Skewness 0.01
Kurtosis 78.88
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "maper",
    jitter = FALSE
  )
Figure 66: Histogram of the maper variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 36: Statistics for the mpepr variable.
  mpepr
Mean 0.02
Std.Dev 0.02
Min 0.00
Q1 0.01
Median 0.02
Q3 0.03
Max 0.40
MAD 0.01
IQR 0.02
CV 0.81
Skewness 2.18
SE.Skewness 0.01
Kurtosis 13.89
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "mpepr",
    jitter = FALSE
  )
Figure 67: Histogram of the mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = maper_mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 37: Statistics for the maper_mpepr variable.
  maper_mpepr
Mean 0.04
Std.Dev 0.04
Min 0.00
Q1 0.02
Median 0.04
Q3 0.06
Max 0.75
MAD 0.02
IQR 0.03
CV 0.83
Skewness 3.18
SE.Skewness 0.01
Kurtosis 26.11
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "maper_mpepr",
    jitter = FALSE
  )
Figure 68: Histogram of the maper_mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = gini_index,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 38: Statistics for the gini_index variable.
  gini_index
Mean 0.47
Std.Dev 0.06
Min 0.28
Q1 0.43
Median 0.47
Q3 0.51
Max 0.78
MAD 0.06
IQR 0.08
CV 0.12
Skewness 0.24
SE.Skewness 0.01
Kurtosis 0.64
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "gini_index",
    jitter = FALSE
  )
Figure 69: Histogram of the gini_index variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = gdp_per_capita,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 39: Statistics for the gdp_per_capita variable.
  gdp_per_capita
Mean 23457.49
Std.Dev 23488.35
Min 2729.65
Q1 11984.65
Median 18584.56
Q3 27952.20
Max 815697.80
MAD 11122.91
IQR 15967.55
CV 1.00
Skewness 9.28
SE.Skewness 0.01
Kurtosis 182.88
N.Valid 29045.00
Pct.Valid 91.53

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "gdp_per_capita",
    jitter = FALSE
  )
Figure 70: Histogram of the gdp_per_capita variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = spei_12m,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 40: Statistics for the spei_12m variable.
  spei_12m
Mean -0.08
Std.Dev 0.36
Min -1.24
Q1 -0.34
Median -0.07
Q3 0.17
Max 0.78
MAD 0.37
IQR 0.51
CV -4.74
Skewness -0.01
SE.Skewness 0.01
Kurtosis -0.58
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "spei_12m",
    jitter = FALSE
  )
Figure 71: Histogram of the spei_12m variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

C

Code
data_misfs_c |>
  summarytools::freq(
    var = year,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 41: Frequencies of the year variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
2008 1625 8.00 8.00 8.00 8.00
2009 1702 8.37 16.37 8.37 16.37
2010 1690 8.32 24.69 8.32 24.69
2011 1700 8.36 33.05 8.36 33.05
2012 1728 8.50 41.55 8.50 41.55
2013 1685 8.29 49.84 8.29 49.84
2014 1700 8.36 58.21 8.36 58.21
2015 1705 8.39 66.60 8.39 66.60
2016 1718 8.45 75.05 8.45 75.05
2017 1704 8.38 83.43 8.38 83.43
2018 1668 8.21 91.64 8.21 91.64
2019 1699 8.36 100.00 8.36 100.00
<NA> 0 0.00 100.00
Total 20324 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_bar(
    col = "year",
    y_label = "year"
  )
Figure 72: Bar plot of the year variable.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::freq(
    var = misf,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 42: Frequencies of the misf variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
A 0 0.00 0.00 0.00 0.00
B 0 0.00 0.00 0.00 0.00
C 20324 100.00 100.00 100.00 100.00
D 0 0.00 100.00 0.00 100.00
<NA> 0 0.00 100.00
Total 20324 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_bar(
    col = "misf",
    y_label = "misf"
  )
Figure 73: Bar plot of the misf variable.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = number_of_children,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 43: Statistics for the number_of_children variable.
  number_of_children
Mean 2439.41
Std.Dev 7494.04
Min 96.00
Q1 636.00
Median 1213.00
Q3 2206.00
Max 206458.00
MAD 1024.48
IQR 1570.00
CV 3.07
Skewness 16.77
SE.Skewness 0.02
Kurtosis 368.16
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "number_of_children",
    jitter = FALSE
  )
Figure 74: Histogram of the number_of_children variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = sisvan_cover,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 44: Statistics for the sisvan_cover variable.
  sisvan_cover
Mean 0.50
Std.Dev 0.19
Min 0.05
Q1 0.36
Median 0.49
Q3 0.62
Max 1.00
MAD 0.20
IQR 0.27
CV 0.39
Skewness 0.17
SE.Skewness 0.02
Kurtosis -0.36
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "sisvan_cover",
    jitter = FALSE
  )
Figure 75: Histogram of the sisvan_cover variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = mbepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 45: Statistics for the mbepr variable.
  mbepr
Mean 0.07
Std.Dev 0.04
Min 0.00
Q1 0.04
Median 0.06
Q3 0.08
Max 0.71
MAD 0.03
IQR 0.04
CV 0.64
Skewness 3.00
SE.Skewness 0.02
Kurtosis 20.44
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "mbepr",
    jitter = FALSE
  )
Figure 76: Histogram of the mbepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 46: Statistics for the beipr variable.
  beipr
Mean 0.08
Std.Dev 0.03
Min 0.00
Q1 0.06
Median 0.07
Q3 0.09
Max 0.38
MAD 0.03
IQR 0.03
CV 0.40
Skewness 1.12
SE.Skewness 0.02
Kurtosis 2.98
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "beipr",
    jitter = FALSE
  )
Figure 77: Histogram of the beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = mbepr_beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 47: Statistics for the mbepr_beipr variable.
  mbepr_beipr
Mean 0.14
Std.Dev 0.07
Min 0.00
Q1 0.10
Median 0.13
Q3 0.17
Max 0.78
MAD 0.05
IQR 0.07
CV 0.45
Skewness 1.69
SE.Skewness 0.02
Kurtosis 6.25
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "mbepr_beipr",
    jitter = FALSE
  )
Figure 78: Histogram of the mbepr_beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = maper,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 48: Statistics for the maper variable.
  maper
Mean 0.03
Std.Dev 0.03
Min 0.00
Q1 0.02
Median 0.03
Q3 0.04
Max 0.69
MAD 0.02
IQR 0.02
CV 0.85
Skewness 5.82
SE.Skewness 0.02
Kurtosis 73.54
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "maper",
    jitter = FALSE
  )
Figure 79: Histogram of the maper variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 49: Statistics for the mpepr variable.
  mpepr
Mean 0.03
Std.Dev 0.02
Min 0.00
Q1 0.02
Median 0.03
Q3 0.04
Max 0.26
MAD 0.01
IQR 0.02
CV 0.48
Skewness 1.42
SE.Skewness 0.02
Kurtosis 6.23
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "mpepr",
    jitter = FALSE
  )
Figure 80: Histogram of the mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = maper_mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 50: Statistics for the maper_mpepr variable.
  maper_mpepr
Mean 0.07
Std.Dev 0.04
Min 0.00
Q1 0.04
Median 0.06
Q3 0.08
Max 0.74
MAD 0.03
IQR 0.04
CV 0.58
Skewness 3.47
SE.Skewness 0.02
Kurtosis 29.22
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "maper_mpepr",
    jitter = FALSE
  )
Figure 81: Histogram of the maper_mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = gini_index,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 51: Statistics for the gini_index variable.
  gini_index
Mean 0.53
Std.Dev 0.05
Min 0.37
Q1 0.50
Median 0.53
Q3 0.56
Max 0.80
MAD 0.05
IQR 0.06
CV 0.09
Skewness 0.37
SE.Skewness 0.02
Kurtosis 0.98
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "gini_index",
    jitter = FALSE
  )
Figure 82: Histogram of the gini_index variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = gdp_per_capita,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 52: Statistics for the gdp_per_capita variable.
  gdp_per_capita
Mean 8964.53
Std.Dev 9688.17
Min 301.61
Q1 5145.99
Median 6999.36
Q3 9466.20
Max 296621.36
MAD 3086.89
IQR 4320.21
CV 1.08
Skewness 9.54
SE.Skewness 0.02
Kurtosis 162.45
N.Valid 18633.00
Pct.Valid 91.68

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "gdp_per_capita",
    jitter = FALSE
  )
Figure 83: Histogram of the gdp_per_capita variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = spei_12m,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 53: Statistics for the spei_12m variable.
  spei_12m
Mean -0.29
Std.Dev 0.45
Min -1.42
Q1 -0.63
Median -0.34
Q3 0.05
Max 0.89
MAD 0.48
IQR 0.67
CV -1.57
Skewness 0.23
SE.Skewness 0.02
Kurtosis -0.61
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "spei_12m",
    jitter = FALSE
  )
Figure 84: Histogram of the spei_12m variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

D

Code
data_misfs_d |>
  summarytools::freq(
    var = year,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 54: Frequencies of the year variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
2008 217 7.83 7.83 7.83 7.83
2009 227 8.19 16.03 8.19 16.03
2010 232 8.38 24.40 8.38 24.40
2011 232 8.38 32.78 8.38 32.78
2012 232 8.38 41.16 8.38 41.16
2013 235 8.48 49.64 8.48 49.64
2014 234 8.45 58.09 8.45 58.09
2015 236 8.52 66.61 8.52 66.61
2016 234 8.45 75.05 8.45 75.05
2017 233 8.41 83.47 8.41 83.47
2018 230 8.30 91.77 8.30 91.77
2019 228 8.23 100.00 8.23 100.00
<NA> 0 0.00 100.00
Total 2770 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_bar(
    col = "year",
    y_label = "year"
  )
Figure 85: Bar plot of the year variable.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::freq(
    var = misf,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 55: Frequencies of the misf variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
A 0 0.00 0.00 0.00 0.00
B 0 0.00 0.00 0.00 0.00
C 0 0.00 0.00 0.00 0.00
D 2770 100.00 100.00 100.00 100.00
<NA> 0 0.00 100.00
Total 2770 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_bar(
    col = "misf",
    y_label = "misf"
  )
Figure 86: Bar plot of the misf variable.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = number_of_children,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 56: Statistics for the number_of_children variable.
  number_of_children
Mean 5458.81
Std.Dev 13582.98
Min 274.00
Q1 1730.00
Median 2901.50
Q3 5084.00
Max 176505.00
MAD 2058.59
IQR 3353.50
CV 2.49
Skewness 9.79
SE.Skewness 0.05
Kurtosis 110.53
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "number_of_children",
    jitter = FALSE
  )
Figure 87: Histogram of the number_of_children variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = sisvan_cover,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 57: Statistics for the sisvan_cover variable.
  sisvan_cover
Mean 0.37
Std.Dev 0.18
Min 0.05
Q1 0.22
Median 0.34
Q3 0.49
Max 1.00
MAD 0.20
IQR 0.27
CV 0.50
Skewness 0.59
SE.Skewness 0.05
Kurtosis 0.00
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "sisvan_cover",
    jitter = FALSE
  )
Figure 88: Histogram of the sisvan_cover variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = mbepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 58: Statistics for the mbepr variable.
  mbepr
Mean 0.09
Std.Dev 0.06
Min 0.00
Q1 0.06
Median 0.08
Q3 0.11
Max 0.70
MAD 0.04
IQR 0.05
CV 0.60
Skewness 2.83
SE.Skewness 0.05
Kurtosis 15.78
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "mbepr",
    jitter = FALSE
  )
Figure 89: Histogram of the mbepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 59: Statistics for the beipr variable.
  beipr
Mean 0.13
Std.Dev 0.05
Min 0.00
Q1 0.09
Median 0.12
Q3 0.15
Max 0.37
MAD 0.04
IQR 0.06
CV 0.36
Skewness 0.82
SE.Skewness 0.05
Kurtosis 1.03
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "beipr",
    jitter = FALSE
  )
Figure 90: Histogram of the beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = mbepr_beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 60: Statistics for the mbepr_beipr variable.
  mbepr_beipr
Mean 0.22
Std.Dev 0.09
Min 0.02
Q1 0.16
Median 0.21
Q3 0.27
Max 0.77
MAD 0.08
IQR 0.11
CV 0.40
Skewness 1.15
SE.Skewness 0.05
Kurtosis 2.43
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "mbepr_beipr",
    jitter = FALSE
  )
Figure 91: Histogram of the mbepr_beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = maper,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 61: Statistics for the maper variable.
  maper
Mean 0.03
Std.Dev 0.02
Min 0.00
Q1 0.02
Median 0.02
Q3 0.03
Max 0.25
MAD 0.01
IQR 0.02
CV 0.70
Skewness 3.74
SE.Skewness 0.05
Kurtosis 26.00
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "maper",
    jitter = FALSE
  )
Figure 92: Histogram of the maper variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 62: Statistics for the mpepr variable.
  mpepr
Mean 0.03
Std.Dev 0.02
Min 0.00
Q1 0.02
Median 0.03
Q3 0.04
Max 0.58
MAD 0.01
IQR 0.02
CV 0.54
Skewness 9.89
SE.Skewness 0.05
Kurtosis 256.68
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "mpepr",
    jitter = FALSE
  )
Figure 93: Histogram of the mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = maper_mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 63: Statistics for the maper_mpepr variable.
  maper_mpepr
Mean 0.06
Std.Dev 0.03
Min 0.00
Q1 0.04
Median 0.06
Q3 0.08
Max 0.59
MAD 0.02
IQR 0.03
CV 0.53
Skewness 3.61
SE.Skewness 0.05
Kurtosis 33.01
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "maper_mpepr",
    jitter = FALSE
  )
Figure 94: Histogram of the maper_mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = gini_index,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 64: Statistics for the gini_index variable.
  gini_index
Mean 0.60
Std.Dev 0.06
Min 0.45
Q1 0.56
Median 0.59
Q3 0.63
Max 0.81
MAD 0.05
IQR 0.07
CV 0.10
Skewness 0.79
SE.Skewness 0.05
Kurtosis 1.03
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "gini_index",
    jitter = FALSE
  )
Figure 95: Histogram of the gini_index variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = gdp_per_capita,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 65: Statistics for the gdp_per_capita variable.
  gdp_per_capita
Mean 11283.13
Std.Dev 14661.64
Min 1755.69
Q1 6088.96
Median 8357.51
Q3 12467.00
Max 291965.37
MAD 4242.41
IQR 6375.31
CV 1.30
Skewness 11.12
SE.Skewness 0.05
Kurtosis 172.80
N.Valid 2538.00
Pct.Valid 91.62

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "gdp_per_capita",
    jitter = FALSE
  )
Figure 96: Histogram of the gdp_per_capita variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = spei_12m,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 66: Statistics for the spei_12m variable.
  spei_12m
Mean -0.24
Std.Dev 0.37
Min -1.75
Q1 -0.45
Median -0.21
Q3 0.02
Max 0.69
MAD 0.34
IQR 0.47
CV -1.54
Skewness -0.51
SE.Skewness 0.05
Kurtosis 0.28
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "spei_12m",
    jitter = FALSE
  )
Figure 97: Histogram of the spei_12m variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Checking Correlations

Code
data |>
  plot_ggally(
    cols = c(
      "year", "misf", "sisvan_cover", "gini_index", "gdp_per_capita", "spei_12m"
    ),
    mapping = ggplot2::aes(colour = misf)
  )
Figure 98: Correlation matrix of the secondary variables colored by the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) clusters.

Source: Created by the authors.

Code
data |>
  plot_ggally(
    cols = c(
      "year", "misf", "mbepr", "beipr", "mbepr_beipr", 
      "gini_index", "gdp_per_capita", "spei_12m"
    ),
    mapping = ggplot2::aes(colour = misf)
  )
Figure 99: Correlation matrix of the stature variables colored by the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) clusters.

Source: Created by the authors.

Code
data |>
  plot_ggally(
    cols = c(
      "year", "misf", "maper",  "mpepr", "maper_mpepr", 
      "gini_index", "gdp_per_capita", "spei_12m"
    ),
    mapping = ggplot2::aes(colour = misf)
  )
Figure 100: Correlation matrix of the thinness variables colored by the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) clusters.

Source: Created by the authors.

Modeling the Data

Please note that in some graphics, the x-axis is inverted to improve data comprehension.

By s(spei_12m) + te(gini_index, gdp_per_capita) + s(year) (Continuous year)

Code
mbepr_gam_1 <- mgcv::gam(
  mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_1 |> summary()
#> 
#> Family: Beta regression(22.957) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.887747862  0.003192277 -904.6045 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    8.065935  8.775443   114.6455 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.616536 19.579690 12499.1053 < 2.22e-16 ***
#> s(year)                        8.800541  8.987666   795.5383 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0639   Deviance explained = 21.5%
#> -REML = -1.1514e+05  Scale est. = 1         n = 57487
Code
mbepr_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 67: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_1 model.
Value Interpretation Rule
R2 0.0638533070 weak cohen1988
SE 0.0018883054 NA NA
Lower CI 0.0601522965 weak cohen1988
Upper CI 0.0675543176 weak cohen1988

Source: Created by the authors.

Code
mbepr_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 68: Summary statistics of the mbepr_gam_1 model.
Value
df 36.483012351
logLik 115243.054119036
AIC -230407.422639320
BIC -230054.938141579
deviance 58942.639710968
df.residual 57450.516987649
nobs 57487.000000000
adj.r.squared 0.063853307
npar 43.000000000

Source: Created by the authors.

Code
mbepr_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 69: Value of the coefficients in the mbepr_gam_1 model.
Value
[Mean] 0.0514372287
mean((Intercept)) -2.8877478616
mean(s(spei_12m)) -0.0273768035
mean(te(gini_index,gdp_per_capita)) 0.1785181236
mean(s(year)) 0.1179449956
s(spei_12m).1 -0.1220646127
s(spei_12m).2 0.1013099734
s(spei_12m).3 -0.0065847179
s(spei_12m).4 -0.0885312162
s(spei_12m).5 -0.0581912203
s(spei_12m).6 -0.0806402923
s(spei_12m).7 0.1057150603
s(spei_12m).8 -0.2442711815
s(spei_12m).9 0.1468669760
te(gini_index,gdp_per_capita).1 -1.6244911899
te(gini_index,gdp_per_capita).2 -1.5847321301
te(gini_index,gdp_per_capita).3 -1.7494039820
te(gini_index,gdp_per_capita).4 -6.4660633495
te(gini_index,gdp_per_capita).5 0.5195019300
te(gini_index,gdp_per_capita).6 -0.5313888507
te(gini_index,gdp_per_capita).7 0.2441984168
te(gini_index,gdp_per_capita).8 -1.2615638272
te(gini_index,gdp_per_capita).9 -1.4187424175
te(gini_index,gdp_per_capita).10 0.9062595744
te(gini_index,gdp_per_capita).11 -0.2800883858
te(gini_index,gdp_per_capita).12 0.3837968500
te(gini_index,gdp_per_capita).13 -0.6596128025
te(gini_index,gdp_per_capita).14 0.5587018868
te(gini_index,gdp_per_capita).15 1.2073993878
te(gini_index,gdp_per_capita).16 -0.2427876021
te(gini_index,gdp_per_capita).17 0.4055660936
te(gini_index,gdp_per_capita).18 -0.4269965282
te(gini_index,gdp_per_capita).19 2.6472656705
te(gini_index,gdp_per_capita).20 1.0666189452
te(gini_index,gdp_per_capita).21 0.9452035344
te(gini_index,gdp_per_capita).22 0.5197094667
te(gini_index,gdp_per_capita).23 0.0429825668
te(gini_index,gdp_per_capita).24 11.0831017085
s(year).1 -0.0711228534
s(year).2 0.4596505420
s(year).3 0.2820389987
s(year).4 -0.4754027982
s(year).5 -0.0371145136
s(year).6 -0.0675775360
s(year).7 -0.1670595036
s(year).8 0.8080950099
s(year).9 0.3299976146

Source: Created by the authors.

Code
plot <- mbepr_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)
#> Registered S3 method overwritten by 'mgcViz':
#>   method from  
#>   +.gg   GGally

for(i in plot$plots) print(i)
Figure 101: Effects of each term in the mbepr_gam_1 model.

Source: Created by the authors.

Code
mbepr_gam_1 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 70: Concurvity measures of the mbepr_gam_1 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita) s(year)
worst 0 0.4770190857 0.2677465897 0.5397261306
observed 0 0.3569024814 0.1157635580 0.2424992666
estimate 0 0.3531843424 0.0059174314 0.3881346845

Source: Created by the authors.

Code
mbepr_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [0.0001829743545,0.03172224348]
#> (score -115137.8011 & scale 1).
#> Hessian positive definite, eigenvalue range [1.649447049,24839.07777].
#> Model rank =  43 / 43 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  8.07    0.98    0.27    
#> te(gini_index,gdp_per_capita) 24.00 18.62    0.92  <2e-16 ***
#> s(year)                        9.00  8.80    0.95  <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 102: Diagnostics for the mbepr_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 103: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_1 <- mgcv::gam(
  beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_1 |> summary()
#> 
#> Family: Beta regression(34.215) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.699942058  0.002646283 -1020.277 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df      Chi.sq    p-value    
#> s(spei_12m)                    8.113772  8.795871    67.86174 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 19.048743 19.926989 15022.83051 < 2.22e-16 ***
#> s(year)                        8.278716  8.853832  1034.80207 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =   0.15   Deviance explained = 23.6%
#> -REML = -1.1148e+05  Scale est. = 1         n = 57487
Code
beipr_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 71: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_1 model.
Value Interpretation Rule
R2 0.1497282092 moderate cohen1988
SE 0.0026263114 NA NA
Lower CI 0.1445807335 moderate cohen1988
Upper CI 0.1548756849 moderate cohen1988

Source: Created by the authors.

Code
beipr_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 72: Summary statistics of the beipr_gam_1 model.
Value
df 36.4412309248
logLik 111581.1536547750
AIC -223084.3900556297
BIC -222735.3474792330
deviance 58669.3274756479
df.residual 57450.5587690752
nobs 57487.0000000000
adj.r.squared 0.1497282092
npar 43.0000000000

Source: Created by the authors.

Code
beipr_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 73: Value of the coefficients in the beipr_gam_1 model.
Value
[Mean] -0.0419216773
mean((Intercept)) -2.6999420578
mean(s(spei_12m)) -0.0766752454
mean(te(gini_index,gdp_per_capita)) 0.0336251784
mean(s(year)) 0.0867092067
s(spei_12m).1 -0.1101197021
s(spei_12m).2 0.2344515176
s(spei_12m).3 -0.0768654857
s(spei_12m).4 -0.2017190980
s(spei_12m).5 -0.1265585495
s(spei_12m).6 -0.1301956497
s(spei_12m).7 0.0676235130
s(spei_12m).8 -0.5264730009
s(spei_12m).9 0.1797792471
te(gini_index,gdp_per_capita).1 -1.3503750007
te(gini_index,gdp_per_capita).2 -1.4491374357
te(gini_index,gdp_per_capita).3 -1.6295942969
te(gini_index,gdp_per_capita).4 3.2875534527
te(gini_index,gdp_per_capita).5 0.5031809115
te(gini_index,gdp_per_capita).6 -0.2959885521
te(gini_index,gdp_per_capita).7 -0.0265823918
te(gini_index,gdp_per_capita).8 -0.7470705761
te(gini_index,gdp_per_capita).9 1.0409557550
te(gini_index,gdp_per_capita).10 0.7843553477
te(gini_index,gdp_per_capita).11 -0.0939137738
te(gini_index,gdp_per_capita).12 0.1637072489
te(gini_index,gdp_per_capita).13 -0.3325629781
te(gini_index,gdp_per_capita).14 0.2348252955
te(gini_index,gdp_per_capita).15 1.1091742536
te(gini_index,gdp_per_capita).16 0.0230070166
te(gini_index,gdp_per_capita).17 0.2583346612
te(gini_index,gdp_per_capita).18 -0.1446366421
te(gini_index,gdp_per_capita).19 -0.4934752137
te(gini_index,gdp_per_capita).20 0.8041976369
te(gini_index,gdp_per_capita).21 1.1463708150
te(gini_index,gdp_per_capita).22 0.7540424907
te(gini_index,gdp_per_capita).23 0.4418518020
te(gini_index,gdp_per_capita).24 -3.1812155452
s(year).1 0.0259625945
s(year).2 0.3763706703
s(year).3 0.2034343857
s(year).4 -0.3631617364
s(year).5 0.0120994116
s(year).6 -0.1580923751
s(year).7 -0.1004425064
s(year).8 0.6375605153
s(year).9 0.1466519006

Source: Created by the authors.

Code
plot <- beipr_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 104: Effects of each term in the beipr_gam_1 model.

Source: Created by the authors.

Code
beipr_gam_1 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 74: Concurvity measures of the beipr_gam_1 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita) s(year)
worst 0 0.4770190857 0.2677465897 0.5397261306
observed 0 0.0245495092 0.1055510497 0.3636696980
estimate 0 0.3531843424 0.0059174314 0.3881346845

Source: Created by the authors.

Code
beipr_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.0001727823052,0.05747242912]
#> (score -111476.2592 & scale 1).
#> Hessian positive definite, eigenvalue range [2.144566396,26992.30096].
#> Model rank =  43 / 43 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  8.11    1.00    0.74    
#> te(gini_index,gdp_per_capita) 24.00 19.05    0.91  <2e-16 ***
#> s(year)                        9.00  8.28    1.00    0.73    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 105: Diagnostics for the beipr_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 106: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_1 <- mgcv::gam(
  mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_1 |> summary()
#> 
#> Family: Beta regression(21.15) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.008487621  0.002582764 -777.6504 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df      Chi.sq     p-value
#> s(spei_12m)                    7.128848  8.202065    34.50121 0.000032104
#> te(gini_index,gdp_per_capita) 19.170675 19.998225 13833.01156  < 2.22e-16
#> s(year)                        8.629334  8.958357   543.76224  < 2.22e-16
#>                                  
#> s(spei_12m)                   ***
#> te(gini_index,gdp_per_capita) ***
#> s(year)                       ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.163   Deviance explained =   22%
#> -REML = -79097  Scale est. = 1         n = 57487
Code
mbepr_beipr_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 75: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_1 model.
Value Interpretation Rule
R2 0.1626124024 moderate cohen1988
SE 0.0026955040 NA NA
Lower CI 0.1573293116 moderate cohen1988
Upper CI 0.1678954933 moderate cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 76: Summary statistics of the mbepr_beipr_gam_1 model.
Value
df 35.9288574119
logLik 79202.1605827943
AIC -158326.1775691864
BIC -157976.1210560932
deviance 56958.1590159663
df.residual 57451.0711425881
nobs 57487.0000000000
adj.r.squared 0.1626124024
npar 43.0000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 77: Value of the coefficients in the mbepr_beipr_gam_1 model.
Value
[Mean] -0.0183624107
mean((Intercept)) -2.0084876210
mean(s(spei_12m)) -0.0322160284
mean(te(gini_index,gdp_per_capita)) 0.0300636509
mean(s(year)) 0.0874800663
s(spei_12m).1 -0.0589245986
s(spei_12m).2 0.1052533834
s(spei_12m).3 -0.0263073702
s(spei_12m).4 -0.0963728003
s(spei_12m).5 -0.0505908021
s(spei_12m).6 -0.0465566451
s(spei_12m).7 0.0434844563
s(spei_12m).8 -0.2399507558
s(spei_12m).9 0.0800208769
te(gini_index,gdp_per_capita).1 -1.2750487424
te(gini_index,gdp_per_capita).2 -1.3318567140
te(gini_index,gdp_per_capita).3 -1.5263092999
te(gini_index,gdp_per_capita).4 1.3266500466
te(gini_index,gdp_per_capita).5 0.4182047314
te(gini_index,gdp_per_capita).6 -0.3131240773
te(gini_index,gdp_per_capita).7 0.0834097668
te(gini_index,gdp_per_capita).8 -0.7902618839
te(gini_index,gdp_per_capita).9 0.3809854248
te(gini_index,gdp_per_capita).10 0.7129132967
te(gini_index,gdp_per_capita).11 -0.1627929837
te(gini_index,gdp_per_capita).12 0.1769882473
te(gini_index,gdp_per_capita).13 -0.4267131690
te(gini_index,gdp_per_capita).14 0.0890376270
te(gini_index,gdp_per_capita).15 1.1012828359
te(gini_index,gdp_per_capita).16 -0.0534125655
te(gini_index,gdp_per_capita).17 0.2578741727
te(gini_index,gdp_per_capita).18 -0.2290292287
te(gini_index,gdp_per_capita).19 -0.0938482379
te(gini_index,gdp_per_capita).20 0.8401002858
te(gini_index,gdp_per_capita).21 1.1420312399
te(gini_index,gdp_per_capita).22 0.6997343008
te(gini_index,gdp_per_capita).23 0.3062913378
te(gini_index,gdp_per_capita).24 -0.6115787895
s(year).1 -0.0394585320
s(year).2 0.3546575568
s(year).3 0.2276277581
s(year).4 -0.3856775655
s(year).5 -0.0140028171
s(year).6 -0.0967606679
s(year).7 -0.1083146350
s(year).8 0.6176753704
s(year).9 0.2315741284

Source: Created by the authors.

Code
plot <- mbepr_beipr_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 107: Effects of each term in the mbepr_beipr_gam_1 model.

Source: Created by the authors.

Code
mbepr_beipr_gam_1 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 78: Concurvity measures of the mbepr_beipr_gam_1 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita) s(year)
worst 0 0.4770190857 0.2677465897 0.5397261306
observed 0 0.1587646960 0.1143136157 0.2472117173
estimate 0 0.3531843424 0.0059174314 0.3881346845

Source: Created by the authors.

Code
mbepr_beipr_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [-0.004141121489,0.04358172276]
#> (score -79097.09397 & scale 1).
#> Hessian positive definite, eigenvalue range [1.464378814,28213.38369].
#> Model rank =  43 / 43 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  7.13    1.00    0.67    
#> te(gini_index,gdp_per_capita) 24.00 19.17    0.93  <2e-16 ***
#> s(year)                        9.00  8.63    1.01    0.79    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 108: Diagnostics for the mbepr_beipr_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 109: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_1 <- mgcv::gam(
  maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_1 |> summary()
#> 
#> Family: Beta regression(32.913) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.76693840  0.00352565 -1068.438 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    8.544258  8.942949   430.0758 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.412919 19.309860 12636.7205 < 2.22e-16 ***
#> s(year)                        8.866347  8.994460   845.3981 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0244   Deviance explained = 23.1%
#> -REML = -1.6814e+05  Scale est. = 1         n = 57487
Code
maper_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 79: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_1 model.
Value Interpretation Rule
R2 0.0243704151 weak cohen1988
SE 0.0012157746 NA NA
Lower CI 0.0219875407 weak cohen1988
Upper CI 0.0267532895 weak cohen1988

Source: Created by the authors.

Code
maper_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 80: Summary statistics of the maper_gam_1 model.
Value
df 36.8235234757
logLik 168252.9266265731
AIC -336427.3587149690
BIC -336075.7301030770
deviance 60454.6637911227
df.residual 57450.1764765243
nobs 57487.0000000000
adj.r.squared 0.0243704151
npar 43.0000000000

Source: Created by the authors.

Code
maper_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 81: Value of the coefficients in the maper_gam_1 model.
Value
[Mean] 0.1399982388
mean((Intercept)) -3.7669383968
mean(s(spei_12m)) -0.0601972808
mean(te(gini_index,gdp_per_capita)) 0.3926704700
mean(s(year)) 0.1005052127
s(spei_12m).1 -0.3067501527
s(spei_12m).2 0.2017207337
s(spei_12m).3 -0.0631267373
s(spei_12m).4 -0.1910189481
s(spei_12m).5 -0.1636658702
s(spei_12m).6 -0.1590892614
s(spei_12m).7 0.1717193978
s(spei_12m).8 -0.4263065278
s(spei_12m).9 0.3947418387
te(gini_index,gdp_per_capita).1 -1.4911773920
te(gini_index,gdp_per_capita).2 -1.3581436039
te(gini_index,gdp_per_capita).3 -1.4774423615
te(gini_index,gdp_per_capita).4 -12.1110017638
te(gini_index,gdp_per_capita).5 0.9152930441
te(gini_index,gdp_per_capita).6 -0.4235406721
te(gini_index,gdp_per_capita).7 0.1083243566
te(gini_index,gdp_per_capita).8 -1.2994548934
te(gini_index,gdp_per_capita).9 -2.5439000014
te(gini_index,gdp_per_capita).10 0.9575885827
te(gini_index,gdp_per_capita).11 -0.1370103528
te(gini_index,gdp_per_capita).12 0.3635238582
te(gini_index,gdp_per_capita).13 -0.6408604575
te(gini_index,gdp_per_capita).14 1.1413856567
te(gini_index,gdp_per_capita).15 1.1394645722
te(gini_index,gdp_per_capita).16 -0.0902727280
te(gini_index,gdp_per_capita).17 0.4330091727
te(gini_index,gdp_per_capita).18 -0.3696529479
te(gini_index,gdp_per_capita).19 5.0200190826
te(gini_index,gdp_per_capita).20 0.5537786978
te(gini_index,gdp_per_capita).21 0.2545324002
te(gini_index,gdp_per_capita).22 0.0430225554
te(gini_index,gdp_per_capita).23 -0.3344280316
te(gini_index,gdp_per_capita).24 20.7710345058
s(year).1 0.0085826753
s(year).2 0.2971150578
s(year).3 0.1988664847
s(year).4 -0.3217694793
s(year).5 -0.0497613524
s(year).6 0.1259948722
s(year).7 -0.1345460408
s(year).8 0.5203674542
s(year).9 0.2596972424

Source: Created by the authors.

Code
plot <- maper_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 110: Effects of each term in the maper_gam_1 model.

Source: Created by the authors.

Code
maper_gam_1 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 82: Concurvity measures of the maper_gam_1 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita) s(year)
worst 0 0.4770190857 0.2677465897 0.5397261306
observed 0 0.4173857515 0.1308487412 0.1741781643
estimate 0 0.3531843424 0.0059174314 0.3881346845

Source: Created by the authors.

Code
maper_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.002566588594,0.05796573118]
#> (score -168143.8485 & scale 1).
#> Hessian positive definite, eigenvalue range [1.947920257,20956.10516].
#> Model rank =  43 / 43 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  8.54    0.99    0.37    
#> te(gini_index,gdp_per_capita) 24.00 18.41    0.94  <2e-16 ***
#> s(year)                        9.00  8.87    0.99    0.35    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 111: Diagnostics for the maper_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 112: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_1 <- mgcv::gam(
  mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_1 |> summary()
#> 
#> Family: Beta regression(41.368) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.610157798  0.003226851 -1118.787 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    8.446656  8.916742   541.3227 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.893390 19.658659 12964.8648 < 2.22e-16 ***
#> s(year)                        8.707845  8.974484   889.9991 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0101   Deviance explained = 24.1%
#> -REML = -1.5533e+05  Scale est. = 1         n = 57487
Code
mpepr_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 83: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_1 model.
Value Interpretation Rule
R2 0.0101356080 very weak (negligible) cohen1988
SE 0.0007954946 NA NA
Lower CI 0.0085764673 very weak (negligible) cohen1988
Upper CI 0.0116947488 very weak (negligible) cohen1988

Source: Created by the authors.

Code
mpepr_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 84: Summary statistics of the mpepr_gam_1 model.
Value
df 37.047890892
logLik 155444.711991594
AIC -310810.324213421
BIC -310455.984371563
deviance 61153.661249646
df.residual 57449.952109108
nobs 57487.000000000
adj.r.squared 0.010135608
npar 43.000000000

Source: Created by the authors.

Code
mpepr_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 85: Value of the coefficients in the mpepr_gam_1 model.
Value
[Mean] 0.1025877006
mean((Intercept)) -3.6101577983
mean(s(spei_12m)) -0.0402416288
mean(te(gini_index,gdp_per_capita)) 0.3008621581
mean(s(year)) 0.1292124209
s(spei_12m).1 -0.2450314665
s(spei_12m).2 0.1157573046
s(spei_12m).3 -0.0398815952
s(spei_12m).4 -0.1392586046
s(spei_12m).5 -0.1361690502
s(spei_12m).6 -0.0996227971
s(spei_12m).7 0.1232645829
s(spei_12m).8 -0.2444884771
s(spei_12m).9 0.3032554441
te(gini_index,gdp_per_capita).1 -2.0873850377
te(gini_index,gdp_per_capita).2 -1.6255625578
te(gini_index,gdp_per_capita).3 -1.6750306585
te(gini_index,gdp_per_capita).4 -9.1258398420
te(gini_index,gdp_per_capita).5 0.9691872796
te(gini_index,gdp_per_capita).6 -0.6722444860
te(gini_index,gdp_per_capita).7 0.4922946806
te(gini_index,gdp_per_capita).8 -1.8142795252
te(gini_index,gdp_per_capita).9 -1.6904935670
te(gini_index,gdp_per_capita).10 1.0326136121
te(gini_index,gdp_per_capita).11 -0.4600900907
te(gini_index,gdp_per_capita).12 0.6349975163
te(gini_index,gdp_per_capita).13 -0.9566096774
te(gini_index,gdp_per_capita).14 1.1854039464
te(gini_index,gdp_per_capita).15 1.0830260323
te(gini_index,gdp_per_capita).16 -0.5105269839
te(gini_index,gdp_per_capita).17 0.5704829496
te(gini_index,gdp_per_capita).18 -0.7049306699
te(gini_index,gdp_per_capita).19 4.3564573432
te(gini_index,gdp_per_capita).20 0.2690026542
te(gini_index,gdp_per_capita).21 0.1254471370
te(gini_index,gdp_per_capita).22 0.1787205634
te(gini_index,gdp_per_capita).23 -0.0374899153
te(gini_index,gdp_per_capita).24 17.6835410906
s(year).1 0.0345025014
s(year).2 0.5998032963
s(year).3 0.1690266623
s(year).4 -0.3643933415
s(year).5 -0.0081681610
s(year).6 -0.0670963000
s(year).7 -0.1374538828
s(year).8 0.8026003891
s(year).9 0.1340906240

Source: Created by the authors.

Code
plot <- mpepr_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 113: Effects of each term in the mpepr_gam_1 model.

Source: Created by the authors.

Code
mpepr_gam_1 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 86: Concurvity measures of the mpepr_gam_1 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita) s(year)
worst 0 0.4770190857 0.2677465897 0.5397261306
observed 0 0.4273963435 0.1270217750 0.3024317474
estimate 0 0.3531843424 0.0059174314 0.3881346845

Source: Created by the authors.

Code
mpepr_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 7 iterations.
#> Gradient range [-0.0000009178845293,0.0003205040664]
#> (score -155334.1792 & scale 1).
#> Hessian positive definite, eigenvalue range [2.255307833,23470.11315].
#> Model rank =  43 / 43 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  8.45    1.00    0.63    
#> te(gini_index,gdp_per_capita) 24.00 18.89    0.95  <2e-16 ***
#> s(year)                        9.00  8.71    0.99    0.56    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 114: Diagnostics for the mpepr_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 115: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_1 <- mgcv::gam(
  maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_1 |> summary()
#> 
#> Family: Beta regression(27.286) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.947655546  0.003075965 -958.2864 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    8.538532  8.941460   524.1370 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.824892 19.596732 12360.7378 < 2.22e-16 ***
#> s(year)                        8.805392  8.988451   658.9538 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.059   Deviance explained = 23.5%
#> -REML = -1.1924e+05  Scale est. = 1         n = 57487
Code
maper_mpepr_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 87: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_1 model.
Value Interpretation Rule
R2 0.0589991868 weak cohen1988
SE 0.0018245243 NA NA
Lower CI 0.0554231850 weak cohen1988
Upper CI 0.0625751886 weak cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 88: Summary statistics of the maper_mpepr_gam_1 model.
Value
df 37.1688160684
logLik 119354.6893883109
AIC -238630.4492413757
BIC -238276.8719917944
deviance 59348.9925349746
df.residual 57449.8311839316
nobs 57487.0000000000
adj.r.squared 0.0589991868
npar 43.0000000000

Source: Created by the authors.

Code
maper_mpepr_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 89: Value of the coefficients in the maper_mpepr_gam_1 model.
Value
[Mean] 0.1237718546
mean((Intercept)) -2.9476555461
mean(s(spei_12m)) -0.0078315191
mean(te(gini_index,gdp_per_capita)) 0.3081065337
mean(s(year)) 0.1050857951
s(spei_12m).1 -0.2267013030
s(spei_12m).2 0.0301554948
s(spei_12m).3 -0.0136014004
s(spei_12m).4 -0.0845160671
s(spei_12m).5 -0.0902434852
s(spei_12m).6 -0.0498487762
s(spei_12m).7 0.1336120799
s(spei_12m).8 -0.0625674280
s(spei_12m).9 0.2932272138
te(gini_index,gdp_per_capita).1 -1.8281372697
te(gini_index,gdp_per_capita).2 -1.5880975076
te(gini_index,gdp_per_capita).3 -1.6883134236
te(gini_index,gdp_per_capita).4 -9.0474875346
te(gini_index,gdp_per_capita).5 0.9825896689
te(gini_index,gdp_per_capita).6 -0.4621766458
te(gini_index,gdp_per_capita).7 0.3170887390
te(gini_index,gdp_per_capita).8 -1.4169577414
te(gini_index,gdp_per_capita).9 -1.7626813837
te(gini_index,gdp_per_capita).10 0.8992559568
te(gini_index,gdp_per_capita).11 -0.2844813519
te(gini_index,gdp_per_capita).12 0.4712581740
te(gini_index,gdp_per_capita).13 -0.7349169524
te(gini_index,gdp_per_capita).14 1.0438577036
te(gini_index,gdp_per_capita).15 1.0080022914
te(gini_index,gdp_per_capita).16 -0.3026318396
te(gini_index,gdp_per_capita).17 0.4467196191
te(gini_index,gdp_per_capita).18 -0.5201093472
te(gini_index,gdp_per_capita).19 4.1528809123
te(gini_index,gdp_per_capita).20 0.2132728208
te(gini_index,gdp_per_capita).21 0.1387251800
te(gini_index,gdp_per_capita).22 0.1892600911
te(gini_index,gdp_per_capita).23 -0.0519539879
te(gini_index,gdp_per_capita).24 17.2195906370
s(year).1 -0.0007499275
s(year).2 0.4069062514
s(year).3 0.1525022364
s(year).4 -0.2910279875
s(year).5 -0.0598670057
s(year).6 0.0471691910
s(year).7 -0.0943570966
s(year).8 0.5568415437
s(year).9 0.2283549511

Source: Created by the authors.

Code
plot <- maper_mpepr_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 116: Effects of each term in the maper_mpepr_gam_1 model.

Source: Created by the authors.

Code
maper_mpepr_gam_1 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 90: Concurvity measures of the maper_mpepr_gam_1 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita) s(year)
worst 0 0.4770190857 0.2677465897 0.5397261306
observed 0 0.4193743273 0.1314817650 0.1822758508
estimate 0 0.3531843424 0.0059174314 0.3881346845

Source: Created by the authors.

Code
maper_mpepr_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.00001277267179,0.0003409827549]
#> (score -119241.8122 & scale 1).
#> Hessian positive definite, eigenvalue range [2.102539349,25227.75575].
#> Model rank =  43 / 43 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  8.54     1.0    0.81    
#> te(gini_index,gdp_per_capita) 24.00 18.82     0.9  <2e-16 ***
#> s(year)                        9.00  8.81     1.0    0.67    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 117: Diagnostics for the maper_mpepr_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 118: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year) (Ordered year)

Code
mbepr_gam_2 <- mgcv::gam(
  mbepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_2 |> summary()
#> 
#> Family: Beta regression(22.871) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.886877872  0.003194629 -903.6661 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       7.654071 8.558458   73.4249 < 2.22e-16 ***
#> s(gini_index)     7.262359 8.275341 5236.4183 < 2.22e-16 ***
#> s(gdp_per_capita) 8.918150 8.997777 3264.4827 < 2.22e-16 ***
#> s(year)           8.776038 8.984419  754.2061 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0598   Deviance explained = 21.2%
#> -REML = -1.1503e+05  Scale est. = 1         n = 57487
Code
mbepr_gam_2 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 91: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_2 model.
Value Interpretation Rule
R2 0.0597899173 weak cohen1988
SE 0.0018351667 NA NA
Lower CI 0.0561930567 weak cohen1988
Upper CI 0.0633867778 weak cohen1988

Source: Created by the authors.

Code
mbepr_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 92: Summary statistics of the mbepr_gam_2 model.
Value
df 33.6106175536
logLik 115136.5073187729
AIC -230199.3826478547
BIC -229869.5365856044
deviance 58958.1522521916
df.residual 57453.3893824464
nobs 57487.0000000000
adj.r.squared 0.0597899173
npar 37.0000000000

Source: Created by the authors.

Code
mbepr_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 93: Value of the coefficients in the mbepr_gam_2 model.
Value
[Mean] -0.1878113552
mean((Intercept)) -2.8868778720
mean(s(spei_12m)) -0.0235382504
mean(s(gini_index)) 0.1178593530
mean(s(gdp_per_capita)) -0.6616448571
mean(s(year)) 0.1159746133
s(spei_12m).1 -0.0910235803
s(spei_12m).2 0.0750220527
s(spei_12m).3 -0.0029390783
s(spei_12m).4 -0.0712429570
s(spei_12m).5 -0.0463562579
s(spei_12m).6 -0.0650884215
s(spei_12m).7 0.0784453533
s(spei_12m).8 -0.1939721903
s(spei_12m).9 0.1053108259
s(gini_index).1 0.1430160763
s(gini_index).2 0.0352323322
s(gini_index).3 0.0009281176
s(gini_index).4 0.0246269547
s(gini_index).5 -0.0100945883
s(gini_index).6 0.0330929263
s(gini_index).7 0.0383559333
s(gini_index).8 0.4087814524
s(gini_index).9 0.3867949729
s(gdp_per_capita).1 -0.5224946350
s(gdp_per_capita).2 -2.4690224211
s(gdp_per_capita).3 0.7288028211
s(gdp_per_capita).4 -1.6969395709
s(gdp_per_capita).5 -0.4895814393
s(gdp_per_capita).6 1.3070491335
s(gdp_per_capita).7 -0.9303827139
s(gdp_per_capita).8 -1.1504527151
s(gdp_per_capita).9 -0.7317821735
s(year).1 -0.0742626346
s(year).2 0.4508749359
s(year).3 0.2790210339
s(year).4 -0.4613948114
s(year).5 -0.0443842844
s(year).6 -0.0726870300
s(year).7 -0.1580558239
s(year).8 0.7862427724
s(year).9 0.3384173618

Source: Created by the authors.

Code
plot <- mbepr_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 119: Effects of each term in the mbepr_gam_2 model.

Source: Created by the authors.

Code
mbepr_gam_2 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 94: Concurvity measures of the mbepr_gam_2 model terms.
para s(spei_12m) s(gini_index) s(gdp_per_capita) s(year)
worst 0 0.4795981952 0.1338449767 0.3021984737 0.5335847306
observed 0 0.3447635588 0.1188195675 0.2991492698 0.2171871720
estimate 0 0.3543037945 0.0820431280 0.0450015058 0.3766666217

Source: Created by the authors.

Code
mbepr_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 10 iterations.
#> Gradient range [-0.0001122142154,0.03812593805]
#> (score -115033.2762 & scale 1).
#> Hessian positive definite, eigenvalue range [0.9897071456,24819.19255].
#> Model rank =  37 / 37 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value    
#> s(spei_12m)       9.00 7.65    0.99    0.29    
#> s(gini_index)     9.00 7.26    0.91  <2e-16 ***
#> s(gdp_per_capita) 9.00 8.92    0.99    0.30    
#> s(year)           9.00 8.78    0.97    0.09 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 120: Diagnostics for the mbepr_gam_2 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 121: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_2 <- mgcv::gam(
  beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_2 |> summary()
#> 
#> Family: Beta regression(34.043) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.699160949  0.002650251 -1018.455 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df     Chi.sq    p-value    
#> s(spei_12m)       8.067400 8.775221   66.39775 < 2.22e-16 ***
#> s(gini_index)     7.884197 8.663655 7213.70815 < 2.22e-16 ***
#> s(gdp_per_capita) 8.940753 8.998828 3270.71401 < 2.22e-16 ***
#> s(year)           8.126668 8.790955  968.34735 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.144   Deviance explained = 23.2%
#> -REML = -1.1134e+05  Scale est. = 1         n = 57487
Code
beipr_gam_2 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 95: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_2 model.
Value Interpretation Rule
R2 0.1442664558 moderate cohen1988
SE 0.0025945250 NA NA
Lower CI 0.1391812802 moderate cohen1988
Upper CI 0.1493516314 moderate cohen1988

Source: Created by the authors.

Code
beipr_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 96: Summary statistics of the beipr_gam_2 model.
Value
df 34.0190178975
logLik 111439.3720057292
AIC -222806.4705874308
BIC -222482.7104334425
deviance 58675.7035309863
df.residual 57452.9809821025
nobs 57487.0000000000
adj.r.squared 0.1442664558
npar 37.0000000000

Source: Created by the authors.

Code
beipr_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 97: Value of the coefficients in the beipr_gam_2 model.
Value
[Mean] -0.1459764566
mean((Intercept)) -2.6991609489
mean(s(spei_12m)) -0.0743927158
mean(s(gini_index)) 0.2153975302
mean(s(gdp_per_capita)) -0.5229498714
mean(s(year)) 0.0817263963
s(spei_12m).1 -0.0934109606
s(spei_12m).2 0.2224120302
s(spei_12m).3 -0.0784623136
s(spei_12m).4 -0.1944905984
s(spei_12m).5 -0.1209934326
s(spei_12m).6 -0.1252626806
s(spei_12m).7 0.0581293207
s(spei_12m).8 -0.5037873645
s(spei_12m).9 0.1663315573
s(gini_index).1 0.1563282873
s(gini_index).2 0.1699005142
s(gini_index).3 0.0361794296
s(gini_index).4 0.0970133490
s(gini_index).5 -0.0298327072
s(gini_index).6 0.0676675534
s(gini_index).7 0.0671506484
s(gini_index).8 0.9348661802
s(gini_index).9 0.4393045169
s(gdp_per_capita).1 -0.4336733573
s(gdp_per_capita).2 -2.0426365396
s(gdp_per_capita).3 0.6051030727
s(gdp_per_capita).4 -1.3806219056
s(gdp_per_capita).5 -0.3760253972
s(gdp_per_capita).6 1.1591103473
s(gdp_per_capita).7 -0.8124783690
s(gdp_per_capita).8 -0.7659177743
s(gdp_per_capita).9 -0.6594089194
s(year).1 0.0276132146
s(year).2 0.3499075685
s(year).3 0.1945933164
s(year).4 -0.3341807235
s(year).5 0.0068522981
s(year).6 -0.1519008522
s(year).7 -0.0891540132
s(year).8 0.5856796882
s(year).9 0.1461270702

Source: Created by the authors.

Code
plot <- beipr_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 122: Effects of each term in the beipr_gam_2 model.

Source: Created by the authors.

Code
beipr_gam_2 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 98: Concurvity measures of the beipr_gam_2 model terms.
para s(spei_12m) s(gini_index) s(gdp_per_capita) s(year)
worst 0 0.4795981952 0.1338449767 0.3021984737 0.5335847306
observed 0 0.0876412335 0.1157994246 0.2974211431 0.3493602137
estimate 0 0.3543037945 0.0820431280 0.0450015058 0.3766666217

Source: Created by the authors.

Code
beipr_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 8 iterations.
#> Gradient range [-0.00000014619678,0.0002278562856]
#> (score -111335.4598 & scale 1).
#> Hessian positive definite, eigenvalue range [2.862768203,26982.22217].
#> Model rank =  37 / 37 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value    
#> s(spei_12m)       9.00 8.07    0.98    0.15    
#> s(gini_index)     9.00 7.88    0.95  <2e-16 ***
#> s(gdp_per_capita) 9.00 8.94    0.99    0.34    
#> s(year)           9.00 8.13    0.98    0.17    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 123: Diagnostics for the beipr_gam_2 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 124: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_2 <- mgcv::gam(
  mbepr_beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_2 |> summary()
#> 
#> Family: Beta regression(21.044) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error  z value   Pr(>|z|)    
#> (Intercept) -2.008033978  0.002587403 -776.081 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df     Chi.sq p-value    
#> s(spei_12m)       2.885253 3.667479    4.81063 0.26293    
#> s(gini_index)     8.217415 8.826071 6055.07871 < 2e-16 ***
#> s(gdp_per_capita) 8.945436 8.999001 3532.05147 < 2e-16 ***
#> s(year)           8.580066 8.944272  516.35600 < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.156   Deviance explained = 21.5%
#> -REML = -78952  Scale est. = 1         n = 57487
Code
mbepr_beipr_gam_2 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 99: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_2 model.
Value Interpretation Rule
R2 0.1560026170 moderate cohen1988
SE 0.0026609926 NA NA
Lower CI 0.1507871673 moderate cohen1988
Upper CI 0.1612180667 moderate cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 100: Summary statistics of the mbepr_beipr_gam_2 model.
Value
df 29.628170989
logLik 79047.552324784
AIC -158030.231001206
BIC -157739.619304498
deviance 56981.298315512
df.residual 57457.371829011
nobs 57487.000000000
adj.r.squared 0.156002617
npar 37.000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 101: Value of the coefficients in the mbepr_beipr_gam_2 model.
Value
[Mean] -0.1157075443
mean((Intercept)) -2.0080339781
mean(s(spei_12m)) -0.0053597294
mean(s(gini_index)) 0.2324477831
mean(s(gdp_per_capita)) -0.5654786304
mean(s(year)) 0.0858188921
s(spei_12m).1 -0.0055843968
s(spei_12m).2 0.0101879946
s(spei_12m).3 -0.0032512963
s(spei_12m).4 -0.0103622095
s(spei_12m).5 -0.0044713595
s(spei_12m).6 -0.0066398029
s(spei_12m).7 0.0036846151
s(spei_12m).8 -0.0360941295
s(spei_12m).9 0.0042930202
s(gini_index).1 0.2070684108
s(gini_index).2 0.2137252925
s(gini_index).3 -0.0106711307
s(gini_index).4 0.0962846554
s(gini_index).5 -0.0176159842
s(gini_index).6 0.0676724404
s(gini_index).7 0.0604266832
s(gini_index).8 0.9391139267
s(gini_index).9 0.5360257542
s(gdp_per_capita).1 -0.4694323558
s(gdp_per_capita).2 -2.1292999871
s(gdp_per_capita).3 0.6307579541
s(gdp_per_capita).4 -1.4719928255
s(gdp_per_capita).5 -0.4268125919
s(gdp_per_capita).6 1.2275232884
s(gdp_per_capita).7 -0.8710519816
s(gdp_per_capita).8 -0.9116285124
s(gdp_per_capita).9 -0.6673706623
s(year).1 -0.0393620534
s(year).2 0.3477673923
s(year).3 0.2211026244
s(year).4 -0.3693360511
s(year).5 -0.0200155894
s(year).6 -0.0969226100
s(year).7 -0.0996666675
s(year).8 0.5937080412
s(year).9 0.2350949424

Source: Created by the authors.

Code
plot <- mbepr_beipr_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 125: Effects of each term in the mbepr_beipr_gam_2 model.

Source: Created by the authors.

Code
mbepr_beipr_gam_2 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 102: Concurvity measures of the mbepr_beipr_gam_2 model terms.
para s(spei_12m) s(gini_index) s(gdp_per_capita) s(year)
worst 0 0.4795981952 0.1338449767 0.3021984737 0.5335847306
observed 0 0.1491822623 0.1131783674 0.2980759587 0.2298067718
estimate 0 0.3543037945 0.0820431280 0.0450015058 0.3766666217

Source: Created by the authors.

Code
mbepr_beipr_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 7 iterations.
#> Gradient range [-0.0000504917562,0.03294763489]
#> (score -78951.67367 & scale 1).
#> Hessian positive definite, eigenvalue range [0.1014636477,28204.51984].
#> Model rank =  37 / 37 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value    
#> s(spei_12m)       9.00 2.89    0.98    0.18    
#> s(gini_index)     9.00 8.22    0.92  <2e-16 ***
#> s(gdp_per_capita) 9.00 8.95    1.00    0.60    
#> s(year)           9.00 8.58    0.98    0.10    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 126: Diagnostics for the mbepr_beipr_gam_2 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 127: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_2 <- mgcv::gam(
  maper ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_2 |> summary()
#> 
#> Family: Beta regression(32.864) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error  z value   Pr(>|z|)    
#> (Intercept) -3.766420033  0.003526643 -1067.99 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.496389 8.930818  380.4258 < 2.22e-16 ***
#> s(gini_index)     7.558064 8.484290 4672.4302 < 2.22e-16 ***
#> s(gdp_per_capita) 8.890499 8.996056 3929.5614 < 2.22e-16 ***
#> s(year)           8.859707 8.993902  818.0049 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0238   Deviance explained =   23%
#> -REML = -1.6811e+05  Scale est. = 1         n = 57487
Code
maper_gam_2 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 103: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_2 model.
Value Interpretation Rule
R2 0.0238182494 weak cohen1988
SE 0.0012026029 NA NA
Lower CI 0.0214611911 weak cohen1988
Upper CI 0.0261753077 weak cohen1988

Source: Created by the authors.

Code
maper_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 104: Summary statistics of the maper_gam_2 model.
Value
df 34.8046584788
logLik 168220.4634580906
AIC -336366.1167851194
BIC -336030.9930535636
deviance 60448.5416249580
df.residual 57452.1953415212
nobs 57487.0000000000
adj.r.squared 0.0238182494
npar 37.0000000000

Source: Created by the authors.

Code
maper_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 105: Value of the coefficients in the maper_gam_2 model.
Value
[Mean] -0.2792066469
mean((Intercept)) -3.7664200327
mean(s(spei_12m)) -0.0583148111
mean(s(gini_index)) -0.0552216475
mean(s(gdp_per_capita)) -0.7113219453
mean(s(year)) 0.0954999704
s(spei_12m).1 -0.2920447301
s(spei_12m).2 0.1858729417
s(spei_12m).3 -0.0610740274
s(spei_12m).4 -0.1811751734
s(spei_12m).5 -0.1558061932
s(spei_12m).6 -0.1532399435
s(spei_12m).7 0.1593845859
s(spei_12m).8 -0.4022590954
s(spei_12m).9 0.3755083355
s(gini_index).1 0.0225090377
s(gini_index).2 -0.1739941119
s(gini_index).3 -0.0284549068
s(gini_index).4 -0.0859363912
s(gini_index).5 0.0431282479
s(gini_index).6 -0.0403513992
s(gini_index).7 -0.0270763015
s(gini_index).8 -0.4203896328
s(gini_index).9 0.2135706306
s(gdp_per_capita).1 -0.5239758997
s(gdp_per_capita).2 -2.7256248184
s(gdp_per_capita).3 0.8018341275
s(gdp_per_capita).4 -1.6741772173
s(gdp_per_capita).5 -0.5255630826
s(gdp_per_capita).6 1.2612683840
s(gdp_per_capita).7 -0.9313214639
s(gdp_per_capita).8 -1.3049731873
s(gdp_per_capita).9 -0.7793643500
s(year).1 0.0116421066
s(year).2 0.2754688432
s(year).3 0.1873813865
s(year).4 -0.3000070939
s(year).5 -0.0560918046
s(year).6 0.1301704984
s(year).7 -0.1251625149
s(year).8 0.4778893486
s(year).9 0.2582089640

Source: Created by the authors.

Code
plot <- maper_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 128: Effects of each term in the maper_gam_2 model.

Source: Created by the authors.

Code
maper_gam_2 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 106: Concurvity measures of the maper_gam_2 model terms.
para s(spei_12m) s(gini_index) s(gdp_per_capita) s(year)
worst 0 0.4795981952 0.1338449767 0.3021984737 0.5335847306
observed 0 0.4148757749 0.1237735881 0.2999117263 0.1514973748
estimate 0 0.3543037945 0.0820431280 0.0450015058 0.3766666217

Source: Created by the authors.

Code
maper_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.00000171804112,0.04355198049]
#> (score -168110.8461 & scale 1).
#> Hessian positive definite, eigenvalue range [2.759648793,20957.99243].
#> Model rank =  37 / 37 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value    
#> s(spei_12m)       9.00 8.50    1.02    0.95    
#> s(gini_index)     9.00 7.56    0.93  <2e-16 ***
#> s(gdp_per_capita) 9.00 8.89    1.00    0.70    
#> s(year)           9.00 8.86    1.00    0.61    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 129: Diagnostics for the maper_gam_2 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 130: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_2 <- mgcv::gam(
  mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_2 |> summary()
#> 
#> Family: Beta regression(41.252) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.609346062  0.003228947 -1117.809 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.360768 8.890223  480.4686 < 2.22e-16 ***
#> s(gini_index)     7.968288 8.717491 4849.9069 < 2.22e-16 ***
#> s(gdp_per_capita) 8.915541 8.997634 4110.1116 < 2.22e-16 ***
#> s(year)           8.676508 8.968871  845.3363 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00881   Deviance explained = 23.9%
#> -REML = -1.5527e+05  Scale est. = 1         n = 57487
Code
mpepr_gam_2 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 107: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_2 model.
Value Interpretation Rule
R2 0.0088055772 very weak (negligible) cohen1988
SE 0.0007424623 NA NA
Lower CI 0.0073503779 very weak (negligible) cohen1988
Upper CI 0.0102607765 very weak (negligible) cohen1988

Source: Created by the authors.

Code
mpepr_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 108: Summary statistics of the mpepr_gam_2 model.
Value
df 34.9211055217
logLik 155378.7508603413
AIC -310682.7526104076
BIC -310347.9022310497
deviance 61141.6359315324
df.residual 57452.0788944782
nobs 57487.0000000000
adj.r.squared 0.0088055772
npar 37.0000000000

Source: Created by the authors.

Code
mpepr_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 109: Value of the coefficients in the mpepr_gam_2 model.
Value
[Mean] -0.2480554696
mean((Intercept)) -3.6093460617
mean(s(spei_12m)) -0.0371263032
mean(s(gini_index)) -0.0265769504
mean(s(gdp_per_capita)) -0.6792928530
mean(s(year)) 0.1242509609
s(spei_12m).1 -0.2288168081
s(spei_12m).2 0.0957922517
s(spei_12m).3 -0.0383037299
s(spei_12m).4 -0.1261965375
s(spei_12m).5 -0.1260967320
s(spei_12m).6 -0.0905783867
s(spei_12m).7 0.1084219438
s(spei_12m).8 -0.2100245007
s(spei_12m).9 0.2816657709
s(gini_index).1 0.0001173073
s(gini_index).2 -0.1345476864
s(gini_index).3 0.0494170015
s(gini_index).4 -0.0738737062
s(gini_index).5 -0.0012891949
s(gini_index).6 -0.0186142338
s(gini_index).7 0.0016647121
s(gini_index).8 -0.1397406762
s(gini_index).9 0.0776739232
s(gdp_per_capita).1 -0.5200055884
s(gdp_per_capita).2 -2.5826590370
s(gdp_per_capita).3 0.7966292331
s(gdp_per_capita).4 -1.7413805171
s(gdp_per_capita).5 -0.5004182491
s(gdp_per_capita).6 1.3075676843
s(gdp_per_capita).7 -0.9182187679
s(gdp_per_capita).8 -1.1764985276
s(gdp_per_capita).9 -0.7786519076
s(year).1 0.0375201642
s(year).2 0.5839719284
s(year).3 0.1596817765
s(year).4 -0.3506644884
s(year).5 -0.0144878621
s(year).6 -0.0668886975
s(year).7 -0.1302572519
s(year).8 0.7700678829
s(year).9 0.1293151955

Source: Created by the authors.

Code
plot <- mpepr_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 131: Effects of each term in the mpepr_gam_2 model.

Source: Created by the authors.

Code
mpepr_gam_2 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 110: Concurvity measures of the mpepr_gam_2 model terms.
para s(spei_12m) s(gini_index) s(gdp_per_capita) s(year)
worst 0 0.4795981952 0.1338449767 0.3021984737 0.5335847306
observed 0 0.4275231049 0.1129232857 0.2988117419 0.2805478575
estimate 0 0.3543037945 0.0820431280 0.0450015058 0.3766666217

Source: Created by the authors.

Code
mpepr_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.00005952289556,0.0262368464]
#> (score -155270.4773 & scale 1).
#> Hessian positive definite, eigenvalue range [2.610108983,23473.63132].
#> Model rank =  37 / 37 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value    
#> s(spei_12m)       9.00 8.36    0.98    0.17    
#> s(gini_index)     9.00 7.97    0.94  <2e-16 ***
#> s(gdp_per_capita) 9.00 8.92    0.98    0.42    
#> s(year)           9.00 8.68    0.99    0.58    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 132: Diagnostics for the mpepr_gam_2 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 133: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_2 <- mgcv::gam(
  maper_mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_2 |> summary()
#> 
#> Family: Beta regression(27.223) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.947086170  0.003077737 -957.5498 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.453782 8.918970  456.7131 < 2.22e-16 ***
#> s(gini_index)     7.773780 8.610482 4451.1916 < 2.22e-16 ***
#> s(gdp_per_capita) 8.904233 8.996973 4179.0657 < 2.22e-16 ***
#> s(year)           8.792083 8.986834  619.3467 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0588   Deviance explained = 23.4%
#> -REML = -1.1919e+05  Scale est. = 1         n = 57487
Code
maper_mpepr_gam_2 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 111: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_2 model.
Value Interpretation Rule
R2 0.0588212718 weak cohen1988
SE 0.0018221156 NA NA
Lower CI 0.0552499907 weak cohen1988
Upper CI 0.0623925528 weak cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 112: Summary statistics of the maper_mpepr_gam_2 model.
Value
df 34.9238787778
logLik 119297.8581185657
AIC -238521.4212334060
BIC -238188.6050956577
deviance 59340.4133720964
df.residual 57452.0761212222
nobs 57487.0000000000
adj.r.squared 0.0588212718
npar 37.0000000000

Source: Created by the authors.

Code
maper_mpepr_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 113: Value of the coefficients in the maper_mpepr_gam_2 model.
Value
[Mean] -0.2047959854
mean((Intercept)) -2.9470861703
mean(s(spei_12m)) -0.0056348325
mean(s(gini_index)) 0.0176186174
mean(s(gdp_per_capita)) -0.6266456198
mean(s(year)) 0.1001768027
s(spei_12m).1 -0.2086972343
s(spei_12m).2 0.0120951159
s(spei_12m).3 -0.0115387171
s(spei_12m).4 -0.0718479832
s(spei_12m).5 -0.0801528804
s(spei_12m).6 -0.0425151884
s(spei_12m).7 0.1176090578
s(spei_12m).8 -0.0332366558
s(spei_12m).9 0.2675709933
s(gini_index).1 0.0906054927
s(gini_index).2 -0.0748981811
s(gini_index).3 0.0086193896
s(gini_index).4 -0.0560200412
s(gini_index).5 0.0149105583
s(gini_index).6 -0.0171307757
s(gini_index).7 0.0058957205
s(gini_index).8 -0.0405680360
s(gini_index).9 0.2271534294
s(gdp_per_capita).1 -0.4646201848
s(gdp_per_capita).2 -2.4058833427
s(gdp_per_capita).3 0.7151488815
s(gdp_per_capita).4 -1.5319735633
s(gdp_per_capita).5 -0.4687101039
s(gdp_per_capita).6 1.2140939531
s(gdp_per_capita).7 -0.8491763627
s(gdp_per_capita).8 -1.1344506633
s(gdp_per_capita).9 -0.7142391918
s(year).1 0.0034666403
s(year).2 0.3883516167
s(year).3 0.1426389583
s(year).4 -0.2742003967
s(year).5 -0.0663262825
s(year).6 0.0498968448
s(year).7 -0.0863577928
s(year).8 0.5190502091
s(year).9 0.2250714269

Source: Created by the authors.

Code
plot <- maper_mpepr_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 134: Effects of each term in the maper_mpepr_gam_2 model.

Source: Created by the authors.

Code
maper_mpepr_gam_2 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 114: Concurvity measures of the maper_mpepr_gam_2 model terms.
para s(spei_12m) s(gini_index) s(gdp_per_capita) s(year)
worst 0 0.4795981952 0.1338449767 0.3021984737 0.5335847306
observed 0 0.4189202181 0.1112120294 0.3010065848 0.1593561727
estimate 0 0.3543037945 0.0820431280 0.0450015058 0.3766666217

Source: Created by the authors.

Code
maper_mpepr_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [0.00000001880231615,0.000005275823804]
#> (score -119188.1318 & scale 1).
#> Hessian positive definite, eigenvalue range [2.554808805,25231.46456].
#> Model rank =  37 / 37 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value    
#> s(spei_12m)       9.00 8.45    0.99    0.45    
#> s(gini_index)     9.00 7.77    0.91  <2e-16 ***
#> s(gdp_per_capita) 9.00 8.90    1.01    0.84    
#> s(year)           9.00 8.79    0.98    0.12    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 135: Diagnostics for the maper_mpepr_gam_2 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 136: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(spei_12m) + te(gini_index, gdp_per_capita) + year (Unordered year)

In this model, the year variable is treated as a unordered categorical variable.

Code
mbepr_gam_3 <- mgcv::gam(
  mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_3 |> summary()
#> 
#> Family: Beta regression(22.961) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value             Pr(>|z|)    
#> (Intercept) -3.13966291  0.01239618 -253.27660           < 2.22e-16 ***
#> year2009     0.18186241  0.01547344   11.75320           < 2.22e-16 ***
#> year2011     0.21938154  0.01552398   14.13179           < 2.22e-16 ***
#> year2012     0.12762808  0.01705013    7.48546 0.000000000000071296 ***
#> year2013     0.30045886  0.01577996   19.04053           < 2.22e-16 ***
#> year2014     0.36370319  0.01614550   22.52660           < 2.22e-16 ***
#> year2015     0.27363335  0.01733247   15.78733           < 2.22e-16 ***
#> year2016     0.35679536  0.01785538   19.98252           < 2.22e-16 ***
#> year2017     0.32472514  0.01741557   18.64568           < 2.22e-16 ***
#> year2018     0.31285212  0.01735407   18.02760           < 2.22e-16 ***
#> year2019     0.29884733  0.01787337   16.72026           < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    8.057573  8.772137   110.2463 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.615306 19.579038 12492.7916 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0641   Deviance explained = 21.5%
#> -REML = -1.1513e+05  Scale est. = 1         n = 57487
Code
mbepr_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 115: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_3 model.
Value Interpretation Rule
R2 0.0640502195 weak cohen1988
SE 0.0018908170 NA NA
Lower CI 0.0603442864 weak cohen1988
Upper CI 0.0677561526 weak cohen1988

Source: Created by the authors.

Code
mbepr_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 116: Summary statistics of the mbepr_gam_3 model.
Value
df 37.6728787269
logLik 115245.8737829313
AIC -230411.0452153889
BIC -230049.5263615620
deviance 58947.2335067492
df.residual 57449.3271212731
nobs 57487.0000000000
adj.r.squared 0.0640502195
npar 44.0000000000

Source: Created by the authors.

Code
mbepr_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 117: Value of the coefficients in the mbepr_gam_3 model.
Value
[Mean] 0.0827001393
mean((Intercept)) -3.1396629096
year2009 0.1818624080
year2011 0.2193815395
year2012 0.1276280825
year2013 0.3004588585
year2014 0.3637031921
year2015 0.2736333497
year2016 0.3567953622
year2017 0.3247251449
year2018 0.3128521178
year2019 0.2988473266
mean(s(spei_12m)) -0.0277327029
mean(te(gini_index,gdp_per_capita)) 0.1778406660
s(spei_12m).1 -0.1245577622
s(spei_12m).2 0.1007030303
s(spei_12m).3 -0.0065618914
s(spei_12m).4 -0.0904930416
s(spei_12m).5 -0.0587159465
s(spei_12m).6 -0.0803111323
s(spei_12m).7 0.1049583770
s(spei_12m).8 -0.2442363400
s(spei_12m).9 0.1496203801
te(gini_index,gdp_per_capita).1 -1.6235389571
te(gini_index,gdp_per_capita).2 -1.5849611880
te(gini_index,gdp_per_capita).3 -1.7504688547
te(gini_index,gdp_per_capita).4 -6.4502269169
te(gini_index,gdp_per_capita).5 0.5189268931
te(gini_index,gdp_per_capita).6 -0.5309193349
te(gini_index,gdp_per_capita).7 0.2436565549
te(gini_index,gdp_per_capita).8 -1.2611862251
te(gini_index,gdp_per_capita).9 -1.4159681817
te(gini_index,gdp_per_capita).10 0.9065463916
te(gini_index,gdp_per_capita).11 -0.2795128678
te(gini_index,gdp_per_capita).12 0.3834144047
te(gini_index,gdp_per_capita).13 -0.6594141141
te(gini_index,gdp_per_capita).14 0.5565271611
te(gini_index,gdp_per_capita).15 1.2081220316
te(gini_index,gdp_per_capita).16 -0.2420158209
te(gini_index,gdp_per_capita).17 0.4055542199
te(gini_index,gdp_per_capita).18 -0.4264783740
te(gini_index,gdp_per_capita).19 2.6398495592
te(gini_index,gdp_per_capita).20 1.0676629014
te(gini_index,gdp_per_capita).21 0.9455273901
te(gini_index,gdp_per_capita).22 0.5197210405
te(gini_index,gdp_per_capita).23 0.0433864239
te(gini_index,gdp_per_capita).24 11.0539718470

Source: Created by the authors.

Code
plot <- mbepr_gam_3 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 137: Effects of each term in the mbepr_gam_3 model.

Source: Created by the authors.

Code
mbepr_gam_3 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 118: Concurvity measures of the mbepr_gam_3 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita)
worst 0.9313201642 0.4945646420 0.2683005283
observed 0.9313201642 0.3645397054 0.1174723892
estimate 0.9313201642 0.3683641849 0.0059940691

Source: Created by the authors.

Code
mbepr_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 10 iterations.
#> Gradient range [-0.000007959914122,0.00250617323]
#> (score -115134.7715 & scale 1).
#> Hessian positive definite, eigenvalue range [1.650377166,24840.47914].
#> Model rank =  44 / 44 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  8.06    1.01    0.85    
#> te(gini_index,gdp_per_capita) 24.00 18.62    0.92  <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 138: Diagnostics for the mbepr_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 139: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_3 <- mgcv::gam(
  beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_3 |> summary()
#> 
#> Family: Beta regression(34.225) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value     Pr(>|z|)    
#> (Intercept) -2.89967511  0.01020155 -284.23855   < 2.22e-16 ***
#> year2009     0.10539703  0.01272498    8.28269   < 2.22e-16 ***
#> year2011     0.11064449  0.01283770    8.61872   < 2.22e-16 ***
#> year2012     0.06673873  0.01412097    4.72621 0.0000022875 ***
#> year2013     0.19736129  0.01303079   15.14576   < 2.22e-16 ***
#> year2014     0.23665686  0.01336721   17.70429   < 2.22e-16 ***
#> year2015     0.27796489  0.01421029   19.56081   < 2.22e-16 ***
#> year2016     0.25929071  0.01478105   17.54211   < 2.22e-16 ***
#> year2017     0.29879275  0.01428656   20.91426   < 2.22e-16 ***
#> year2018     0.32434638  0.01417947   22.87437   < 2.22e-16 ***
#> year2019     0.30890547  0.01462771   21.11783   < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf   Ref.df      Chi.sq    p-value    
#> s(spei_12m)                    8.082345  8.78328    63.56623 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 19.054371 19.93088 14918.83941 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.149   Deviance explained = 23.6%
#> -REML = -1.1147e+05  Scale est. = 1         n = 57487
Code
beipr_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 119: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_3 model.
Value Interpretation Rule
R2 0.1493060969 moderate cohen1988
SE 0.0026239087 NA NA
Lower CI 0.1441633303 moderate cohen1988
Upper CI 0.1544488635 moderate cohen1988

Source: Created by the authors.

Code
beipr_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 120: Summary statistics of the beipr_gam_3 model.
Value
df 38.1367164081
logLik 111589.4704977399
AIC -223098.1314710437
BIC -222736.1325146194
deviance 58668.8963346677
df.residual 57448.8632835920
nobs 57487.0000000000
adj.r.squared 0.1493060969
npar 44.0000000000

Source: Created by the authors.

Code
beipr_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 121: Value of the coefficients in the beipr_gam_3 model.
Value
[Mean] -0.0121664630
mean((Intercept)) -2.8996751144
year2009 0.1053970265
year2011 0.1106444947
year2012 0.0667387259
year2013 0.1973612930
year2014 0.2366568590
year2015 0.2779648870
year2016 0.2592907062
year2017 0.2987927541
year2018 0.3243463811
year2019 0.3089054719
mean(s(spei_12m)) -0.0751661941
mean(te(gini_index,gdp_per_capita)) 0.0356144954
s(spei_12m).1 -0.1104833431
s(spei_12m).2 0.2309113117
s(spei_12m).3 -0.0740954490
s(spei_12m).4 -0.1948874228
s(spei_12m).5 -0.1245550452
s(spei_12m).6 -0.1281435839
s(spei_12m).7 0.0659821733
s(spei_12m).8 -0.5149726897
s(spei_12m).9 0.1737483018
te(gini_index,gdp_per_capita).1 -1.3521563336
te(gini_index,gdp_per_capita).2 -1.4496158938
te(gini_index,gdp_per_capita).3 -1.6276597337
te(gini_index,gdp_per_capita).4 3.1934039794
te(gini_index,gdp_per_capita).5 0.5049433966
te(gini_index,gdp_per_capita).6 -0.2957012023
te(gini_index,gdp_per_capita).7 -0.0271573233
te(gini_index,gdp_per_capita).8 -0.7439781133
te(gini_index,gdp_per_capita).9 1.0164995475
te(gini_index,gdp_per_capita).10 0.7853237886
te(gini_index,gdp_per_capita).11 -0.0942365915
te(gini_index,gdp_per_capita).12 0.1628416906
te(gini_index,gdp_per_capita).13 -0.3306452317
te(gini_index,gdp_per_capita).14 0.2367630613
te(gini_index,gdp_per_capita).15 1.1097339022
te(gini_index,gdp_per_capita).16 0.0226084764
te(gini_index,gdp_per_capita).17 0.2572753759
te(gini_index,gdp_per_capita).18 -0.1434441278
te(gini_index,gdp_per_capita).19 -0.4648194893
te(gini_index,gdp_per_capita).20 0.8009321008
te(gini_index,gdp_per_capita).21 1.1461040410
te(gini_index,gdp_per_capita).22 0.7535444622
te(gini_index,gdp_per_capita).23 0.4410344020
te(gini_index,gdp_per_capita).24 -3.0468462957

Source: Created by the authors.

Code
plot <- beipr_gam_3 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 140: Effects of each term in the beipr_gam_3 model.

Source: Created by the authors.

Code
beipr_gam_3 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 122: Concurvity measures of the beipr_gam_3 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita)
worst 0.9313201642 0.4945646420 0.2683005283
observed 0.9313201642 0.0351098096 0.1069496699
estimate 0.9313201642 0.3683641849 0.0059940691

Source: Created by the authors.

Code
beipr_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.0005117033844,0.004466838688]
#> (score -111471.2528 & scale 1).
#> Hessian positive definite, eigenvalue range [2.151867338,26994.38458].
#> Model rank =  44 / 44 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  8.08    0.99    0.51    
#> te(gini_index,gdp_per_capita) 24.00 19.05    0.90  <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 141: Diagnostics for the beipr_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 142: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_3 <- mgcv::gam(
  mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_3 |> summary()
#> 
#> Family: Beta regression(21.151) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.159190247  0.009874687 -218.65910 < 2.22e-16 ***
#> year2009     0.122813449  0.012353708    9.94142 < 2.22e-16 ***
#> year2011     0.107219842  0.012442937    8.61692 < 2.22e-16 ***
#> year2012     0.045009885  0.013703519    3.28455  0.0010215 ** 
#> year2013     0.167603679  0.012673779   13.22444 < 2.22e-16 ***
#> year2014     0.215860977  0.012995929   16.60989 < 2.22e-16 ***
#> year2015     0.177928598  0.013903460   12.79743 < 2.22e-16 ***
#> year2016     0.199291395  0.014390675   13.84865 < 2.22e-16 ***
#> year2017     0.203573768  0.013972394   14.56971 < 2.22e-16 ***
#> year2018     0.207418677  0.013913274   14.90797 < 2.22e-16 ***
#> year2019     0.204303286  0.014329055   14.25797 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                    edf    Ref.df     Chi.sq     p-value    
#> s(spei_12m)                    7.08259  8.168693    35.5681 0.000018515 ***
#> te(gini_index,gdp_per_capita) 19.17344 20.000040 13789.6069  < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.162   Deviance explained =   22%
#> -REML = -79087  Scale est. = 1         n = 57487
Code
mbepr_beipr_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 123: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_3 model.
Value Interpretation Rule
R2 0.1624932219 moderate cohen1988
SE 0.0026948996 NA NA
Lower CI 0.1572113158 moderate cohen1988
Upper CI 0.1677751280 moderate cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 124: Summary statistics of the mbepr_beipr_gam_3 model.
Value
df 37.2560329981
logLik 79202.4210302577
AIC -158324.5045936237
BIC -157964.6202931100
deviance 56959.3131546617
df.residual 57449.7439670019
nobs 57487.0000000000
adj.r.squared 0.1624932219
npar 44.0000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 125: Value of the coefficients in the mbepr_beipr_gam_3 model.
Value
[Mean] -0.0016887695
mean((Intercept)) -2.1591902471
year2009 0.1228134492
year2011 0.1072198416
year2012 0.0450098846
year2013 0.1676036792
year2014 0.2158609769
year2015 0.1779285979
year2016 0.1992913950
year2017 0.2035737682
year2018 0.2074186770
year2019 0.2043032857
mean(s(spei_12m)) -0.0318262562
mean(te(gini_index,gdp_per_capita)) 0.0300123808
s(spei_12m).1 -0.0603740738
s(spei_12m).2 0.1036650402
s(spei_12m).3 -0.0253766695
s(spei_12m).4 -0.0944020283
s(spei_12m).5 -0.0497403537
s(spei_12m).6 -0.0458236431
s(spei_12m).7 0.0423747806
s(spei_12m).8 -0.2356056438
s(spei_12m).9 0.0788462854
te(gini_index,gdp_per_capita).1 -1.2755043079
te(gini_index,gdp_per_capita).2 -1.3317391053
te(gini_index,gdp_per_capita).3 -1.5256843491
te(gini_index,gdp_per_capita).4 1.3212073962
te(gini_index,gdp_per_capita).5 0.4188514404
te(gini_index,gdp_per_capita).6 -0.3133234669
te(gini_index,gdp_per_capita).7 0.0834345085
te(gini_index,gdp_per_capita).8 -0.7898726306
te(gini_index,gdp_per_capita).9 0.3784693343
te(gini_index,gdp_per_capita).10 0.7132728392
te(gini_index,gdp_per_capita).11 -0.1630904180
te(gini_index,gdp_per_capita).12 0.1769337451
te(gini_index,gdp_per_capita).13 -0.4264444585
te(gini_index,gdp_per_capita).14 0.0878140020
te(gini_index,gdp_per_capita).15 1.1016613185
te(gini_index,gdp_per_capita).16 -0.0537806577
te(gini_index,gdp_per_capita).17 0.2577611227
te(gini_index,gdp_per_capita).18 -0.2288250830
te(gini_index,gdp_per_capita).19 -0.0934906405
te(gini_index,gdp_per_capita).20 0.8395070875
te(gini_index,gdp_per_capita).21 1.1420810342
te(gini_index,gdp_per_capita).22 0.6995671093
te(gini_index,gdp_per_capita).23 0.3060160198
te(gini_index,gdp_per_capita).24 -0.6045247004

Source: Created by the authors.

Code
plot <- mbepr_beipr_gam_3 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 143: Effects of each term in the mbepr_beipr_gam_3 model.

Source: Created by the authors.

Code
mbepr_beipr_gam_3 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 126: Concurvity measures of the mbepr_beipr_gam_3 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita)
worst 0.9313201642 0.4945646420 0.2683005283
observed 0.9313201642 0.1877873097 0.1158616178
estimate 0.9313201642 0.3683641849 0.0059940691

Source: Created by the authors.

Code
mbepr_beipr_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [-0.002800550507,0.02961273496]
#> (score -79086.96817 & scale 1).
#> Hessian positive definite, eigenvalue range [1.427919491,28214.74375].
#> Model rank =  44 / 44 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  7.08    0.99    0.28    
#> te(gini_index,gdp_per_capita) 24.00 19.17    0.90  <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 144: Diagnostics for the mbepr_beipr_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 145: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_3 <- mgcv::gam(
  maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_3 |> summary()
#> 
#> Family: Beta regression(32.931) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -3.99601050  0.01364479 -292.85983 < 2.22e-16 ***
#> year2009     0.15247509  0.01725091    8.83867 < 2.22e-16 ***
#> year2011     0.23513923  0.01717695   13.68923 < 2.22e-16 ***
#> year2012     0.06449541  0.01880560    3.42959  0.0006045 ***
#> year2013     0.33439088  0.01737577   19.24466 < 2.22e-16 ***
#> year2014     0.33421523  0.01790162   18.66955 < 2.22e-16 ***
#> year2015     0.27987740  0.01907412   14.67315 < 2.22e-16 ***
#> year2016     0.33667530  0.01970282   17.08767 < 2.22e-16 ***
#> year2017     0.36461942  0.01913118   19.05891 < 2.22e-16 ***
#> year2018     0.21486146  0.01925547   11.15846 < 2.22e-16 ***
#> year2019     0.19476708  0.01982589    9.82387 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    8.533731  8.940516   458.3768 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.432039 19.324092 12523.8423 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0242   Deviance explained = 23.2%
#> -REML = -1.6815e+05  Scale est. = 1         n = 57487
Code
maper_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 127: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_3 model.
Value Interpretation Rule
R2 0.0241775872 weak cohen1988
SE 0.0012111945 NA NA
Lower CI 0.0218036896 weak cohen1988
Upper CI 0.0265514849 weak cohen1988

Source: Created by the authors.

Code
maper_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 128: Summary statistics of the maper_gam_3 model.
Value
df 37.9657699917
logLik 168265.6856390867
AIC -336450.8420635338
BIC -336090.0987988681
deviance 60454.8015606333
df.residual 57449.0342300083
nobs 57487.0000000000
adj.r.squared 0.0241775872
npar 44.0000000000

Source: Created by the authors.

Code
maper_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 129: Value of the coefficients in the maper_gam_3 model.
Value
[Mean] 0.1693848201
mean((Intercept)) -3.9960105027
year2009 0.1524750945
year2011 0.2351392323
year2012 0.0644954114
year2013 0.3343908789
year2014 0.3342152341
year2015 0.2798774023
year2016 0.3366753017
year2017 0.3646194153
year2018 0.2148614609
year2019 0.1947670760
mean(s(spei_12m)) -0.0569938870
mean(te(gini_index,gdp_per_capita)) 0.3937654610
s(spei_12m).1 -0.3061759381
s(spei_12m).2 0.1948473708
s(spei_12m).3 -0.0575602287
s(spei_12m).4 -0.1775842020
s(spei_12m).5 -0.1584616024
s(spei_12m).6 -0.1552613848
s(spei_12m).7 0.1691218646
s(spei_12m).8 -0.4050855862
s(spei_12m).9 0.3832147242
te(gini_index,gdp_per_capita).1 -1.4917441793
te(gini_index,gdp_per_capita).2 -1.3551831038
te(gini_index,gdp_per_capita).3 -1.4725345953
te(gini_index,gdp_per_capita).4 -12.1354001211
te(gini_index,gdp_per_capita).5 0.9212847555
te(gini_index,gdp_per_capita).6 -0.4251114623
te(gini_index,gdp_per_capita).7 0.1091643526
te(gini_index,gdp_per_capita).8 -1.2978972559
te(gini_index,gdp_per_capita).9 -2.5465670413
te(gini_index,gdp_per_capita).10 0.9595177592
te(gini_index,gdp_per_capita).11 -0.1391346748
te(gini_index,gdp_per_capita).12 0.3635963590
te(gini_index,gdp_per_capita).13 -0.6399226520
te(gini_index,gdp_per_capita).14 1.1461395221
te(gini_index,gdp_per_capita).15 1.1395827679
te(gini_index,gdp_per_capita).16 -0.0927790639
te(gini_index,gdp_per_capita).17 0.4325713514
te(gini_index,gdp_per_capita).18 -0.3692779823
te(gini_index,gdp_per_capita).19 5.0310873861
te(gini_index,gdp_per_capita).20 0.5497008795
te(gini_index,gdp_per_capita).21 0.2523489435
te(gini_index,gdp_per_capita).22 0.0407022538
te(gini_index,gdp_per_capita).23 -0.3371453468
te(gini_index,gdp_per_capita).24 20.8073722109

Source: Created by the authors.

Code
plot <- maper_gam_3 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 146: Effects of each term in the maper_gam_3 model.

Source: Created by the authors.

Code
maper_gam_3 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 130: Concurvity measures of the maper_gam_3 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita)
worst 0.9313201642 0.4945646420 0.2683005283
observed 0.9313201642 0.4381816939 0.1325871299
estimate 0.9313201642 0.3683641849 0.0059940691

Source: Created by the authors.

Code
maper_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 9 iterations.
#> Gradient range [-0.00000001675275563,0.00007806112087]
#> (score -168153.2931 & scale 1).
#> Hessian positive definite, eigenvalue range [1.94821447,20960.98539].
#> Model rank =  44 / 44 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  8.53    1.02    0.92    
#> te(gini_index,gdp_per_capita) 24.00 18.43    0.93  <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 147: Diagnostics for the maper_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 148: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_3 <- mgcv::gam(
  mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_3 |> summary()
#> 
#> Family: Beta regression(41.403) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value         Pr(>|z|)    
#> (Intercept) -3.86150556  0.01260182 -306.42433       < 2.22e-16 ***
#> year2009     0.14371061  0.01586007    9.06116       < 2.22e-16 ***
#> year2011     0.25115553  0.01577156   15.92459       < 2.22e-16 ***
#> year2012     0.10922752  0.01721641    6.34439 0.00000000022332 ***
#> year2013     0.28761937  0.01603130   17.94111       < 2.22e-16 ***
#> year2014     0.27297624  0.01655091   16.49313       < 2.22e-16 ***
#> year2015     0.30586205  0.01750606   17.47178       < 2.22e-16 ***
#> year2016     0.34492876  0.01807755   19.08050       < 2.22e-16 ***
#> year2017     0.42902585  0.01745024   24.58567       < 2.22e-16 ***
#> year2018     0.33283963  0.01753872   18.97742       < 2.22e-16 ***
#> year2019     0.27380899  0.01811765   15.11283       < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                    edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    8.42186  8.909772   585.5615 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.91214 19.674028 12819.2198 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00959   Deviance explained = 24.2%
#> -REML = -1.5535e+05  Scale est. = 1         n = 57487
Code
mpepr_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 131: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_3 model.
Value Interpretation Rule
R2 0.0095858206 very weak (negligible) cohen1988
SE 0.0007740484 NA NA
Lower CI 0.0080687136 very weak (negligible) cohen1988
Upper CI 0.0111029276 very weak (negligible) cohen1988

Source: Created by the authors.

Code
mpepr_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 132: Summary statistics of the mpepr_gam_3 model.
Value
df 38.3339984777
logLik 155467.7738954670
AIC -310854.3801911687
BIC -310490.7771800697
deviance 61150.4305363797
df.residual 57448.6660015223
nobs 57487.0000000000
adj.r.squared 0.0095858206
npar 44.0000000000

Source: Created by the authors.

Code
mpepr_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 133: Value of the coefficients in the mpepr_gam_3 model.
Value
[Mean] 0.1306026090
mean((Intercept)) -3.8615055590
year2009 0.1437106128
year2011 0.2511555289
year2012 0.1092275225
year2013 0.2876193680
year2014 0.2729762389
year2015 0.3058620458
year2016 0.3449287553
year2017 0.4290258493
year2018 0.3328396293
year2019 0.2738089862
mean(s(spei_12m)) -0.0361386690
mean(te(gini_index,gdp_per_capita)) 0.2992547433
s(spei_12m).1 -0.2444282876
s(spei_12m).2 0.1058702031
s(spei_12m).3 -0.0327454758
s(spei_12m).4 -0.1219319935
s(spei_12m).5 -0.1300972110
s(spei_12m).6 -0.0941197011
s(spei_12m).7 0.1191623395
s(spei_12m).8 -0.2159552192
s(spei_12m).9 0.2889973246
te(gini_index,gdp_per_capita).1 -2.0960278090
te(gini_index,gdp_per_capita).2 -1.6243647805
te(gini_index,gdp_per_capita).3 -1.6713527887
te(gini_index,gdp_per_capita).4 -9.1012143419
te(gini_index,gdp_per_capita).5 0.9746756794
te(gini_index,gdp_per_capita).6 -0.6786623722
te(gini_index,gdp_per_capita).7 0.4992745525
te(gini_index,gdp_per_capita).8 -1.8208678695
te(gini_index,gdp_per_capita).9 -1.6793720102
te(gini_index,gdp_per_capita).10 1.0341850370
te(gini_index,gdp_per_capita).11 -0.4676619299
te(gini_index,gdp_per_capita).12 0.6393627706
te(gini_index,gdp_per_capita).13 -0.9608980325
te(gini_index,gdp_per_capita).14 1.1880938729
te(gini_index,gdp_per_capita).15 1.0832396225
te(gini_index,gdp_per_capita).16 -0.5198117726
te(gini_index,gdp_per_capita).17 0.5725301377
te(gini_index,gdp_per_capita).18 -0.7094583902
te(gini_index,gdp_per_capita).19 4.3493500522
te(gini_index,gdp_per_capita).20 0.2656541669
te(gini_index,gdp_per_capita).21 0.1224110748
te(gini_index,gdp_per_capita).22 0.1781379545
te(gini_index,gdp_per_capita).23 -0.0371749324
te(gini_index,gdp_per_capita).24 17.6420659475

Source: Created by the authors.

Code
plot <- mpepr_gam_3 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 149: Effects of each term in the mpepr_gam_3 model.

Source: Created by the authors.

Code
mpepr_gam_3 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 134: Concurvity measures of the mpepr_gam_3 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita)
worst 0.9313201642 0.4945646420 0.2683005283
observed 0.9313201642 0.4495280531 0.1284622680
estimate 0.9313201642 0.3683641849 0.0059940691

Source: Created by the authors.

Code
mpepr_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.000000003203455279,0.00004511554999]
#> (score -155349.7207 & scale 1).
#> Hessian positive definite, eigenvalue range [2.26230441,23477.26635].
#> Model rank =  44 / 44 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  8.42    0.96    0.01 ** 
#> te(gini_index,gdp_per_capita) 24.00 18.91    0.93  <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 150: Diagnostics for the mpepr_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 151: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_3 <- mgcv::gam(
  maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_3 |> summary()
#> 
#> Family: Beta regression(27.303) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value    Pr(>|z|)    
#> (Intercept) -3.12926296  0.01186277 -263.78846  < 2.22e-16 ***
#> year2009     0.13680174  0.01488768    9.18892  < 2.22e-16 ***
#> year2011     0.19340145  0.01488600   12.99217  < 2.22e-16 ***
#> year2012     0.06472745  0.01628265    3.97524 0.000070308 ***
#> year2013     0.24249341  0.01511562   16.04257  < 2.22e-16 ***
#> year2014     0.22739170  0.01560549   14.57127  < 2.22e-16 ***
#> year2015     0.20955550  0.01661983   12.60876  < 2.22e-16 ***
#> year2016     0.26288578  0.01714486   15.33321  < 2.22e-16 ***
#> year2017     0.32754455  0.01656538   19.77284  < 2.22e-16 ***
#> year2018     0.17677427  0.01673454   10.56343  < 2.22e-16 ***
#> year2019     0.14848298  0.01724484    8.61028  < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    8.526907  8.938769   559.0332 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.841553 19.610152 12241.3142 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0589   Deviance explained = 23.6%
#> -REML = -1.1925e+05  Scale est. = 1         n = 57487
Code
maper_mpepr_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 135: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_3 model.
Value Interpretation Rule
R2 0.0589259436 weak cohen1988
SE 0.0018235333 NA NA
Lower CI 0.0553518839 weak cohen1988
Upper CI 0.0625000032 weak cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 136: Summary statistics of the maper_mpepr_gam_3 model.
Value
df 38.3684603510
logLik 119371.6301494287
AIC -238662.1624567214
BIC -238298.8719358787
deviance 59347.9113152593
df.residual 57448.6315396490
nobs 57487.0000000000
adj.r.squared 0.0589259436
npar 44.0000000000

Source: Created by the authors.

Code
maper_mpepr_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 137: Value of the coefficients in the maper_mpepr_gam_3 model.
Value
[Mean] 0.1404606223
mean((Intercept)) -3.1292629574
year2009 0.1368017439
year2011 0.1934014494
year2012 0.0647274507
year2013 0.2424934106
year2014 0.2273917044
year2015 0.2095554984
year2016 0.2628857750
year2017 0.3275445525
year2018 0.1767742657
year2019 0.1484829769
mean(s(spei_12m)) -0.0050026515
mean(te(gini_index,gdp_per_capita)) 0.3068539739
s(spei_12m).1 -0.2263180417
s(spei_12m).2 0.0238303442
s(spei_12m).3 -0.0089613031
s(spei_12m).4 -0.0718597325
s(spei_12m).5 -0.0858019057
s(spei_12m).6 -0.0466087591
s(spei_12m).7 0.1311737971
s(spei_12m).8 -0.0433872575
s(spei_12m).9 0.2829089951
te(gini_index,gdp_per_capita).1 -1.8335236249
te(gini_index,gdp_per_capita).2 -1.5862695654
te(gini_index,gdp_per_capita).3 -1.6837156974
te(gini_index,gdp_per_capita).4 -9.0555687573
te(gini_index,gdp_per_capita).5 0.9875648349
te(gini_index,gdp_per_capita).6 -0.4657955176
te(gini_index,gdp_per_capita).7 0.3205507634
te(gini_index,gdp_per_capita).8 -1.4192503472
te(gini_index,gdp_per_capita).9 -1.7614710998
te(gini_index,gdp_per_capita).10 0.9006326264
te(gini_index,gdp_per_capita).11 -0.2887408343
te(gini_index,gdp_per_capita).12 0.4732375702
te(gini_index,gdp_per_capita).13 -0.7364740672
te(gini_index,gdp_per_capita).14 1.0455874853
te(gini_index,gdp_per_capita).15 1.0082331190
te(gini_index,gdp_per_capita).16 -0.3078790623
te(gini_index,gdp_per_capita).17 0.4474006871
te(gini_index,gdp_per_capita).18 -0.5220166509
te(gini_index,gdp_per_capita).19 4.1520005645
te(gini_index,gdp_per_capita).20 0.2112077211
te(gini_index,gdp_per_capita).21 0.1366376155
te(gini_index,gdp_per_capita).22 0.1878664862
te(gini_index,gdp_per_capita).23 -0.0532865134
te(gini_index,gdp_per_capita).24 17.2075676377

Source: Created by the authors.

Code
plot <- maper_mpepr_gam_3 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 152: Effects of each term in the maper_mpepr_gam_3 model.

Source: Created by the authors.

Code
maper_mpepr_gam_3 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 138: Concurvity measures of the maper_mpepr_gam_3 model terms.
para s(spei_12m) te(gini_index,gdp_per_capita)
worst 0.9313201642 0.4945646420 0.2683005283
observed 0.9313201642 0.4406469634 0.1330597970
estimate 0.9313201642 0.3683641849 0.0059940691

Source: Created by the authors.

Code
maper_mpepr_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.00002049381068,0.02468780247]
#> (score -119252.4915 & scale 1).
#> Hessian positive definite, eigenvalue range [2.107721844,25232.74469].
#> Model rank =  44 / 44 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                                  k'   edf k-index p-value    
#> s(spei_12m)                    9.00  8.53    0.98    0.24    
#> te(gini_index,gdp_per_capita) 24.00 18.84    0.92  <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 153: Diagnostics for the maper_mpepr_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 154: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(year) (Continuous)

Code
mbepr_gam_4 <- mgcv::gam(
  mbepr ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_4 |> summary()
#> 
#> Family: Beta regression(17.632) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.819223463  0.003244516 -868.9196 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.517735 8.935257 302.3165 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00359   Deviance explained = 0.499%
#> -REML = -1.1796e+05  Scale est. = 1         n = 62762
Code
mbepr_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 139: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_4 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mbepr_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 140: Summary statistics of the mbepr_gam_4 model.
Value
df 9.5177348799
logLik 117986.4920079141
AIC -235951.1135022862
BIC -235852.1810852699
deviance 64482.0026382929
df.residual 62752.4822651201
nobs 62762.0000000000
adj.r.squared -0.0035886584
npar 10.0000000000

Source: Created by the authors.

Code
mbepr_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 141: Value of the coefficients in the mbepr_gam_4 model.
Value
[Mean] -0.2591799301
mean((Intercept)) -2.8192234633
mean(s(year)) 0.0252693513
s(year).1 -0.0616929526
s(year).2 -0.4716576788
s(year).3 0.1111416481
s(year).4 -0.3755761928
s(year).5 0.0081485117
s(year).6 -0.1063744614
s(year).7 0.0620259186
s(year).8 0.7073784597
s(year).9 0.3540309094

Source: Created by the authors.

Code
plot <- mbepr_gam_4 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 155: Effects of each term in the mbepr_gam_4 model.

Source: Created by the authors.

Code
mbepr_gam_4 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 142: Concurvity measures of the mbepr_gam_4 model terms.
para s(year)
worst 0 0
observed 0 0
estimate 0 0

Source: Created by the authors.

Code
mbepr_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.0000007308610019,0.03364194555]
#> (score -117956.7533 & scale 1).
#> Hessian positive definite, eigenvalue range [3.531791006,26569.1772].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value
#> s(year) 9.00 8.52       1    0.69
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 156: Diagnostics for the mbepr_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 157: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_4 <- mgcv::gam(
  beipr ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_4 |> summary()
#> 
#> Family: Beta regression(25.787) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.648641361  0.002748208 -963.7703 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.380103 8.894804 281.1438 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00755   Deviance explained = 0.486%
#> -REML = -1.1332e+05  Scale est. = 1         n = 62762
Code
beipr_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 143: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_4 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
beipr_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 144: Summary statistics of the beipr_gam_4 model.
Value
df 9.3801031575
logLik 113351.7302965717
AIC -226681.8554885659
BIC -226584.1236629445
deviance 63829.0813461868
df.residual 62752.6198968425
nobs 62762.0000000000
adj.r.squared -0.0075487984
npar 10.0000000000

Source: Created by the authors.

Code
beipr_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 145: Value of the coefficients in the beipr_gam_4 model.
Value
[Mean] -0.2736261600
mean((Intercept)) -2.6486413607
mean(s(year)) -0.0097355821
s(year).1 0.0561664109
s(year).2 -0.4328040766
s(year).3 0.0674106088
s(year).4 -0.3427380909
s(year).5 -0.0754938762
s(year).6 -0.1521644547
s(year).7 0.0933523603
s(year).8 0.5979252308
s(year).9 0.1007256485

Source: Created by the authors.

Code
plot <- beipr_gam_4 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 158: Effects of each term in the beipr_gam_4 model.

Source: Created by the authors.

Code
beipr_gam_4 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 146: Concurvity measures of the beipr_gam_4 model terms.
para s(year)
worst 0 0
observed 0 0
estimate 0 0

Source: Created by the authors.

Code
beipr_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.0000000004378528651,0.00001056270043]
#> (score -113322.8181 & scale 1).
#> Hessian positive definite, eigenvalue range [3.395724488,29159.85227].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value
#> s(year) 9.00 8.38    1.01    0.85
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 159: Diagnostics for the beipr_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 160: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_4 <- mgcv::gam(
  mbepr_beipr ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_4 |> summary()
#> 
#> Family: Beta regression(16.293) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.96506495  0.00268522 -731.8079 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>             edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.44098 8.913794 235.0998 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0045   Deviance explained = 0.392%
#> -REML = -78452  Scale est. = 1         n = 62762
Code
mbepr_beipr_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 147: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_4 model.
Value Interpretation Rule
R2 0.0045000402 very weak (negligible) cohen1988
SE 0.0005330977 NA NA
Lower CI 0.0034551879 very weak (negligible) cohen1988
Upper CI 0.0055448926 very weak (negligible) cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 148: Summary statistics of the mbepr_beipr_gam_4 model.
Value
df 9.4409801854
logLik 78481.3360960384
AIC -156941.1983968910
BIC -156844.0605562020
deviance 61788.3616920760
df.residual 62752.5590198146
nobs 62762.0000000000
adj.r.squared 0.0045000402
npar 10.0000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 149: Value of the coefficients in the mbepr_beipr_gam_4 model.
Value
[Mean] -0.1919132142
mean((Intercept)) -1.9650649515
mean(s(year)) 0.0051036454
s(year).1 -0.0208363314
s(year).2 -0.3588470884
s(year).3 0.0933378059
s(year).4 -0.3193991152
s(year).5 -0.0265977789
s(year).6 -0.0976915928
s(year).7 0.0469086650
s(year).8 0.5229279235
s(year).9 0.2061303213

Source: Created by the authors.

Code
plot <- mbepr_beipr_gam_4 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 161: Effects of each term in the mbepr_beipr_gam_4 model.

Source: Created by the authors.

Code
mbepr_beipr_gam_4 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 150: Concurvity measures of the mbepr_beipr_gam_4 model terms.
para s(year)
worst 0 0
observed 0 0
estimate 0 0

Source: Created by the authors.

Code
mbepr_beipr_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 4 iterations.
#> Gradient range [0.0001485521986,0.01425683628]
#> (score -78451.89082 & scale 1).
#> Hessian positive definite, eigenvalue range [3.542988508,30825.81986].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value  
#> s(year) 9.00 8.44    0.98    0.09 .
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 162: Diagnostics for the mbepr_beipr_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 163: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_4 <- mgcv::gam(
  maper ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_4 |> summary()
#> 
#> Family: Beta regression(24.478) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.670795216  0.003547555 -1034.739 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.587611 8.952185 318.7632 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00151   Deviance explained = 0.488%
#> -REML = -1.7521e+05  Scale est. = 1         n = 62762
Code
maper_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 151: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_4 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 152: Summary statistics of the maper_gam_4 model.
Value
df 9.5876109295
logLik 175244.4552867728
AIC -350467.0062043938
BIC -350367.9206397486
deviance 67164.5053157659
df.residual 62752.4123890705
nobs 62762.0000000000
adj.r.squared -0.0015113762
npar 10.0000000000

Source: Created by the authors.

Code
maper_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 153: Value of the coefficients in the maper_gam_4 model.
Value
[Mean] -0.3262673232
mean((Intercept)) -3.6707952155
mean(s(year)) 0.0453468870
s(year).1 0.0389410631
s(year).2 -0.1895386771
s(year).3 0.0670338162
s(year).4 -0.0993975060
s(year).5 0.0862343325
s(year).6 0.1424197328
s(year).7 -0.0112784840
s(year).8 0.2021700530
s(year).9 0.1715376528

Source: Created by the authors.

Code
plot <- maper_gam_4 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 164: Effects of each term in the maper_gam_4 model.

Source: Created by the authors.

Code
maper_gam_4 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 154: Concurvity measures of the maper_gam_4 model terms.
para s(year)
worst 0 0
observed 0 0
estimate 0 0

Source: Created by the authors.

Code
maper_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [-0.000001789168296,0.1457289897]
#> (score -175214.1738 & scale 1).
#> Hessian positive definite, eigenvalue range [3.266969182,21653.71035].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value
#> s(year) 9.00 8.59    0.99    0.28
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 165: Diagnostics for the maper_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 166: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_4 <- mgcv::gam(
  mpepr ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_4 |> summary()
#> 
#> Family: Beta regression(30.596) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.530426653  0.003291301 -1072.654 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.125824 8.797382 452.6992 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0126   Deviance explained = 0.688%
#> -REML = -1.6103e+05  Scale est. = 1         n = 62762
Code
mpepr_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 155: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_4 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mpepr_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 156: Summary statistics of the mpepr_gam_4 model.
Value
df 9.125823871
logLik 161057.642508866
AIC -322093.690254409
BIC -321996.005207994
deviance 67280.102592947
df.residual 62752.874176129
nobs 62762.000000000
adj.r.squared -0.012590109
npar 10.000000000

Source: Created by the authors.

Code
mpepr_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 157: Value of the coefficients in the mpepr_gam_4 model.
Value
[Mean] -0.3632127806
mean((Intercept)) -3.5304266535
mean(s(year)) -0.0113001281
s(year).1 0.1018320400
s(year).2 -0.5486815309
s(year).3 -0.0575378013
s(year).4 -0.1922950329
s(year).5 -0.0030350331
s(year).6 -0.0968978698
s(year).7 0.0561403469
s(year).8 0.5864875915
s(year).9 0.0522861365

Source: Created by the authors.

Code
plot <- mpepr_gam_4 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 167: Effects of each term in the mpepr_gam_4 model.

Source: Created by the authors.

Code
mpepr_gam_4 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 158: Concurvity measures of the mpepr_gam_4 model terms.
para s(year)
worst 0 0
observed 0 0
estimate 0 0

Source: Created by the authors.

Code
mpepr_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.0000409648117,0.009724409113]
#> (score -161030.7811 & scale 1).
#> Hessian positive definite, eigenvalue range [3.051833023,24661.20026].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value
#> s(year) 9.00 8.13    1.01    0.79
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 168: Diagnostics for the mpepr_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 169: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_4 <- mgcv::gam(
  maper_mpepr ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_4 |> summary()
#> 
#> Family: Beta regression(20.399) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.877019036  0.003155272 -911.8133 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.577875 8.950003 332.6079 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.000687   Deviance explained = 0.525%
#> -REML = -1.2164e+05  Scale est. = 1         n = 62762
Code
maper_mpepr_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 159: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_4 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 160: Summary statistics of the maper_mpepr_gam_4 model.
Value
df 9.5778747519
logLik 121672.7902501706
AIC -243323.6804947727
BIC -243224.6146690252
deviance 64882.8996527854
df.residual 62752.4221252481
nobs 62762.0000000000
adj.r.squared -0.0006872297
npar 10.0000000000

Source: Created by the authors.

Code
maper_mpepr_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 161: Value of the coefficients in the maper_mpepr_gam_4 model.
Value
[Mean] -0.2723942217
mean((Intercept)) -2.8770190360
mean(s(year)) 0.0170085354
s(year).1 0.0497055757
s(year).2 -0.3923181621
s(year).3 -0.0094910536
s(year).4 -0.1372109144
s(year).5 0.0730709950
s(year).6 0.0302598366
s(year).7 0.0024651166
s(year).8 0.3945578698
s(year).9 0.1420375555

Source: Created by the authors.

Code
plot <- maper_mpepr_gam_4 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 170: Effects of each term in the maper_mpepr_gam_4 model.

Source: Created by the authors.

Code
maper_mpepr_gam_4 |>
  mgcv::concurvity(TRUE) |>
  as.data.frame() |>
  pal::pipe_table(label = NA, digits = 10) |>
  pal::cat_lines()
Table 162: Concurvity measures of the maper_mpepr_gam_4 model terms.
para s(year)
worst 0 0
observed 0 0
estimate 0 0

Source: Created by the authors.

Code
maper_mpepr_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [0.001452357338,0.001462095772]
#> (score -121642.3846 & scale 1).
#> Hessian positive definite, eigenvalue range [3.300163003,26958.96005].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value
#> s(year) 9.00 8.58    0.99    0.36
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 171: Diagnostics for the maper_mpepr_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 172: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By year (Ordered)

In this model, the year variable is treated as a ordered categorical variable.

.L, .Q, and .C are, respectively, the coefficients for the ordered factor coded with linear, quadratic, and cubic contrasts.

Code
mbepr_gam_5 <- mgcv::gam(
  mbepr ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_5 |> summary()
#> 
#> Family: Beta regression(17.638) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value             Pr(>|z|)    
#> (Intercept) -2.819724761  0.003245311 -868.86131           < 2.22e-16 ***
#> year.L       0.039878128  0.011320870    3.52253           0.00042745 ***
#> year.Q      -0.106048138  0.011379691   -9.31907           < 2.22e-16 ***
#> year.C       0.004592172  0.011329411    0.40533           0.68523353    
#> year^4      -0.084506343  0.011264853   -7.50177 0.000000000000062962 ***
#> year^5       0.115842989  0.011244823   10.30190           < 2.22e-16 ***
#> year^6      -0.049357350  0.011184889   -4.41286 0.000010201391317061 ***
#> year^7      -0.009601510  0.011183504   -0.85854           0.39059315    
#> year^8       0.052923709  0.011165129    4.74009 0.000002136239494897 ***
#> year^9      -0.019333845  0.011154098   -1.73334           0.08303524 .  
#> year^10     -0.058854569  0.011214557   -5.24805 0.000000153716732986 ***
#> year^11     -0.017281456  0.011218670   -1.54042           0.12345819    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00327   Deviance explained = 0.525%
#> -REML = -1.1795e+05  Scale est. = 1         n = 62762
Code
mbepr_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 163: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_5 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mbepr_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 164: Summary statistics of the mbepr_gam_5 model.
Value
df 12.0000000000
logLik 117994.6877479883
AIC -235963.3754959765
BIC -235845.7631300175
deviance 64485.5210188838
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0032733397
npar 12.0000000000

Source: Created by the authors.

Code
mbepr_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 165: Value of the coefficients in the mbepr_gam_5 model.
Value
[Mean] -0.2459559144
mean((Intercept)) -2.8197247609
year.L 0.0398781283
year.Q -0.1060481384
year.C 0.0045921722
year^4 -0.0845063430
year^5 0.1158429895
year^6 -0.0493573500
year^7 -0.0096015103
year^8 0.0529237091
year^9 -0.0193338448
year^10 -0.0588545690
year^11 -0.0172814558

Source: Created by the authors.

Code
mbepr_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.000001198946155,0.000001198946155]
#> (score -117950.6115 & scale 1).
#> Hessian positive definite, eigenvalue range [26571.0456,26571.0456].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 173: Diagnostics for the mbepr_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 174: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_5 <- mgcv::gam(
  beipr ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_5 |> summary()
#> 
#> Family: Beta regression(25.798) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value            Pr(>|z|)    
#> (Intercept) -2.649018998  0.002748798 -963.70086          < 2.22e-16 ***
#> year.L       0.089565087  0.009525353    9.40281          < 2.22e-16 ***
#> year.Q       0.008970089  0.009602439    0.93415           0.3502281    
#> year.C      -0.026710792  0.009568146   -2.79164           0.0052442 ** 
#> year^4      -0.070578182  0.009512419   -7.41958 0.00000000000011749 ***
#> year^5       0.082998344  0.009501906    8.73492          < 2.22e-16 ***
#> year^6      -0.043857480  0.009483389   -4.62466 0.00000375207630563 ***
#> year^7      -0.043134260  0.009459485   -4.55990 0.00000511791590338 ***
#> year^8       0.048173854  0.009463350    5.09057 0.00000035698739739 ***
#> year^9       0.004749118  0.009500885    0.49986           0.6171732    
#> year^10     -0.003885200  0.009548341   -0.40690           0.6840830    
#> year^11      0.047418864  0.009576401    4.95164 0.00000073591609239 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00784   Deviance explained = 0.52%
#> -REML = -1.1332e+05  Scale est. = 1         n = 62762
Code
beipr_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 166: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_5 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
beipr_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 167: Summary statistics of the beipr_gam_5 model.
Value
df 12.0000000000
logLik 113362.5968849334
AIC -226699.1937698668
BIC -226581.5814039078
deviance 63831.4178238831
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0078397415
npar 12.0000000000

Source: Created by the authors.

Code
beipr_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 168: Value of the coefficients in the beipr_gam_5 model.
Value
[Mean] -0.2129424629
mean((Intercept)) -2.6490189976
year.L 0.0895650875
year.Q 0.0089700894
year.C -0.0267107916
year^4 -0.0705781816
year^5 0.0829983439
year^6 -0.0438574801
year^7 -0.0431342600
year^8 0.0481738541
year^9 0.0047491179
year^10 -0.0038852003
year^11 0.0474188640

Source: Created by the authors.

Code
beipr_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.00000875780144,0.00000875780144]
#> (score -113316.5276 & scale 1).
#> Hessian positive definite, eigenvalue range [29161.5517,29161.5517].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 175: Diagnostics for the beipr_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 176: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_5 <- mgcv::gam(
  mbepr_beipr ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_5 |> summary()
#> 
#> Family: Beta regression(16.296) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value         Pr(>|z|)    
#> (Intercept) -1.965102548  0.002685499 -731.74585       < 2.22e-16 ***
#> year.L      -0.047271406  0.009320041   -5.07202 0.00000039362084 ***
#> year.Q      -0.013637154  0.009377919   -1.45418       0.14589726    
#> year.C      -0.007039030  0.009352037   -0.75267       0.45164616    
#> year^4      -0.058196732  0.009300741   -6.25721 0.00000000039191 ***
#> year^5       0.093573558  0.009290835   10.07160       < 2.22e-16 ***
#> year^6      -0.052789757  0.009257180   -5.70257 0.00000001180112 ***
#> year^7      -0.020548391  0.009258158   -2.21949       0.02645340 *  
#> year^8       0.046041585  0.009257142    4.97363 0.00000065711276 ***
#> year^9       0.005464968  0.009268416    0.58963       0.55543643    
#> year^10     -0.035902530  0.009320676   -3.85192       0.00011719 ***
#> year^11      0.012717049  0.009327199    1.36344       0.17274482    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00446   Deviance explained = 0.406%
#> -REML = -78439  Scale est. = 1         n = 62762
Code
mbepr_beipr_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 169: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_5 model.
Value Interpretation Rule
R2 0.0044644574 very weak (negligible) cohen1988
SE 0.0005310049 NA NA
Lower CI 0.0034237070 very weak (negligible) cohen1988
Upper CI 0.0055052078 very weak (negligible) cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 170: Summary statistics of the mbepr_beipr_gam_5 model.
Value
df 12.0000000000
logLik 78485.5946634256
AIC -156945.1893268511
BIC -156827.5769608921
deviance 61789.7893367158
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared 0.0044644574
npar 12.0000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 171: Value of the coefficients in the mbepr_beipr_gam_5 model.
Value
[Mean] -0.1702241990
mean((Intercept)) -1.9651025476
year.L -0.0472714062
year.Q -0.0136371535
year.C -0.0070390298
year^4 -0.0581967323
year^5 0.0935735582
year^6 -0.0527897574
year^7 -0.0205483915
year^8 0.0460415848
year^9 0.0054649678
year^10 -0.0359025295
year^11 0.0127170490

Source: Created by the authors.

Code
mbepr_beipr_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.01219855648,0.01219855648]
#> (score -78439.24791 & scale 1).
#> Hessian positive definite, eigenvalue range [30826.9659,30826.9659].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 177: Diagnostics for the mbepr_beipr_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 178: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_5 <- mgcv::gam(
  maper ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_5 |> summary()
#> 
#> Family: Beta regression(24.482) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error     z value             Pr(>|z|)    
#> (Intercept) -3.671007620  0.003548104 -1034.63917           < 2.22e-16 ***
#> year.L       0.027842144  0.012368692     2.25102            0.0243844 *  
#> year.Q      -0.134341841  0.012419112   -10.81735           < 2.22e-16 ***
#> year.C      -0.082483360  0.012340935    -6.68372 0.000000000023295072 ***
#> year^4      -0.080548801  0.012313726    -6.54138 0.000000000060952495 ***
#> year^5       0.079273119  0.012318076     6.43551 0.000000000123058147 ***
#> year^6       0.024429920  0.012282057     1.98907            0.0466930 *  
#> year^7       0.035558528  0.012236630     2.90591            0.0036619 ** 
#> year^8       0.092660310  0.012200680     7.59468 0.000000000000030854 ***
#> year^9      -0.006557267  0.012197699    -0.53758            0.5908655    
#> year^10     -0.025618488  0.012238256    -2.09331            0.0363213 *  
#> year^11      0.011818501  0.012283076     0.96218            0.3359604    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00149   Deviance explained = 0.495%
#> -REML = -1.752e+05  Scale est. = 1         n = 62762
Code
maper_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 172: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_5 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 173: Summary statistics of the maper_gam_5 model.
Value
df 12.0000000000
logLik 175246.8729737456
AIC -350467.7459474911
BIC -350350.1335815321
deviance 67168.5892269482
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0014912039
npar 12.0000000000

Source: Created by the authors.

Code
maper_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 174: Value of the coefficients in the maper_gam_5 model.
Value
[Mean] -0.3107479047
mean((Intercept)) -3.6710076200
year.L 0.0278421438
year.Q -0.1343418412
year.C -0.0824833604
year^4 -0.0805488010
year^5 0.0792731188
year^6 0.0244299196
year^7 0.0355585277
year^8 0.0926603095
year^9 -0.0065572665
year^10 -0.0256184884
year^11 0.0118185012

Source: Created by the authors.

Code
maper_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 4 iterations.
#> Gradient range [0.0000105819692,0.0000105819692]
#> (score -175203.8687 & scale 1).
#> Hessian positive definite, eigenvalue range [21654.98712,21654.98712].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 179: Diagnostics for the maper_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 180: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_5 <- mgcv::gam(
  mpepr ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_5 |> summary()
#> 
#> Family: Beta regression(30.606) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error     z value       Pr(>|z|)    
#> (Intercept) -3.531198908  0.003292509 -1072.49476     < 2.22e-16 ***
#> year.L       0.153669624  0.011448326    13.42289     < 2.22e-16 ***
#> year.Q      -0.049777612  0.011560586    -4.30580 0.000016638072 ***
#> year.C      -0.061042356  0.011439084    -5.33630 0.000000094864 ***
#> year^4      -0.152562348  0.011424506   -13.35396     < 2.22e-16 ***
#> year^5       0.023769084  0.011408711     2.08342      0.0372134 *  
#> year^6       0.053608763  0.011388065     4.70745 0.000002508330 ***
#> year^7       0.032808996  0.011321353     2.89797      0.0037558 ** 
#> year^8       0.051603530  0.011292849     4.56958 0.000004887127 ***
#> year^9      -0.007970576  0.011315547    -0.70439      0.4811890    
#> year^10      0.012958743  0.011360197     1.14071      0.2539887    
#> year^11      0.021167522  0.011499317     1.84076      0.0656562 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0125   Deviance explained = 0.712%
#> -REML = -1.6102e+05  Scale est. = 1         n = 62762
Code
mpepr_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 175: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_5 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mpepr_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 176: Summary statistics of the mpepr_gam_5 model.
Value
df 12.0000000000
logLik 161065.5110249491
AIC -322105.0220498982
BIC -321987.4096839392
deviance 67283.6524796425
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0125163328
npar 12.0000000000

Source: Created by the authors.

Code
mpepr_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 177: Value of the coefficients in the mpepr_gam_5 model.
Value
[Mean] -0.2877471282
mean((Intercept)) -3.5311989080
year.L 0.1536696243
year.Q -0.0497776119
year.C -0.0610423562
year^4 -0.1525623482
year^5 0.0237690842
year^6 0.0536087631
year^7 0.0328089956
year^8 0.0516035296
year^9 -0.0079705756
year^10 0.0129587426
year^11 0.0211675220

Source: Created by the authors.

Code
mpepr_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 3 iterations.
#> Gradient range [0.06495643988,0.06495643988]
#> (score -161021.6064 & scale 1).
#> Hessian positive definite, eigenvalue range [24663.52749,24663.52749].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 181: Diagnostics for the mpepr_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 182: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_5 <- mgcv::gam(
  maper_mpepr ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_5 |> summary()
#> 
#> Family: Beta regression(20.406) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -2.877375499  0.003155866 -911.75453         < 2.22e-16 ***
#> year.L       0.013586860  0.010994060    1.23584            0.21652    
#> year.Q      -0.078213051  0.011085949   -7.05515 0.0000000000017241 ***
#> year.C      -0.070927872  0.010973416   -6.46361 0.0000000001022349 ***
#> year^4      -0.128530430  0.010948898  -11.73912         < 2.22e-16 ***
#> year^5       0.046957484  0.010954014    4.28678 0.0000181278821559 ***
#> year^6       0.047973032  0.010925669    4.39086 0.0000112905702940 ***
#> year^7       0.056102588  0.010852567    5.16952 0.0000002346931480 ***
#> year^8       0.076581290  0.010814002    7.08168 0.0000000000014242 ***
#> year^9      -0.008376653  0.010832943   -0.77326            0.43937    
#> year^10      0.006769788  0.010884854    0.62195            0.53398    
#> year^11      0.004430077  0.010985307    0.40327            0.68675    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.000592   Deviance explained = 0.552%
#> -REML = -1.2164e+05  Scale est. = 1         n = 62762
Code
maper_mpepr_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 178: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_5 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 179: Summary statistics of the maper_mpepr_gam_5 model.
Value
df 12.0000000000
logLik 121681.2905335238
AIC -243336.5810670477
BIC -243218.9687010887
deviance 64886.5484799453
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0005918146
npar 12.0000000000

Source: Created by the authors.

Code
maper_mpepr_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 180: Value of the coefficients in the maper_mpepr_gam_5 model.
Value
[Mean] -0.2425851988
mean((Intercept)) -2.8773754994
year.L 0.0135868602
year.Q -0.0782130509
year.C -0.0709278716
year^4 -0.1285304305
year^5 0.0469574842
year^6 0.0479730318
year^7 0.0561025880
year^8 0.0765812902
year^9 -0.0083766531
year^10 0.0067697882
year^11 0.0044300767

Source: Created by the authors.

Code
maper_mpepr_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 4 iterations.
#> Gradient range [0.1322078474,0.1322078474]
#> (score -121636.8789 & scale 1).
#> Hessian positive definite, eigenvalue range [26961.29141,26961.29141].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 183: Diagnostics for the maper_mpepr_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 184: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By year (Unordered)

In this model, the year variable is treated as a unordered categorical variable.

Code
mbepr_gam_6 <- mgcv::gam(
  mbepr ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_6 |> summary()
#> 
#> Family: Beta regression(17.638) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value             Pr(>|z|)    
#> (Intercept) -2.95978829  0.01184997 -249.77179           < 2.22e-16 ***
#> year2009     0.18581894  0.01623717   11.44404           < 2.22e-16 ***
#> year2010     0.19650008  0.01620364   12.12691           < 2.22e-16 ***
#> year2011     0.11636277  0.01634690    7.11834 0.000000000001092351 ***
#> year2012     0.07206778  0.01640557    4.39288 0.000011185640406729 ***
#> year2013     0.16526735  0.01635417   10.10552           < 2.22e-16 ***
#> year2014     0.21516820  0.01625094   13.24035           < 2.22e-16 ***
#> year2015     0.14714754  0.01632144    9.01560           < 2.22e-16 ***
#> year2016     0.20560208  0.01618365   12.70431           < 2.22e-16 ***
#> year2017     0.15465732  0.01628361    9.49773           < 2.22e-16 ***
#> year2018     0.12309673  0.01633175    7.53727 0.000000000000047993 ***
#> year2019     0.09907351  0.01632576    6.06854 0.000000001290783738 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00327   Deviance explained = 0.525%
#> -REML = -1.1795e+05  Scale est. = 1         n = 62762
Code
mbepr_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 181: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_6 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mbepr_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 182: Summary statistics of the mbepr_gam_6 model.
Value
df 12.0000000000
logLik 117994.6877479886
AIC -235963.3754959772
BIC -235845.7631300182
deviance 64485.5210188823
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0032733397
npar 12.0000000000

Source: Created by the authors.

Code
mbepr_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 183: Value of the coefficients in the mbepr_gam_6 model.
Value
[Mean] -0.1065854982
mean((Intercept)) -2.9597882866
year2009 0.1858189412
year2010 0.1965000821
year2011 0.1163627678
year2012 0.0720677836
year2013 0.1652673488
year2014 0.2151681982
year2015 0.1471475383
year2016 0.2056020840
year2017 0.1546573211
year2018 0.1230967302
year2019 0.0990735131

Source: Created by the authors.

Code
mbepr_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.00000119875011,0.00000119875011]
#> (score -117951.854 & scale 1).
#> Hessian positive definite, eigenvalue range [26571.0456,26571.0456].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 185: Diagnostics for the mbepr_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 186: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_6 <- mgcv::gam(
  beipr ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_6 |> summary()
#> 
#> Family: Beta regression(25.798) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.722549043  0.009951744 -273.57506 < 2.22e-16 ***
#> year2009     0.093774149  0.013717615    6.83604 8.1413e-12 ***
#> year2010     0.106949012  0.013679330    7.81829 5.3544e-15 ***
#> year2011     0.025696817  0.013841904    1.85645   0.063389 .  
#> year2012    -0.037917921  0.013952806   -2.71758   0.006576 ** 
#> year2013     0.070849601  0.013832071    5.12213 3.0211e-07 ***
#> year2014     0.080692900  0.013799146    5.84767 4.9850e-09 ***
#> year2015     0.124328975  0.013673487    9.09270 < 2.22e-16 ***
#> year2016     0.085008464  0.013717882    6.19691 5.7583e-10 ***
#> year2017     0.121341258  0.013658424    8.88399 < 2.22e-16 ***
#> year2018     0.117922729  0.013660107    8.63264 < 2.22e-16 ***
#> year2019     0.093714562  0.013667701    6.85664 7.0497e-12 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00784   Deviance explained = 0.52%
#> -REML = -1.1332e+05  Scale est. = 1         n = 62762
Code
beipr_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 184: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_6 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
beipr_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 185: Summary statistics of the beipr_gam_6 model.
Value
df 12.0000000000
logLik 113362.5968849338
AIC -226699.1937698676
BIC -226581.5814039086
deviance 63831.4178238829
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0078397415
npar 12.0000000000

Source: Created by the authors.

Code
beipr_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 186: Value of the coefficients in the beipr_gam_6 model.
Value
[Mean] -0.1533490415
mean((Intercept)) -2.7225490430
year2009 0.0937741492
year2010 0.1069490117
year2011 0.0256968171
year2012 -0.0379179214
year2013 0.0708496009
year2014 0.0806929002
year2015 0.1243289749
year2016 0.0850084637
year2017 0.1213412578
year2018 0.1179227286
year2019 0.0937145617

Source: Created by the authors.

Code
beipr_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.000008758086041,0.000008758086041]
#> (score -113317.7701 & scale 1).
#> Hessian positive definite, eigenvalue range [29161.5517,29161.5517].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 187: Diagnostics for the beipr_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 188: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_6 <- mgcv::gam(
  mbepr_beipr ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_6 |> summary()
#> 
#> Family: Beta regression(16.296) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -1.998038053  0.009599818 -208.13291         < 2.22e-16 ***
#> year2009     0.115589875  0.013212260    8.74868         < 2.22e-16 ***
#> year2010     0.093268110  0.013236994    7.04602 0.0000000000018411 ***
#> year2011     0.020589852  0.013365365    1.54054         0.12342928    
#> year2012    -0.046723027  0.013469180   -3.46888         0.00052262 ***
#> year2013     0.042609937  0.013403990    3.17890         0.00147835 ** 
#> year2014     0.068768866  0.013345526    5.15295 0.0000002564166243 ***
#> year2015     0.035954417  0.013361657    2.69087         0.00712670 ** 
#> year2016     0.032964579  0.013335521    2.47194         0.01343829 *  
#> year2017     0.027139886  0.013355914    2.03205         0.04214858 *  
#> year2018     0.009562646  0.013381355    0.71462         0.47484103    
#> year2019    -0.004499079  0.013366541   -0.33659         0.73642405    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00446   Deviance explained = 0.406%
#> -REML = -78440  Scale est. = 1         n = 62762
Code
mbepr_beipr_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 187: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_6 model.
Value Interpretation Rule
R2 0.0044644574 very weak (negligible) cohen1988
SE 0.0005310049 NA NA
Lower CI 0.0034237070 very weak (negligible) cohen1988
Upper CI 0.0055052078 very weak (negligible) cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 188: Summary statistics of the mbepr_beipr_gam_6 model.
Value
df 12.0000000000
logLik 78485.5946634255
AIC -156945.1893268510
BIC -156827.5769608920
deviance 61789.7893367161
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared 0.0044644574
npar 12.0000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 189: Value of the coefficients in the mbepr_beipr_gam_6 model.
Value
[Mean] -0.1335676658
mean((Intercept)) -1.9980380529
year2009 0.1155898751
year2010 0.0932681104
year2011 0.0205898519
year2012 -0.0467230271
year2013 0.0426099372
year2014 0.0687688662
year2015 0.0359544170
year2016 0.0329645792
year2017 0.0271398862
year2018 0.0095626455
year2019 -0.0044990787

Source: Created by the authors.

Code
mbepr_beipr_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.01219855661,0.01219855661]
#> (score -78440.49037 & scale 1).
#> Hessian positive definite, eigenvalue range [30826.9659,30826.9659].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 189: Diagnostics for the mbepr_beipr_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 190: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_6 <- mgcv::gam(
  maper ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_6 |> summary()
#> 
#> Family: Beta regression(24.482) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value             Pr(>|z|)    
#> (Intercept) -3.758990530  0.012747837 -294.87282           < 2.22e-16 ***
#> year2009     0.083861654  0.017695514    4.73915 0.000002146191308382 ***
#> year2010     0.126540065  0.017619775    7.18171 0.000000000000688463 ***
#> year2011     0.058108129  0.017719687    3.27930            0.0010407 ** 
#> year2012     0.030105437  0.017738763    1.69716            0.0896673 .  
#> year2013     0.124723975  0.017728977    7.03504 0.000000000001992108 ***
#> year2014     0.134593862  0.017697517    7.60524 0.000000000000028438 ***
#> year2015     0.119405131  0.017665879    6.75908 0.000000000013886856 ***
#> year2016     0.174963896  0.017546352    9.97153           < 2.22e-16 ***
#> year2017     0.190981494  0.017536505   10.89051           < 2.22e-16 ***
#> year2018     0.015059851  0.017772131    0.84739            0.3967802    
#> year2019    -0.002548577  0.017742683   -0.14364            0.8857840    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00149   Deviance explained = 0.495%
#> -REML = -1.7521e+05  Scale est. = 1         n = 62762
Code
maper_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 190: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_6 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 191: Summary statistics of the maper_gam_6 model.
Value
df 12.0000000000
logLik 175246.8729737457
AIC -350467.7459474914
BIC -350350.1335815324
deviance 67168.5892269479
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0014912039
npar 12.0000000000

Source: Created by the authors.

Code
maper_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 192: Value of the coefficients in the maper_gam_6 model.
Value
[Mean] -0.2252663011
mean((Intercept)) -3.7589905297
year2009 0.0838616542
year2010 0.1265400648
year2011 0.0581081288
year2012 0.0301054374
year2013 0.1247239748
year2014 0.1345938625
year2015 0.1194051310
year2016 0.1749638956
year2017 0.1909814936
year2018 0.0150598506
year2019 -0.0025485765

Source: Created by the authors.

Code
maper_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 4 iterations.
#> Gradient range [0.00001058207839,0.00001058207839]
#> (score -175205.1112 & scale 1).
#> Hessian positive definite, eigenvalue range [21654.98712,21654.98712].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 191: Diagnostics for the maper_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 192: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_6 <- mgcv::gam(
  mpepr ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_6 |> summary()
#> 
#> Family: Beta regression(30.606) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value         Pr(>|z|)    
#> (Intercept) -3.65301970  0.01197372 -305.08648       < 2.22e-16 ***
#> year2009     0.08052386  0.01658941    4.85393 0.00000121037627 ***
#> year2010     0.14196333  0.01646757    8.62078       < 2.22e-16 ***
#> year2011     0.09031173  0.01656285    5.45267 0.00000004961916 ***
#> year2012     0.06937855  0.01658203    4.18396 0.00002864737535 ***
#> year2013     0.09082284  0.01665623    5.45278 0.00000004958750 ***
#> year2014     0.07948343  0.01665956    4.77104 0.00000183275897 ***
#> year2015     0.14890933  0.01648873    9.03098       < 2.22e-16 ***
#> year2016     0.21623256  0.01633233   13.23954       < 2.22e-16 ***
#> year2017     0.28393957  0.01622278   17.50252       < 2.22e-16 ***
#> year2018     0.15693014  0.01644361    9.54353       < 2.22e-16 ***
#> year2019     0.10335415  0.01648944    6.26790 0.00000000036595 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0125   Deviance explained = 0.712%
#> -REML = -1.6102e+05  Scale est. = 1         n = 62762
Code
mpepr_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 193: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_6 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mpepr_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 194: Summary statistics of the mpepr_gam_6 model.
Value
df 12.0000000000
logLik 161065.5110249493
AIC -322105.0220498986
BIC -321987.4096839396
deviance 67283.6524796410
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0125163328
npar 12.0000000000

Source: Created by the authors.

Code
mpepr_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 195: Value of the coefficients in the mpepr_gam_6 model.
Value
[Mean] -0.1825975171
mean((Intercept)) -3.6530196992
year2009 0.0805238602
year2010 0.1419633321
year2011 0.0903117322
year2012 0.0693785534
year2013 0.0908228362
year2014 0.0794834342
year2015 0.1489093298
year2016 0.2162325595
year2017 0.2839395689
year2018 0.1569301378
year2019 0.1033541501

Source: Created by the authors.

Code
mpepr_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 3 iterations.
#> Gradient range [0.06495643969,0.06495643969]
#> (score -161022.8488 & scale 1).
#> Hessian positive definite, eigenvalue range [24663.52749,24663.52749].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 193: Diagnostics for the mpepr_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 194: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_6 <- mgcv::gam(
  maper_mpepr ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_6 |> summary()
#> 
#> Family: Beta regression(20.406) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value             Pr(>|z|)    
#> (Intercept) -2.94365857  0.01135972 -259.13115           < 2.22e-16 ***
#> year2009     0.07932584  0.01572402    5.04488 0.000000453801089922 ***
#> year2010     0.12042580  0.01563447    7.70258 0.000000000000013334 ***
#> year2011     0.04361417  0.01577935    2.76400           0.00570971 ** 
#> year2012     0.03529717  0.01577849    2.23704           0.02528347 *  
#> year2013     0.05934068  0.01584106    3.74601           0.00017967 ***
#> year2014     0.05298592  0.01583706    3.34569           0.00082078 ***
#> year2015     0.07218084  0.01575428    4.58166 0.000004612884552903 ***
#> year2016     0.14183664  0.01559137    9.09713           < 2.22e-16 ***
#> year2017     0.19522378  0.01550575   12.59041           < 2.22e-16 ***
#> year2018     0.01346871  0.01583000    0.85083           0.39486145    
#> year2019    -0.01830271  0.01584025   -1.15546           0.24790357    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.000592   Deviance explained = 0.552%
#> -REML = -1.2164e+05  Scale est. = 1         n = 62762
Code
maper_mpepr_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 196: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_6 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 197: Summary statistics of the maper_mpepr_gam_6 model.
Value
df 12.0000000000
logLik 121681.2905335242
AIC -243336.5810670483
BIC -243218.9687010893
deviance 64886.5484799459
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0005918146
npar 12.0000000000

Source: Created by the authors.

Code
maper_mpepr_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 198: Value of the coefficients in the maper_mpepr_gam_6 model.
Value
[Mean] -0.1790218116
mean((Intercept)) -2.9436585686
year2009 0.0793258356
year2010 0.1204258006
year2011 0.0436141695
year2012 0.0352971701
year2013 0.0593406827
year2014 0.0529859157
year2015 0.0721808446
year2016 0.1418366420
year2017 0.1952237764
year2018 0.0134687055
year2019 -0.0183027132

Source: Created by the authors.

Code
maper_mpepr_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 4 iterations.
#> Gradient range [0.132207848,0.132207848]
#> (score -121638.1214 & scale 1).
#> Hessian positive definite, eigenvalue range [26961.29141,26961.29141].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 195: Diagnostics for the maper_mpepr_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 196: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Modeling the Data by MISFS-R Clusters

By s(spei_12m) + te(gini_index, gdp_per_capita) + s(year) (Continuous year)

Code
mbepr_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mbepr_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(20.729) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.795643059  0.009044634 -309.0941 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df   Chi.sq    p-value    
#> s(spei_12m)                    2.625152  3.352185  17.1662  0.0012556 ** 
#> te(gini_index,gdp_per_capita) 15.262067 17.108138 716.3053 < 2.22e-16 ***
#> s(year)                        7.362562  8.341109 202.9105 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0217   Deviance explained = 11.4%
#> -REML = -13718  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.166797819e-2 weak                   cohen1988
#> 2 SE       3.230899836e-3 <NA>                   <NA>     
#> 3 Lower CI 1.533553088e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.800042551e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.624978141e+1
#> 2 logLik         1.377316453e+4
#> 3 AIC           -2.748483049e+4
#> 4 BIC           -2.727291720e+4
#> 5 deviance       7.430278253e+3
#> 6 df.residual    7.244750219e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  2.166797819e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.930966462e-1
#>  2 mean((Intercept))                   -2.795643059e+0
#>  3 mean(s(spei_12m))                   -5.487167850e-3
#>  4 mean(te(gini_index,gdp_per_capita)) -2.884305081e-1
#>  5 mean(s(year))                        1.626893310e-1
#>  6 s(spei_12m).1                       -3.430376599e-2
#>  7 s(spei_12m).2                       -1.126565527e-2
#>  8 s(spei_12m).3                       -3.089171470e-3
#>  9 s(spei_12m).4                       -1.391367581e-3
#> 10 s(spei_12m).5                        7.230169004e-4
#> 11 s(spei_12m).6                       -1.212338684e-3
#> 12 s(spei_12m).7                        9.005620330e-4
#> 13 s(spei_12m).8                       -1.768014887e-2
#> 14 s(spei_12m).9                        1.793435828e-2
#> 15 te(gini_index,gdp_per_capita).1     -7.813926375e-1
#> 16 te(gini_index,gdp_per_capita).2     -7.919154701e-1
#> 17 te(gini_index,gdp_per_capita).3     -7.559748361e-1
#> 18 te(gini_index,gdp_per_capita).4     -1.468972207e+0
#> 19 te(gini_index,gdp_per_capita).5      2.668087472e-2
#> 20 te(gini_index,gdp_per_capita).6      2.776966086e-1
#> 21 te(gini_index,gdp_per_capita).7     -5.257188554e-1
#> 22 te(gini_index,gdp_per_capita).8      3.992474149e-1
#> 23 te(gini_index,gdp_per_capita).9     -1.828117936e+0
#> 24 te(gini_index,gdp_per_capita).10     3.126946553e-1
#> 25 te(gini_index,gdp_per_capita).11     2.010032678e-1
#> 26 te(gini_index,gdp_per_capita).12    -1.034441610e-1
#> 27 te(gini_index,gdp_per_capita).13     1.938034274e-1
#> 28 te(gini_index,gdp_per_capita).14    -1.981428611e+0
#> 29 te(gini_index,gdp_per_capita).15     5.697863072e-1
#> 30 te(gini_index,gdp_per_capita).16     4.735679131e-1
#> 31 te(gini_index,gdp_per_capita).17    -7.090321662e-2
#> 32 te(gini_index,gdp_per_capita).18     3.329906253e-1
#> 33 te(gini_index,gdp_per_capita).19    -2.177282976e+0
#> 34 te(gini_index,gdp_per_capita).20     1.296473777e+0
#> 35 te(gini_index,gdp_per_capita).21     1.083801882e+0
#> 36 te(gini_index,gdp_per_capita).22     8.943491071e-1
#> 37 te(gini_index,gdp_per_capita).23     8.249366727e-1
#> 38 te(gini_index,gdp_per_capita).24    -3.324213821e+0
#> 39 s(year).1                           -1.450876069e-1
#> 40 s(year).2                            4.342185400e-1
#> 41 s(year).3                            4.566024520e-1
#> 42 s(year).4                           -4.540194677e-1
#> 43 s(year).5                           -9.075791317e-2
#> 44 s(year).6                           -1.808896566e-1
#> 45 s(year).7                           -1.291800244e-1
#> 46 s(year).8                            8.953645937e-1
#> 47 s(year).9                            6.779530617e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    1.223297314e-24  0.5789015684           0.3501118687  0.6460694532
#> 2 observed 1.223297314e-24  0.5503208582           0.05499552123 0.5041504295
#> 3 estimate 1.223297314e-24  0.4778441467           0.01041126877 0.4377095149
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.439) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.102250572  0.004988525 -621.8773 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    7.517764  8.474534   81.86783 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.251790 19.306294 2283.08647 < 2.22e-16 ***
#> s(year)                        8.417152  8.901870  429.00344 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.021   Deviance explained = 9.53%
#> -REML = -63796  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.518670533e+1
#> 2 logLik         6.388686557e+4
#> 3 AIC           -1.276963657e+5
#> 4 BIC           -1.273762044e+5
#> 5 deviance       3.045153026e+4
#> 6 df.residual    2.900981329e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -2.098637332e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -7.463124605e-2
#>  2 mean((Intercept))                   -3.102250572e+0
#>  3 mean(s(spei_12m))                    2.984465222e-2
#>  4 mean(te(gini_index,gdp_per_capita)) -7.116716275e-2
#>  5 mean(s(year))                        1.480574475e-1
#>  6 s(spei_12m).1                        1.294476636e-1
#>  7 s(spei_12m).2                        3.997800169e-2
#>  8 s(spei_12m).3                        1.405800878e-3
#>  9 s(spei_12m).4                        3.980934034e-2
#> 10 s(spei_12m).5                       -6.162655462e-2
#> 11 s(spei_12m).6                        9.999364729e-2
#> 12 s(spei_12m).7                       -5.697720159e-2
#> 13 s(spei_12m).8                       -9.282737944e-2
#> 14 s(spei_12m).9                        1.693985518e-1
#> 15 te(gini_index,gdp_per_capita).1     -1.117481278e+0
#> 16 te(gini_index,gdp_per_capita).2     -1.430371419e+0
#> 17 te(gini_index,gdp_per_capita).3     -1.479994779e+0
#> 18 te(gini_index,gdp_per_capita).4      7.639957688e+0
#> 19 te(gini_index,gdp_per_capita).5      2.097924344e-1
#> 20 te(gini_index,gdp_per_capita).6      1.928250857e-1
#> 21 te(gini_index,gdp_per_capita).7     -4.094456445e-1
#> 22 te(gini_index,gdp_per_capita).8      2.438300958e-1
#> 23 te(gini_index,gdp_per_capita).9      2.713363889e+0
#> 24 te(gini_index,gdp_per_capita).10     5.898977531e-1
#> 25 te(gini_index,gdp_per_capita).11     2.368682044e-1
#> 26 te(gini_index,gdp_per_capita).12    -6.258269364e-2
#> 27 te(gini_index,gdp_per_capita).13     1.773161102e-1
#> 28 te(gini_index,gdp_per_capita).14     1.007606960e+0
#> 29 te(gini_index,gdp_per_capita).15     6.564005760e-1
#> 30 te(gini_index,gdp_per_capita).16     5.481555689e-1
#> 31 te(gini_index,gdp_per_capita).17    -2.456899455e-1
#> 32 te(gini_index,gdp_per_capita).18     7.011390645e-1
#> 33 te(gini_index,gdp_per_capita).19    -6.511962151e-1
#> 34 te(gini_index,gdp_per_capita).20     9.230225083e-1
#> 35 te(gini_index,gdp_per_capita).21    -3.855274353e-1
#> 36 te(gini_index,gdp_per_capita).22    -1.174078296e+0
#> 37 te(gini_index,gdp_per_capita).23    -1.210255973e+0
#> 38 te(gini_index,gdp_per_capita).24    -9.381564164e+0
#> 39 s(year).1                           -5.251835013e-2
#> 40 s(year).2                            6.814330260e-1
#> 41 s(year).3                            3.110073811e-1
#> 42 s(year).4                           -5.828026928e-1
#> 43 s(year).5                           -8.931160612e-2
#> 44 s(year).6                           -2.236123138e-1
#> 45 s(year).7                           -2.098684515e-1
#> 46 s(year).8                            1.188563753e+0
#> 47 s(year).9                            3.096262816e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    3.135124790e-24  0.4386344126          2.754406321e-1 0.5079354649
#> 2 observed 3.135124790e-24  0.2157212095          6.229402277e-2 0.2038108022
#> 3 estimate 3.135124790e-24  0.3128056866          3.775205272e-3 0.3758159024
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(42.04) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.623998734  0.004146837 -632.7711 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq  p-value    
#> s(spei_12m)                    7.939121  8.712967   85.85996  < 2e-16 ***
#> te(gini_index,gdp_per_capita) 16.128292 17.479877 1132.03956  < 2e-16 ***
#> s(year)                        1.407890  1.697712    6.45912 0.068373 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0671   Deviance explained =  7.5%
#> -REML = -36310  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       6.706232381e-2 weak           cohen1988
#> 2 SE       3.388273257e-3 <NA>           <NA>     
#> 3 Lower CI 6.042143026e-2 weak           cohen1988
#> 4 Upper CI 7.370321737e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.647530313e+1
#> 2 logLik         3.637660887e+4
#> 3 AIC           -7.269343663e+4
#> 4 BIC           -7.245931318e+4
#> 5 deviance       1.814542990e+4
#> 6 df.residual    1.860652470e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  6.706232381e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               8.400488773e-2
#>  2 mean((Intercept))                   -2.623998734e+0
#>  3 mean(s(spei_12m))                    4.501615748e-3
#>  4 mean(te(gini_index,gdp_per_capita))  2.575394181e-1
#>  5 mean(s(year))                        1.638703272e-3
#>  6 s(spei_12m).1                        3.236621012e-3
#>  7 s(spei_12m).2                       -2.437321784e-2
#>  8 s(spei_12m).3                        2.634296172e-2
#>  9 s(spei_12m).4                       -6.571784403e-2
#> 10 s(spei_12m).5                        4.729100183e-2
#> 11 s(spei_12m).6                       -5.286260423e-2
#> 12 s(spei_12m).7                        1.074882038e-1
#> 13 s(spei_12m).8                       -1.670701926e-1
#> 14 s(spei_12m).9                        1.661796121e-1
#> 15 te(gini_index,gdp_per_capita).1     -7.854839569e-1
#> 16 te(gini_index,gdp_per_capita).2     -7.593964609e-1
#> 17 te(gini_index,gdp_per_capita).3     -6.948372706e-1
#> 18 te(gini_index,gdp_per_capita).4     -7.253412803e+0
#> 19 te(gini_index,gdp_per_capita).5      1.590780060e-1
#> 20 te(gini_index,gdp_per_capita).6      1.050882823e-1
#> 21 te(gini_index,gdp_per_capita).7     -3.068315843e-1
#> 22 te(gini_index,gdp_per_capita).8      2.095167534e-1
#> 23 te(gini_index,gdp_per_capita).9     -1.418373653e+0
#> 24 te(gini_index,gdp_per_capita).10     3.698354079e-1
#> 25 te(gini_index,gdp_per_capita).11     8.033403794e-2
#> 26 te(gini_index,gdp_per_capita).12    -4.055628616e-2
#> 27 te(gini_index,gdp_per_capita).13    -1.510066888e-2
#> 28 te(gini_index,gdp_per_capita).14     2.866002552e-1
#> 29 te(gini_index,gdp_per_capita).15     7.694747718e-1
#> 30 te(gini_index,gdp_per_capita).16     4.138644192e-1
#> 31 te(gini_index,gdp_per_capita).17    -4.073844682e-1
#> 32 te(gini_index,gdp_per_capita).18     5.147829413e-1
#> 33 te(gini_index,gdp_per_capita).19     2.054108195e+0
#> 34 te(gini_index,gdp_per_capita).20     5.513293915e-1
#> 35 te(gini_index,gdp_per_capita).21     1.903922664e-1
#> 36 te(gini_index,gdp_per_capita).22     7.985740129e-2
#> 37 te(gini_index,gdp_per_capita).23     7.458043600e-2
#> 38 te(gini_index,gdp_per_capita).24     1.200348062e+1
#> 39 s(year).1                            8.209007339e-4
#> 40 s(year).2                            9.493248238e-4
#> 41 s(year).3                            8.775062508e-5
#> 42 s(year).4                            3.390150129e-4
#> 43 s(year).5                           -5.241935498e-5
#> 44 s(year).6                            5.217397152e-4
#> 45 s(year).7                            1.882983332e-4
#> 46 s(year).8                           -3.591497780e-3
#> 47 s(year).9                            1.548521734e-2
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.588613525e-24  0.8429077979          5.455094612e-1 0.8634520043
#> 2 observed 2.588613525e-24  0.5753785552          1.303415876e-1 0.6524882764
#> 3 estimate 2.588613525e-24  0.6993780697          5.125519725e-3 0.6055875044
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(37.786) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.28815574  0.01047845 -218.3677 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq  p-value    
#> s(spei_12m)                    3.458935  4.363734   9.53110 0.062841 .  
#> te(gini_index,gdp_per_capita) 11.254200 13.340333 170.35860  < 2e-16 ***
#> s(year)                        6.745836  7.842378  20.11156 0.012298 *  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0993   Deviance explained = 11.9%
#> -REML = -4363.1  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.09928736713 weak           cohen1988
#> 2 SE       0.01075978781 <NA>           <NA>     
#> 3 Lower CI 0.07819857054 weak           cohen1988
#> 4 Upper CI 0.1203761637  weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.245897130e+1
#> 2 logLik         4.406544281e+3
#> 3 AIC           -8.757995671e+3
#> 4 BIC           -8.597148347e+3
#> 5 deviance       2.445576755e+3
#> 6 df.residual    2.515541029e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  9.928736713e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -6.422692342e-2
#>  2 mean((Intercept))                   -2.288155742e+0
#>  3 mean(s(spei_12m))                    1.003389163e-2
#>  4 mean(te(gini_index,gdp_per_capita)) -3.672762514e-2
#>  5 mean(s(year))                        3.528400144e-2
#>  6 s(spei_12m).1                       -6.011113534e-2
#>  7 s(spei_12m).2                        6.485059761e-2
#>  8 s(spei_12m).3                        1.415323563e-3
#>  9 s(spei_12m).4                       -1.550120963e-2
#> 10 s(spei_12m).5                       -9.271655262e-3
#> 11 s(spei_12m).6                        2.137636431e-2
#> 12 s(spei_12m).7                        2.566741612e-3
#> 13 s(spei_12m).8                        1.300486532e-1
#> 14 s(spei_12m).9                       -4.506865532e-2
#> 15 te(gini_index,gdp_per_capita).1      4.666552047e-2
#> 16 te(gini_index,gdp_per_capita).2     -8.130537091e-2
#> 17 te(gini_index,gdp_per_capita).3     -1.427673545e-1
#> 18 te(gini_index,gdp_per_capita).4     -2.090337397e+0
#> 19 te(gini_index,gdp_per_capita).5      4.842679971e-1
#> 20 te(gini_index,gdp_per_capita).6     -1.617331765e-1
#> 21 te(gini_index,gdp_per_capita).7      1.313062364e-1
#> 22 te(gini_index,gdp_per_capita).8     -4.131549058e-1
#> 23 te(gini_index,gdp_per_capita).9     -9.355616176e-1
#> 24 te(gini_index,gdp_per_capita).10     4.711012128e-1
#> 25 te(gini_index,gdp_per_capita).11     1.982728604e-2
#> 26 te(gini_index,gdp_per_capita).12     5.380356245e-2
#> 27 te(gini_index,gdp_per_capita).13    -1.849290278e-1
#> 28 te(gini_index,gdp_per_capita).14    -6.055423680e-1
#> 29 te(gini_index,gdp_per_capita).15     4.312181056e-1
#> 30 te(gini_index,gdp_per_capita).16    -5.324876961e-2
#> 31 te(gini_index,gdp_per_capita).17     1.299517607e-1
#> 32 te(gini_index,gdp_per_capita).18    -3.742066083e-1
#> 33 te(gini_index,gdp_per_capita).19    -2.075070108e-1
#> 34 te(gini_index,gdp_per_capita).20     2.419593495e-1
#> 35 te(gini_index,gdp_per_capita).21     3.104778935e-1
#> 36 te(gini_index,gdp_per_capita).22     2.729312890e-1
#> 37 te(gini_index,gdp_per_capita).23     6.400385850e-2
#> 38 te(gini_index,gdp_per_capita).24     1.711316531e+0
#> 39 s(year).1                            1.486357195e-2
#> 40 s(year).2                            6.266042012e-2
#> 41 s(year).3                            1.604609443e-1
#> 42 s(year).4                           -2.187380413e-1
#> 43 s(year).5                            5.521070808e-3
#> 44 s(year).6                            4.122053216e-2
#> 45 s(year).7                           -4.348998186e-2
#> 46 s(year).8                            1.730840398e-1
#> 47 s(year).9                            1.219734571e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.623684980e-25  0.5766265013          4.569162593e-1 0.6028488674
#> 2 observed 2.623684980e-25  0.3738038289          3.268166092e-1 0.1008586203
#> 3 estimate 2.623684980e-25  0.4331896267          9.220398167e-3 0.3812821727
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 197: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(beipr_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(29.927) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.679184485  0.007749678 -345.7156 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq     p-value    
#> s(spei_12m)                    4.008906  5.025095   28.59486 0.000029003 ***
#> te(gini_index,gdp_per_capita) 18.321140 19.732295 1107.04780  < 2.22e-16 ***
#> s(year)                        5.247827  6.362810  273.16639  < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.113   Deviance explained = 15.9%
#> -REML = -13621  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       1.126265005e-1 weak           cohen1988
#> 2 SE       6.681204739e-3 <NA>           <NA>     
#> 3 Lower CI 9.953157984e-2 weak           cohen1988
#> 4 Upper CI 1.257214212e-1 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.857787398e+1
#> 2 logLik         1.368966200e+4
#> 3 AIC           -2.731397026e+4
#> 4 BIC           -2.708877272e+4
#> 5 deviance       7.384652757e+3
#> 6 df.residual    7.242422126e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  1.126265005e-1
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.988119945e-1
#>  2 mean((Intercept))                   -2.679184485e+0
#>  3 mean(s(spei_12m))                   -6.275863881e-3
#>  4 mean(te(gini_index,gdp_per_capita)) -2.521729677e-1
#>  5 mean(s(year))                        2.654474686e-2
#>  6 s(spei_12m).1                       -7.816435786e-2
#>  7 s(spei_12m).2                       -7.873479570e-2
#>  8 s(spei_12m).3                        2.479553220e-3
#>  9 s(spei_12m).4                       -2.024754700e-2
#> 10 s(spei_12m).5                       -1.533618028e-2
#> 11 s(spei_12m).6                        2.506515413e-2
#> 12 s(spei_12m).7                       -1.207934153e-2
#> 13 s(spei_12m).8                        1.696711051e-1
#> 14 s(spei_12m).9                       -4.913636505e-2
#> 15 te(gini_index,gdp_per_capita).1     -9.716311011e-1
#> 16 te(gini_index,gdp_per_capita).2     -6.402004849e-1
#> 17 te(gini_index,gdp_per_capita).3     -4.628739390e-1
#> 18 te(gini_index,gdp_per_capita).4      1.323128365e+0
#> 19 te(gini_index,gdp_per_capita).5      3.518020371e-1
#> 20 te(gini_index,gdp_per_capita).6      9.047360727e-2
#> 21 te(gini_index,gdp_per_capita).7     -4.815479778e-1
#> 22 te(gini_index,gdp_per_capita).8      2.910297791e-1
#> 23 te(gini_index,gdp_per_capita).9     -6.862851409e-1
#> 24 te(gini_index,gdp_per_capita).10     5.727064881e-1
#> 25 te(gini_index,gdp_per_capita).11     1.419662814e-1
#> 26 te(gini_index,gdp_per_capita).12    -9.171517126e-2
#> 27 te(gini_index,gdp_per_capita).13     1.474603584e-1
#> 28 te(gini_index,gdp_per_capita).14    -1.449700687e+0
#> 29 te(gini_index,gdp_per_capita).15     7.084891586e-1
#> 30 te(gini_index,gdp_per_capita).16     4.267627532e-1
#> 31 te(gini_index,gdp_per_capita).17    -1.161241199e-2
#> 32 te(gini_index,gdp_per_capita).18     2.842937791e-1
#> 33 te(gini_index,gdp_per_capita).19    -2.235037373e+0
#> 34 te(gini_index,gdp_per_capita).20     7.330143626e-1
#> 35 te(gini_index,gdp_per_capita).21     1.126906336e+0
#> 36 te(gini_index,gdp_per_capita).22     3.730401705e-1
#> 37 te(gini_index,gdp_per_capita).23     4.797906205e-1
#> 38 te(gini_index,gdp_per_capita).24    -6.072411035e+0
#> 39 s(year).1                            9.618514156e-2
#> 40 s(year).2                           -1.122048579e-1
#> 41 s(year).3                            8.844189869e-2
#> 42 s(year).4                           -1.037486026e-2
#> 43 s(year).5                            2.281042539e-2
#> 44 s(year).6                            1.110665283e-2
#> 45 s(year).7                            4.885185680e-3
#> 46 s(year).8                           -1.106377366e-2
#> 47 s(year).9                            1.491169093e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    1.223297314e-24  0.5789015684           0.3501118687  0.6460694532
#> 2 observed 1.223297314e-24  0.5131336181           0.05841313021 0.5408921427
#> 3 estimate 1.223297314e-24  0.4778441467           0.01041126877 0.4377095149
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(26.708) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.875758685  0.004266395 -674.0489 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    7.996796  8.741042   69.16149 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 17.848357 18.961905 2744.71003 < 2.22e-16 ***
#> s(year)                        7.506942  8.447865  403.24420 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0464   Deviance explained = 11.1%
#> -REML = -57787  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.435209424e+1
#> 2 logLik         5.787344510e+4
#> 3 AIC           -1.156714009e+5
#> 4 BIC           -1.153590034e+5
#> 5 deviance       3.026665161e+4
#> 6 df.residual    2.901064791e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -4.637448924e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.173049890e-1
#>  2 mean((Intercept))                   -2.875758685e+0
#>  3 mean(s(spei_12m))                   -5.750406644e-3
#>  4 mean(te(gini_index,gdp_per_capita)) -1.291007819e-1
#>  5 mean(s(year))                        1.090907316e-1
#>  6 s(spei_12m).1                        1.930241846e-1
#>  7 s(spei_12m).2                       -3.205476763e-1
#>  8 s(spei_12m).3                        2.068329025e-1
#>  9 s(spei_12m).4                        2.943805061e-1
#> 10 s(spei_12m).5                       -7.827901559e-2
#> 11 s(spei_12m).6                        2.247952867e-1
#> 12 s(spei_12m).7                       -1.460797499e-1
#> 13 s(spei_12m).8                       -7.538924529e-1
#> 14 s(spei_12m).9                        3.280123550e-1
#> 15 te(gini_index,gdp_per_capita).1     -1.298453329e+0
#> 16 te(gini_index,gdp_per_capita).2     -1.407881216e+0
#> 17 te(gini_index,gdp_per_capita).3     -1.422221201e+0
#> 18 te(gini_index,gdp_per_capita).4      1.614112556e+1
#> 19 te(gini_index,gdp_per_capita).5      2.680340730e-1
#> 20 te(gini_index,gdp_per_capita).6      1.869687808e-1
#> 21 te(gini_index,gdp_per_capita).7     -3.989737509e-1
#> 22 te(gini_index,gdp_per_capita).8      2.284350691e-1
#> 23 te(gini_index,gdp_per_capita).9      5.482448652e+0
#> 24 te(gini_index,gdp_per_capita).10     4.684844672e-1
#> 25 te(gini_index,gdp_per_capita).11     2.166084015e-1
#> 26 te(gini_index,gdp_per_capita).12    -5.866125383e-2
#> 27 te(gini_index,gdp_per_capita).13     1.739122641e-1
#> 28 te(gini_index,gdp_per_capita).14     1.768170883e+0
#> 29 te(gini_index,gdp_per_capita).15     5.468305065e-1
#> 30 te(gini_index,gdp_per_capita).16     5.396716091e-1
#> 31 te(gini_index,gdp_per_capita).17    -2.150036823e-1
#> 32 te(gini_index,gdp_per_capita).18     6.851331819e-1
#> 33 te(gini_index,gdp_per_capita).19    -1.881119515e+0
#> 34 te(gini_index,gdp_per_capita).20     1.882986362e-1
#> 35 te(gini_index,gdp_per_capita).21    -4.525487445e-1
#> 36 te(gini_index,gdp_per_capita).22    -7.599497972e-1
#> 37 te(gini_index,gdp_per_capita).23    -5.854308740e-1
#> 38 te(gini_index,gdp_per_capita).24    -2.151229749e+1
#> 39 s(year).1                            2.197061149e-2
#> 40 s(year).2                            4.622917865e-1
#> 41 s(year).3                            2.390786895e-1
#> 42 s(year).4                           -3.736696005e-1
#> 43 s(year).5                           -1.084281133e-2
#> 44 s(year).6                           -1.885981610e-1
#> 45 s(year).7                           -1.115324130e-1
#> 46 s(year).8                            7.570421876e-1
#> 47 s(year).9                            1.860762951e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    3.135124790e-24 0.4386344126           2.754406321e-1 0.5079354649
#> 2 observed 3.135124790e-24 0.08374416323          5.233322237e-2 0.3211231677
#> 3 estimate 3.135124790e-24 0.3128056866           3.775205272e-3 0.3758159024
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(81.649) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.516820673  0.002977206 -845.3632 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq      p-value
#> s(spei_12m)                    3.962664  4.981092   33.72232 0.0000034991
#> te(gini_index,gdp_per_capita) 15.036614 16.607044 2182.39232   < 2.22e-16
#> s(year)                        7.349877  8.276045  163.22600   < 2.22e-16
#>                                  
#> s(spei_12m)                   ***
#> te(gini_index,gdp_per_capita) ***
#> s(year)                       ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.142   Deviance explained = 12.6%
#> -REML = -40396  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       1.416312059e-1 moderate       cohen1988
#> 2 SE       4.530434894e-3 <NA>           <NA>     
#> 3 Lower CI 1.327517166e-1 moderate       cohen1988
#> 4 Upper CI 1.505106951e-1 moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.734915516e+1
#> 2 logLik         4.046466763e+4
#> 3 AIC           -8.086789102e+4
#> 4 BIC           -8.062725422e+4
#> 5 deviance       1.838236091e+4
#> 6 df.residual    1.860565084e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  1.416312059e-1
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               5.040337019e-2
#>  2 mean((Intercept))                   -2.516820673e+0
#>  3 mean(s(spei_12m))                   -8.771446791e-3
#>  4 mean(te(gini_index,gdp_per_capita))  1.852122755e-1
#>  5 mean(s(year))                        3.533488889e-2
#>  6 s(spei_12m).1                       -2.990822067e-3
#>  7 s(spei_12m).2                       -1.115941972e-2
#>  8 s(spei_12m).3                        4.750785726e-3
#>  9 s(spei_12m).4                       -1.780187943e-2
#> 10 s(spei_12m).5                        7.288172558e-3
#> 11 s(spei_12m).6                       -1.503742542e-2
#> 12 s(spei_12m).7                        7.243812410e-3
#> 13 s(spei_12m).8                       -7.640707730e-2
#> 14 s(spei_12m).9                        2.517083212e-2
#> 15 te(gini_index,gdp_per_capita).1     -5.263833006e-1
#> 16 te(gini_index,gdp_per_capita).2     -4.826032542e-1
#> 17 te(gini_index,gdp_per_capita).3     -4.134623929e-1
#> 18 te(gini_index,gdp_per_capita).4     -3.708147639e+0
#> 19 te(gini_index,gdp_per_capita).5      3.315635316e-1
#> 20 te(gini_index,gdp_per_capita).6     -1.651103424e-2
#> 21 te(gini_index,gdp_per_capita).7     -1.888045684e-1
#> 22 te(gini_index,gdp_per_capita).8     -3.973504291e-2
#> 23 te(gini_index,gdp_per_capita).9     -8.943094754e-1
#> 24 te(gini_index,gdp_per_capita).10     4.940271861e-1
#> 25 te(gini_index,gdp_per_capita).11     6.301319110e-2
#> 26 te(gini_index,gdp_per_capita).12    -5.218527818e-2
#> 27 te(gini_index,gdp_per_capita).13    -6.435487869e-2
#> 28 te(gini_index,gdp_per_capita).14    -6.388996714e-2
#> 29 te(gini_index,gdp_per_capita).15     6.630331078e-1
#> 30 te(gini_index,gdp_per_capita).16     2.477038890e-1
#> 31 te(gini_index,gdp_per_capita).17    -1.137124580e-1
#> 32 te(gini_index,gdp_per_capita).18     1.304143526e-1
#> 33 te(gini_index,gdp_per_capita).19     8.148116778e-1
#> 34 te(gini_index,gdp_per_capita).20     1.411292007e+0
#> 35 te(gini_index,gdp_per_capita).21     4.062122650e-1
#> 36 te(gini_index,gdp_per_capita).22     3.088600283e-1
#> 37 te(gini_index,gdp_per_capita).23     2.657326108e-1
#> 38 te(gini_index,gdp_per_capita).24     5.872530055e+0
#> 39 s(year).1                            3.876290981e-2
#> 40 s(year).2                            2.435364594e-1
#> 41 s(year).3                            8.466948749e-2
#> 42 s(year).4                           -2.676278059e-1
#> 43 s(year).5                            1.340548702e-2
#> 44 s(year).6                           -1.089147625e-1
#> 45 s(year).7                           -5.597837739e-2
#> 46 s(year).8                            3.683312757e-1
#> 47 s(year).9                            1.829326342e-3
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.588613525e-24  0.8429077979          5.455094612e-1 0.8634520043
#> 2 observed 2.588613525e-24  0.5887756362          2.082456215e-1 0.3929841856
#> 3 estimate 2.588613525e-24  0.6993780697          5.125519725e-3 0.6055875044
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(63.296) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.946427538  0.007369905 -264.1048 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq      p-value    
#> s(spei_12m)                    1.908340  2.425916  12.51950    0.0033401 ** 
#> te(gini_index,gdp_per_capita) 13.208793 15.303787 519.83714   < 2.22e-16 ***
#> s(year)                        1.906688  2.364433  26.37975 0.0000053133 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.214   Deviance explained = 19.9%
#> -REML = -4540.2  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.2138962997  moderate       cohen1988
#> 2 SE       0.01378325948 <NA>           <NA>     
#> 3 Lower CI 0.1868816076  moderate       cohen1988
#> 4 Upper CI 0.2409109919  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.802382111e+1
#> 2 logLik         4.578106537e+3
#> 3 AIC           -9.112024802e+3
#> 4 BIC           -8.983014231e+3
#> 5 deviance       2.487063320e+3
#> 6 df.residual    2.519976179e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.138962997e-1
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -4.604052641e-2
#>  2 mean((Intercept))                   -1.946427538e+0
#>  3 mean(s(spei_12m))                   -2.576807723e-3
#>  4 mean(te(gini_index,gdp_per_capita)) -4.000657833e-3
#>  5 mean(s(year))                        9.543551071e-3
#>  6 s(spei_12m).1                       -2.368282578e-3
#>  7 s(spei_12m).2                       -5.634512832e-3
#>  8 s(spei_12m).3                        6.988812705e-4
#>  9 s(spei_12m).4                        6.170941935e-3
#> 10 s(spei_12m).5                        3.900312974e-4
#> 11 s(spei_12m).6                       -6.029587610e-3
#> 12 s(spei_12m).7                       -1.571460422e-3
#> 13 s(spei_12m).8                       -3.923842977e-2
#> 14 s(spei_12m).9                        2.439114920e-2
#> 15 te(gini_index,gdp_per_capita).1     -9.683253627e-2
#> 16 te(gini_index,gdp_per_capita).2     -3.044781733e-1
#> 17 te(gini_index,gdp_per_capita).3     -4.163146680e-1
#> 18 te(gini_index,gdp_per_capita).4     -6.992371964e-1
#> 19 te(gini_index,gdp_per_capita).5      5.229948279e-1
#> 20 te(gini_index,gdp_per_capita).6     -2.188459753e-1
#> 21 te(gini_index,gdp_per_capita).7      9.183594113e-2
#> 22 te(gini_index,gdp_per_capita).8     -5.001300185e-1
#> 23 te(gini_index,gdp_per_capita).9     -3.954983251e-1
#> 24 te(gini_index,gdp_per_capita).10     5.203885193e-1
#> 25 te(gini_index,gdp_per_capita).11     1.344961570e-2
#> 26 te(gini_index,gdp_per_capita).12     4.792473315e-2
#> 27 te(gini_index,gdp_per_capita).13    -2.005074037e-1
#> 28 te(gini_index,gdp_per_capita).14    -3.082968664e-1
#> 29 te(gini_index,gdp_per_capita).15     4.903474873e-1
#> 30 te(gini_index,gdp_per_capita).16    -4.429321504e-2
#> 31 te(gini_index,gdp_per_capita).17     1.797032356e-1
#> 32 te(gini_index,gdp_per_capita).18    -3.588369311e-1
#> 33 te(gini_index,gdp_per_capita).19    -2.024498744e-1
#> 34 te(gini_index,gdp_per_capita).20     1.773497104e-1
#> 35 te(gini_index,gdp_per_capita).21     3.688559152e-1
#> 36 te(gini_index,gdp_per_capita).22     4.984976516e-1
#> 37 te(gini_index,gdp_per_capita).23     4.320868889e-1
#> 38 te(gini_index,gdp_per_capita).24     3.062708692e-1
#> 39 s(year).1                           -3.435306517e-3
#> 40 s(year).2                            1.216227305e-2
#> 41 s(year).3                            5.781565989e-3
#> 42 s(year).4                           -1.144599549e-2
#> 43 s(year).5                           -7.508389447e-4
#> 44 s(year).6                           -8.436012783e-3
#> 45 s(year).7                           -3.745548593e-3
#> 46 s(year).8                            4.141303093e-2
#> 47 s(year).9                            5.434879201e-2
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.623684980e-25  0.5766265013          4.569162593e-1 0.6028488674
#> 2 observed 2.623684980e-25  0.5137525829          2.610550504e-1 0.4879333548
#> 3 estimate 2.623684980e-25  0.4331896267          9.220398167e-3 0.3812821727
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 198: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mbepr_beipr_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(19.849) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error  z value   Pr(>|z|)    
#> (Intercept) -1.948019115  0.007292566 -267.124 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    1.002341  1.004554   11.73303 0.00062523 ***
#> te(gini_index,gdp_per_capita) 18.132368 19.564406 1031.84529 < 2.22e-16 ***
#> s(year)                        7.005929  8.093057  192.96440 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.124   Deviance explained = 12.8%
#> -REML = -9508.9  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       1.235231245e-1 weak           cohen1988
#> 2 SE       6.911027599e-3 <NA>           <NA>     
#> 3 Lower CI 1.099777593e-1 weak           cohen1988
#> 4 Upper CI 1.370684897e-1 moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.714063749e+1
#> 2 logLik         9.577519789e+3
#> 3 AIC           -1.909543360e+4
#> 4 BIC           -1.889004187e+4
#> 5 deviance       7.117722469e+3
#> 6 df.residual    7.243859363e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  1.235231245e-1
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.376117260e-1
#>  2 mean((Intercept))                   -1.948019115e+0
#>  3 mean(s(spei_12m))                    3.819266254e-3
#>  4 mean(te(gini_index,gdp_per_capita)) -2.005067416e-1
#>  5 mean(s(year))                        8.983369973e-2
#>  6 s(spei_12m).1                       -1.587831592e-5
#>  7 s(spei_12m).2                       -9.400098777e-6
#>  8 s(spei_12m).3                        9.320549049e-9
#>  9 s(spei_12m).4                       -4.821942432e-6
#> 10 s(spei_12m).5                       -1.811981298e-6
#> 11 s(spei_12m).6                        4.512640529e-6
#> 12 s(spei_12m).7                       -1.756965780e-6
#> 13 s(spei_12m).8                        2.684411451e-5
#> 14 s(spei_12m).9                        3.437569951e-2
#> 15 te(gini_index,gdp_per_capita).1     -6.569709666e-1
#> 16 te(gini_index,gdp_per_capita).2     -4.267331245e-1
#> 17 te(gini_index,gdp_per_capita).3     -3.285710455e-1
#> 18 te(gini_index,gdp_per_capita).4      5.464941835e-1
#> 19 te(gini_index,gdp_per_capita).5      4.717545702e-1
#> 20 te(gini_index,gdp_per_capita).6      6.038846395e-2
#> 21 te(gini_index,gdp_per_capita).7     -3.274578477e-1
#> 22 te(gini_index,gdp_per_capita).8      1.059195411e-1
#> 23 te(gini_index,gdp_per_capita).9     -8.601145803e-1
#> 24 te(gini_index,gdp_per_capita).10     6.539660151e-1
#> 25 te(gini_index,gdp_per_capita).11     8.265299238e-2
#> 26 te(gini_index,gdp_per_capita).12    -9.478068587e-2
#> 27 te(gini_index,gdp_per_capita).13     4.542215944e-2
#> 28 te(gini_index,gdp_per_capita).14    -1.410487054e+0
#> 29 te(gini_index,gdp_per_capita).15     7.757268832e-1
#> 30 te(gini_index,gdp_per_capita).16     2.249979608e-1
#> 31 te(gini_index,gdp_per_capita).17    -4.000670323e-2
#> 32 te(gini_index,gdp_per_capita).18     1.267188973e-1
#> 33 te(gini_index,gdp_per_capita).19    -2.004268820e+0
#> 34 te(gini_index,gdp_per_capita).20     8.149033231e-1
#> 35 te(gini_index,gdp_per_capita).21     1.389859118e+0
#> 36 te(gini_index,gdp_per_capita).22     5.069730135e-1
#> 37 te(gini_index,gdp_per_capita).23     5.556465986e-1
#> 38 te(gini_index,gdp_per_capita).24    -5.024194690e+0
#> 39 s(year).1                           -5.935820286e-2
#> 40 s(year).2                            1.770704168e-1
#> 41 s(year).3                            2.764977403e-1
#> 42 s(year).4                           -2.880315898e-1
#> 43 s(year).5                           -3.643438236e-2
#> 44 s(year).6                           -8.877703754e-2
#> 45 s(year).7                           -6.895861894e-2
#> 46 s(year).8                            4.862502525e-1
#> 47 s(year).9                            4.102447195e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    1.223297314e-24  0.5789015684           0.3501118687  0.6460694532
#> 2 observed 1.223297314e-24  0.5448354296           0.1025414746  0.5132527970
#> 3 estimate 1.223297314e-24  0.4778441467           0.01041126877 0.4377095149
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.216) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.223605752  0.004067372 -546.6935 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    4.637657  5.750613   21.24853  0.0011738 ** 
#> te(gini_index,gdp_per_capita) 18.138657 19.133616 2207.35823 < 2.22e-16 ***
#> s(year)                        7.998733  8.723812  269.32358 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00449   Deviance explained = 9.12%
#> -REML = -41937  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.177504656e+1
#> 2 logLik         4.201864534e+4
#> 3 AIC           -8.396693824e+4
#> 4 BIC           -8.367579869e+4
#> 5 deviance       2.914613611e+4
#> 6 df.residual    2.901322495e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -4.488600260e-3
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.035854778e-1
#>  2 mean((Intercept))                   -2.223605752e+0
#>  3 mean(s(spei_12m))                    2.123242764e-2
#>  4 mean(te(gini_index,gdp_per_capita)) -1.398313814e-1
#>  5 mean(s(year))                        1.038101679e-1
#>  6 s(spei_12m).1                        6.278961842e-2
#>  7 s(spei_12m).2                        2.009333139e-2
#>  8 s(spei_12m).3                        3.103190741e-2
#>  9 s(spei_12m).4                        1.389449803e-2
#> 10 s(spei_12m).5                       -2.678880003e-3
#> 11 s(spei_12m).6                        7.186140787e-3
#> 12 s(spei_12m).7                       -3.650182204e-3
#> 13 s(spei_12m).8                       -2.110146034e-2
#> 14 s(spei_12m).9                        8.352687523e-2
#> 15 te(gini_index,gdp_per_capita).1     -1.230572935e+0
#> 16 te(gini_index,gdp_per_capita).2     -1.379133552e+0
#> 17 te(gini_index,gdp_per_capita).3     -1.450873826e+0
#> 18 te(gini_index,gdp_per_capita).4      1.591111913e+1
#> 19 te(gini_index,gdp_per_capita).5      3.163406494e-1
#> 20 te(gini_index,gdp_per_capita).6      2.311430786e-1
#> 21 te(gini_index,gdp_per_capita).7     -3.351546983e-1
#> 22 te(gini_index,gdp_per_capita).8      3.066535895e-1
#> 23 te(gini_index,gdp_per_capita).9      5.313250562e+0
#> 24 te(gini_index,gdp_per_capita).10     4.597351415e-1
#> 25 te(gini_index,gdp_per_capita).11     1.902323942e-1
#> 26 te(gini_index,gdp_per_capita).12    -7.484347863e-2
#> 27 te(gini_index,gdp_per_capita).13     1.613642433e-1
#> 28 te(gini_index,gdp_per_capita).14     1.629569783e+0
#> 29 te(gini_index,gdp_per_capita).15     5.292435514e-1
#> 30 te(gini_index,gdp_per_capita).16     4.998812437e-1
#> 31 te(gini_index,gdp_per_capita).17    -2.717340794e-1
#> 32 te(gini_index,gdp_per_capita).18     6.500642764e-1
#> 33 te(gini_index,gdp_per_capita).19    -1.977261064e+0
#> 34 te(gini_index,gdp_per_capita).20     3.806509233e-1
#> 35 te(gini_index,gdp_per_capita).21    -4.341628596e-1
#> 36 te(gini_index,gdp_per_capita).22    -7.984247584e-1
#> 37 te(gini_index,gdp_per_capita).23    -6.951157545e-1
#> 38 te(gini_index,gdp_per_capita).24    -2.128792472e+1
#> 39 s(year).1                           -3.697655389e-2
#> 40 s(year).2                            4.324823779e-1
#> 41 s(year).3                            2.472082630e-1
#> 42 s(year).4                           -4.099118180e-1
#> 43 s(year).5                           -3.635123227e-2
#> 44 s(year).6                           -1.600234742e-1
#> 45 s(year).7                           -1.196235426e-1
#> 46 s(year).8                            7.756442682e-1
#> 47 s(year).9                            2.418432226e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    3.135124790e-24  0.4386344126          2.754406321e-1 0.5079354649
#> 2 observed 3.135124790e-24  0.1703375569          6.457010156e-2 0.2375150213
#> 3 estimate 3.135124790e-24  0.3128056866          3.775205272e-3 0.3758159024
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(36.367) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.793438705  0.003338323 -537.2274 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    8.408676  8.904907   75.39502 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 16.063581 17.512736 1742.29725 < 2.22e-16 ***
#> s(year)                        7.255911  8.216346   59.16464 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.126   Deviance explained = 12.1%
#> -REML = -27627  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       1.262385438e-1 weak           cohen1988
#> 2 SE       4.353869100e-3 <NA>           <NA>     
#> 3 Lower CI 1.177051172e-1 weak           cohen1988
#> 4 Upper CI 1.347719704e-1 moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.272816732e+1
#> 2 logLik         2.771028642e+4
#> 3 AIC           -5.534730486e+4
#> 4 BIC           -5.506036220e+4
#> 5 deviance       1.819626584e+4
#> 6 df.residual    1.860027183e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  1.262385438e-1
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               9.911940488e-2
#>  2 mean((Intercept))                   -1.793438705e+0
#>  3 mean(s(spei_12m))                   -3.523016344e-2
#>  4 mean(te(gini_index,gdp_per_capita))  2.520636773e-1
#>  5 mean(s(year))                        3.590181443e-2
#>  6 s(spei_12m).1                       -8.888268730e-2
#>  7 s(spei_12m).2                       -1.215849864e-1
#>  8 s(spei_12m).3                        5.194930962e-2
#>  9 s(spei_12m).4                       -1.405384256e-1
#> 10 s(spei_12m).5                        6.781570315e-2
#> 11 s(spei_12m).6                       -1.055392065e-1
#> 12 s(spei_12m).7                        1.376034130e-1
#> 13 s(spei_12m).8                       -3.811061576e-1
#> 14 s(spei_12m).9                        2.632115665e-1
#> 15 te(gini_index,gdp_per_capita).1     -5.160643363e-1
#> 16 te(gini_index,gdp_per_capita).2     -5.095459179e-1
#> 17 te(gini_index,gdp_per_capita).3     -4.534548007e-1
#> 18 te(gini_index,gdp_per_capita).4     -5.635777123e+0
#> 19 te(gini_index,gdp_per_capita).5      2.246007962e-1
#> 20 te(gini_index,gdp_per_capita).6      5.266116512e-2
#> 21 te(gini_index,gdp_per_capita).7     -2.595779376e-1
#> 22 te(gini_index,gdp_per_capita).8      9.925880276e-2
#> 23 te(gini_index,gdp_per_capita).9     -1.168402337e+0
#> 24 te(gini_index,gdp_per_capita).10     4.692634152e-1
#> 25 te(gini_index,gdp_per_capita).11     6.063388407e-2
#> 26 te(gini_index,gdp_per_capita).12    -5.703275337e-2
#> 27 te(gini_index,gdp_per_capita).13    -4.679771186e-2
#> 28 te(gini_index,gdp_per_capita).14     1.454141902e-1
#> 29 te(gini_index,gdp_per_capita).15     7.488469455e-1
#> 30 te(gini_index,gdp_per_capita).16     3.525026668e-1
#> 31 te(gini_index,gdp_per_capita).17    -2.882742821e-1
#> 32 te(gini_index,gdp_per_capita).18     3.431737006e-1
#> 33 te(gini_index,gdp_per_capita).19     1.526916843e+0
#> 34 te(gini_index,gdp_per_capita).20     9.109629467e-1
#> 35 te(gini_index,gdp_per_capita).21     3.069321153e-1
#> 36 te(gini_index,gdp_per_capita).22     1.786429287e-1
#> 37 te(gini_index,gdp_per_capita).23     1.458643486e-1
#> 38 te(gini_index,gdp_per_capita).24     9.418780707e+0
#> 39 s(year).1                           -2.785571495e-2
#> 40 s(year).2                            2.062221918e-1
#> 41 s(year).3                            8.898905811e-2
#> 42 s(year).4                           -2.007470754e-1
#> 43 s(year).5                           -4.714728035e-3
#> 44 s(year).6                           -3.966754071e-2
#> 45 s(year).7                           -4.199243911e-2
#> 46 s(year).8                            2.571765121e-1
#> 47 s(year).9                            8.570606595e-2
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.588613525e-24  0.8429077979          5.455094612e-1 0.8634520043
#> 2 observed 2.588613525e-24  0.3613046975          1.839068275e-1 0.3114776112
#> 3 estimate 2.588613525e-24  0.6993780697          5.125519725e-3 0.6055875044
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(28.2) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.279842661  0.008794771 -145.5231 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq    p-value    
#> s(spei_12m)                    1.004703  1.009384   8.30785  0.0040638 ** 
#> te(gini_index,gdp_per_capita) 12.935723 15.043027 396.02178 < 2.22e-16 ***
#> s(year)                        1.000246  1.000487   2.02571  0.1547300    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.185   Deviance explained = 18.3%
#> -REML = -2975.4  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.1853289242  moderate       cohen1988
#> 2 SE       0.01329610253 <NA>           <NA>     
#> 3 Lower CI 0.1592690421  moderate       cohen1988
#> 4 Upper CI 0.2113888063  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.594067162e+1
#> 2 logLik         3.009104818e+3
#> 3 AIC           -5.980103839e+3
#> 4 BIC           -5.868851459e+3
#> 5 deviance       2.463678218e+3
#> 6 df.residual    2.522059328e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  1.853289242e-1
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -3.662573927e-2
#>  2 mean((Intercept))                   -1.279842661e+0
#>  3 mean(s(spei_12m))                    3.048535060e-3
#>  4 mean(te(gini_index,gdp_per_capita)) -1.411518492e-2
#>  5 mean(s(year))                        1.807054940e-3
#>  6 s(spei_12m).1                       -4.355582273e-5
#>  7 s(spei_12m).2                        1.886091367e-5
#>  8 s(spei_12m).3                        7.778223208e-8
#>  9 s(spei_12m).4                       -7.441748188e-7
#> 10 s(spei_12m).5                       -2.842127913e-6
#> 11 s(spei_12m).6                        2.937438139e-6
#> 12 s(spei_12m).7                       -6.805138289e-8
#> 13 s(spei_12m).8                        2.018136462e-5
#> 14 s(spei_12m).9                        2.744196822e-2
#> 15 te(gini_index,gdp_per_capita).1     -2.840514046e-2
#> 16 te(gini_index,gdp_per_capita).2     -2.174218746e-1
#> 17 te(gini_index,gdp_per_capita).3     -3.177964694e-1
#> 18 te(gini_index,gdp_per_capita).4     -1.320577084e+0
#> 19 te(gini_index,gdp_per_capita).5      5.982547230e-1
#> 20 te(gini_index,gdp_per_capita).6     -2.463540645e-1
#> 21 te(gini_index,gdp_per_capita).7      1.298208718e-1
#> 22 te(gini_index,gdp_per_capita).8     -5.342403096e-1
#> 23 te(gini_index,gdp_per_capita).9     -6.698742413e-1
#> 24 te(gini_index,gdp_per_capita).10     5.884451499e-1
#> 25 te(gini_index,gdp_per_capita).11    -1.116469343e-3
#> 26 te(gini_index,gdp_per_capita).12     5.715727940e-2
#> 27 te(gini_index,gdp_per_capita).13    -2.194274060e-1
#> 28 te(gini_index,gdp_per_capita).14    -4.836138399e-1
#> 29 te(gini_index,gdp_per_capita).15     5.502704591e-1
#> 30 te(gini_index,gdp_per_capita).16    -7.125048146e-2
#> 31 te(gini_index,gdp_per_capita).17     1.855582898e-1
#> 32 te(gini_index,gdp_per_capita).18    -4.234903363e-1
#> 33 te(gini_index,gdp_per_capita).19    -2.584437512e-1
#> 34 te(gini_index,gdp_per_capita).20     2.795159674e-1
#> 35 te(gini_index,gdp_per_capita).21     4.369126890e-1
#> 36 te(gini_index,gdp_per_capita).22     4.763431184e-1
#> 37 te(gini_index,gdp_per_capita).23     3.251154545e-1
#> 38 te(gini_index,gdp_per_capita).24     8.258530281e-1
#> 39 s(year).1                            1.849893262e-7
#> 40 s(year).2                            5.257510947e-7
#> 41 s(year).3                            5.857977929e-7
#> 42 s(year).4                           -9.823195042e-7
#> 43 s(year).5                           -4.945974710e-8
#> 44 s(year).6                           -5.686636189e-7
#> 45 s(year).7                           -2.727741639e-7
#> 46 s(year).8                            3.125081698e-6
#> 47 s(year).9                            1.626094606e-2
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.623684980e-25  0.5766265013          4.569162593e-1 0.6028488674
#> 2 observed 2.623684980e-25  0.5542435938          2.932390599e-1 0.4342740714
#> 3 estimate 2.623684980e-25  0.4331896267          9.220398167e-3 0.3812821727
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 199: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(maper_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.331) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.55288509  0.01012424 -350.9287 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq  p-value    
#> s(spei_12m)                    3.935290  4.942821  13.94393 0.015463 *  
#> te(gini_index,gdp_per_capita) 12.596538 14.436040 370.21269  < 2e-16 ***
#> s(year)                        5.572157  6.717918  64.47033  < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.026   Deviance explained = 6.33%
#> -REML = -19239  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.310398463e+1
#> 2 logLik         1.928203250e+4
#> 3 AIC           -3.850787145e+4
#> 4 BIC           -3.831423830e+4
#> 5 deviance       7.678044863e+3
#> 6 df.residual    7.247896015e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -2.596516369e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -5.385801842e-2
#>  2 mean((Intercept))                   -3.552885086e+0
#>  3 mean(s(spei_12m))                    2.724956363e-2
#>  4 mean(te(gini_index,gdp_per_capita))  2.273374021e-2
#>  5 mean(s(year))                        4.957049509e-2
#>  6 s(spei_12m).1                        1.465416610e-1
#>  7 s(spei_12m).2                       -3.262614626e-2
#>  8 s(spei_12m).3                        3.492795755e-4
#>  9 s(spei_12m).4                       -1.006696279e-2
#> 10 s(spei_12m).5                       -1.298300153e-2
#> 11 s(spei_12m).6                        9.954900005e-3
#> 12 s(spei_12m).7                       -7.752080973e-3
#> 13 s(spei_12m).8                        2.224120375e-2
#> 14 s(spei_12m).9                        1.295872199e-1
#> 15 te(gini_index,gdp_per_capita).1     -6.523489894e-1
#> 16 te(gini_index,gdp_per_capita).2     -6.707459210e-1
#> 17 te(gini_index,gdp_per_capita).3     -5.880377644e-1
#> 18 te(gini_index,gdp_per_capita).4     -3.490001453e+0
#> 19 te(gini_index,gdp_per_capita).5     -2.075630741e-2
#> 20 te(gini_index,gdp_per_capita).6      1.618283682e-1
#> 21 te(gini_index,gdp_per_capita).7     -4.261295054e-1
#> 22 te(gini_index,gdp_per_capita).8      2.923171018e-1
#> 23 te(gini_index,gdp_per_capita).9     -1.009264081e+0
#> 24 te(gini_index,gdp_per_capita).10     1.853386228e-1
#> 25 te(gini_index,gdp_per_capita).11     1.728711791e-1
#> 26 te(gini_index,gdp_per_capita).12    -6.223170028e-2
#> 27 te(gini_index,gdp_per_capita).13     1.425325379e-1
#> 28 te(gini_index,gdp_per_capita).14    -1.316434506e-1
#> 29 te(gini_index,gdp_per_capita).15     3.865900208e-1
#> 30 te(gini_index,gdp_per_capita).16     4.675993543e-1
#> 31 te(gini_index,gdp_per_capita).17     7.552980316e-2
#> 32 te(gini_index,gdp_per_capita).18     3.493289325e-1
#> 33 te(gini_index,gdp_per_capita).19     7.384585697e-1
#> 34 te(gini_index,gdp_per_capita).20     2.714799595e-1
#> 35 te(gini_index,gdp_per_capita).21     7.540891408e-2
#> 36 te(gini_index,gdp_per_capita).22    -8.032263268e-2
#> 37 te(gini_index,gdp_per_capita).23    -3.006670252e-1
#> 38 te(gini_index,gdp_per_capita).24     4.658475231e+0
#> 39 s(year).1                            1.144002984e-1
#> 40 s(year).2                            2.511874407e-1
#> 41 s(year).3                           -2.629578155e-2
#> 42 s(year).4                           -1.314721285e-1
#> 43 s(year).5                           -1.419898110e-2
#> 44 s(year).6                           -3.733642672e-2
#> 45 s(year).7                           -4.225014979e-2
#> 46 s(year).8                            4.264659570e-1
#> 47 s(year).9                           -9.436577258e-2
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    1.223297314e-24  0.5789015684           0.3501118687  0.6460694532
#> 2 observed 1.223297314e-24  0.4780818944           0.04309403980 0.3274556400
#> 3 estimate 1.223297314e-24  0.4778441467           0.01041126877 0.4377095149
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(26.39) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -4.002587756  0.005374656 -744.7151 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq    p-value    
#> s(spei_12m)                    8.158966  8.815429  237.7016 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.926377 20.021046 2654.5254 < 2.22e-16 ***
#> s(year)                        8.400126  8.897307  455.0652 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00405   Deviance explained = 10.4%
#> -REML = -97328  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       4.048976035e-3 very weak (negligible) cohen1988
#> 2 SE       7.113596263e-4 <NA>                   <NA>     
#> 3 Lower CI 2.654736788e-3 very weak (negligible) cohen1988
#> 4 Upper CI 5.443215283e-3 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.648546850e+1
#> 2 logLik         9.742804791e+4
#> 3 AIC           -1.947766282e+5
#> 4 BIC           -1.944477676e+5
#> 5 deviance       3.094050710e+4
#> 6 df.residual    2.900851453e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  4.048976035e-3
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -2.759630004e-2
#>  2 mean((Intercept))                   -4.002587756e+0
#>  3 mean(s(spei_12m))                   -1.617038651e-2
#>  4 mean(te(gini_index,gdp_per_capita))  7.025638200e-2
#>  5 mean(s(year))                        1.417030184e-1
#>  6 s(spei_12m).1                        1.602153684e-1
#>  7 s(spei_12m).2                       -2.150415784e-1
#>  8 s(spei_12m).3                        1.057391972e-1
#>  9 s(spei_12m).4                        2.902608366e-1
#> 10 s(spei_12m).5                       -9.938962065e-2
#> 11 s(spei_12m).6                        3.181440002e-1
#> 12 s(spei_12m).7                       -1.240757369e-1
#> 13 s(spei_12m).8                       -7.254756859e-1
#> 14 s(spei_12m).9                        1.440897409e-1
#> 15 te(gini_index,gdp_per_capita).1     -7.968017473e-1
#> 16 te(gini_index,gdp_per_capita).2     -9.506594327e-1
#> 17 te(gini_index,gdp_per_capita).3     -1.019514327e+0
#> 18 te(gini_index,gdp_per_capita).4      3.696196342e-1
#> 19 te(gini_index,gdp_per_capita).5      4.626822252e-1
#> 20 te(gini_index,gdp_per_capita).6      1.977011769e-2
#> 21 te(gini_index,gdp_per_capita).7     -4.079866436e-1
#> 22 te(gini_index,gdp_per_capita).8     -4.989737198e-2
#> 23 te(gini_index,gdp_per_capita).9      5.862561630e-1
#> 24 te(gini_index,gdp_per_capita).10     7.802731389e-1
#> 25 te(gini_index,gdp_per_capita).11     2.194402721e-1
#> 26 te(gini_index,gdp_per_capita).12    -5.042148103e-2
#> 27 te(gini_index,gdp_per_capita).13     5.729298557e-2
#> 28 te(gini_index,gdp_per_capita).14     6.603980123e-1
#> 29 te(gini_index,gdp_per_capita).15     9.071102678e-1
#> 30 te(gini_index,gdp_per_capita).16     4.201590770e-1
#> 31 te(gini_index,gdp_per_capita).17    -6.366230342e-2
#> 32 te(gini_index,gdp_per_capita).18     4.506686049e-1
#> 33 te(gini_index,gdp_per_capita).19     7.390493780e-1
#> 34 te(gini_index,gdp_per_capita).20     5.826485196e-1
#> 35 te(gini_index,gdp_per_capita).21     4.933676007e-1
#> 36 te(gini_index,gdp_per_capita).22    -1.269372676e+0
#> 37 te(gini_index,gdp_per_capita).23    -1.680177264e+0
#> 38 te(gini_index,gdp_per_capita).24     1.225910417e+0
#> 39 s(year).1                            8.815467536e-2
#> 40 s(year).2                            5.810144139e-1
#> 41 s(year).3                            2.475641704e-1
#> 42 s(year).4                           -4.430197384e-1
#> 43 s(year).5                           -1.038036786e-1
#> 44 s(year).6                           -8.975007679e-2
#> 45 s(year).7                           -1.500900234e-1
#> 46 s(year).8                            9.269111669e-1
#> 47 s(year).9                            2.183462562e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    3.135124790e-24  0.4386344126          2.754406321e-1 0.5079354649
#> 2 observed 3.135124790e-24  0.2509682026          1.000080335e-1 0.1762272543
#> 3 estimate 3.135124790e-24  0.3128056866          3.775205272e-3 0.3758159024
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(55.92) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.424950107  0.004878501 -702.0496 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq    p-value    
#> s(spei_12m)                    7.071994  8.161876  72.44836 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 13.992950 15.401318 697.98748 < 2.22e-16 ***
#> s(year)                        8.502523  8.919956 155.12494 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0205   Deviance explained = 5.83%
#> -REML = -47472  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.049581866e-2 weak                   cohen1988
#> 2 SE       1.966642526e-3 <NA>                   <NA>     
#> 3 Lower CI 1.664127014e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.435036718e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.056746739e+1
#> 2 logLik         4.754397690e+4
#> 3 AIC           -9.501913626e+4
#> 4 BIC           -9.474962308e+4
#> 5 deviance       1.836938076e+4
#> 6 df.residual    1.860243253e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  2.049581866e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.305462845e-2
#>  2 mean((Intercept))                   -3.424950107e+0
#>  3 mean(s(spei_12m))                   -2.121485471e-2
#>  4 mean(te(gini_index,gdp_per_capita))  9.923490785e-2
#>  5 mean(s(year))                        7.476633198e-2
#>  6 s(spei_12m).1                       -4.606670472e-2
#>  7 s(spei_12m).2                       -1.112536761e-1
#>  8 s(spei_12m).3                        1.134817730e-1
#>  9 s(spei_12m).4                       -1.096050018e-1
#> 10 s(spei_12m).5                        8.237803365e-2
#> 11 s(spei_12m).6                       -7.571138963e-2
#> 12 s(spei_12m).7                        1.113778717e-2
#> 13 s(spei_12m).8                       -2.164959340e-1
#> 14 s(spei_12m).9                        1.612014200e-1
#> 15 te(gini_index,gdp_per_capita).1     -6.732808455e-1
#> 16 te(gini_index,gdp_per_capita).2     -7.973604765e-1
#> 17 te(gini_index,gdp_per_capita).3     -8.839870885e-1
#> 18 te(gini_index,gdp_per_capita).4     -6.952233113e+0
#> 19 te(gini_index,gdp_per_capita).5      2.732547296e-2
#> 20 te(gini_index,gdp_per_capita).6     -8.052823754e-3
#> 21 te(gini_index,gdp_per_capita).7     -1.814026439e-1
#> 22 te(gini_index,gdp_per_capita).8      2.016543295e-2
#> 23 te(gini_index,gdp_per_capita).9     -1.724954783e+0
#> 24 te(gini_index,gdp_per_capita).10     1.332584945e-1
#> 25 te(gini_index,gdp_per_capita).11     4.897262568e-2
#> 26 te(gini_index,gdp_per_capita).12    -3.714174022e-3
#> 27 te(gini_index,gdp_per_capita).13     9.318843989e-3
#> 28 te(gini_index,gdp_per_capita).14    -1.735197632e-1
#> 29 te(gini_index,gdp_per_capita).15     3.417370434e-1
#> 30 te(gini_index,gdp_per_capita).16     2.381986671e-1
#> 31 te(gini_index,gdp_per_capita).17    -9.677459556e-2
#> 32 te(gini_index,gdp_per_capita).18     2.478145398e-1
#> 33 te(gini_index,gdp_per_capita).19     1.474327965e+0
#> 34 te(gini_index,gdp_per_capita).20     1.902234958e-1
#> 35 te(gini_index,gdp_per_capita).21     1.167606755e-1
#> 36 te(gini_index,gdp_per_capita).22     8.368601026e-2
#> 37 te(gini_index,gdp_per_capita).23     7.508561333e-2
#> 38 te(gini_index,gdp_per_capita).24     1.087004322e+1
#> 39 s(year).1                           -1.072815011e-1
#> 40 s(year).2                            1.297478496e-1
#> 41 s(year).3                            1.902441154e-1
#> 42 s(year).4                            4.359535865e-2
#> 43 s(year).5                           -6.770645375e-2
#> 44 s(year).6                            1.538523825e-1
#> 45 s(year).7                           -8.418181747e-2
#> 46 s(year).8                            1.183746060e-1
#> 47 s(year).9                            2.962524479e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.588613525e-24  0.8429077979          5.455094612e-1 0.8634520043
#> 2 observed 2.588613525e-24  0.3880419084          4.863478901e-2 0.3826809325
#> 3 estimate 2.588613525e-24  0.6993780697          5.125519725e-3 0.6055875044
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(90.919) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.53300850  0.01139888 -309.9435 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                    edf   Ref.df   Chi.sq     p-value    
#> s(spei_12m)                   1.005297 1.010478  0.78044     0.37956    
#> te(gini_index,gdp_per_capita) 6.180631 7.567595 39.20539  < 2.22e-16 ***
#> s(year)                       4.108788 5.079213 35.04306 0.000002407 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0287   Deviance explained = 4.07%
#> -REML = -7015.5  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.872079947e-2 weak                   cohen1988
#> 2 SE       6.240405439e-3 <NA>                   <NA>     
#> 3 Lower CI 1.648982956e-2 very weak (negligible) cohen1988
#> 4 Upper CI 4.095176938e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.229471570e+1
#> 2 logLik         7.034668134e+3
#> 3 AIC           -1.403802170e+4
#> 4 BIC           -1.394659674e+4
#> 5 deviance       2.476972895e+3
#> 6 df.residual    2.525705284e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.872079947e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.276367938e-1
#>  2 mean((Intercept))                   -3.533008501e+0
#>  3 mean(s(spei_12m))                    1.374879678e-3
#>  4 mean(te(gini_index,gdp_per_capita)) -8.617100741e-2
#>  5 mean(s(year))                        1.115073628e-2
#>  6 s(spei_12m).1                       -3.145806884e-5
#>  7 s(spei_12m).2                        4.633062204e-5
#>  8 s(spei_12m).3                       -3.654155965e-6
#>  9 s(spei_12m).4                       -1.162309670e-5
#> 10 s(spei_12m).5                       -2.376389028e-6
#> 11 s(spei_12m).6                        1.132745122e-5
#> 12 s(spei_12m).7                        2.804223265e-6
#> 13 s(spei_12m).8                        5.967523265e-5
#> 14 s(spei_12m).9                        1.230289128e-2
#> 15 te(gini_index,gdp_per_capita).1      1.448774783e-1
#> 16 te(gini_index,gdp_per_capita).2      1.381523082e-1
#> 17 te(gini_index,gdp_per_capita).3      1.104115274e-1
#> 18 te(gini_index,gdp_per_capita).4     -2.168743966e+0
#> 19 te(gini_index,gdp_per_capita).5      7.694422258e-2
#> 20 te(gini_index,gdp_per_capita).6     -8.035154504e-3
#> 21 te(gini_index,gdp_per_capita).7      1.014949818e-1
#> 22 te(gini_index,gdp_per_capita).8     -6.771413118e-2
#> 23 te(gini_index,gdp_per_capita).9     -8.865288219e-1
#> 24 te(gini_index,gdp_per_capita).10     7.628139033e-2
#> 25 te(gini_index,gdp_per_capita).11     2.941667306e-2
#> 26 te(gini_index,gdp_per_capita).12     5.961574591e-2
#> 27 te(gini_index,gdp_per_capita).13    -2.316509755e-2
#> 28 te(gini_index,gdp_per_capita).14    -5.192817271e-1
#> 29 te(gini_index,gdp_per_capita).15     4.559738409e-2
#> 30 te(gini_index,gdp_per_capita).16    -3.903062114e-2
#> 31 te(gini_index,gdp_per_capita).17     4.657312819e-2
#> 32 te(gini_index,gdp_per_capita).18    -1.103072443e-1
#> 33 te(gini_index,gdp_per_capita).19    -7.614307898e-2
#> 34 te(gini_index,gdp_per_capita).20    -3.165153030e-1
#> 35 te(gini_index,gdp_per_capita).21    -2.797249821e-1
#> 36 te(gini_index,gdp_per_capita).22    -2.521483913e-1
#> 37 te(gini_index,gdp_per_capita).23    -2.209909524e-1
#> 38 te(gini_index,gdp_per_capita).24     2.070860453e+0
#> 39 s(year).1                            1.441873613e-1
#> 40 s(year).2                            2.228013029e-2
#> 41 s(year).3                            3.961430128e-2
#> 42 s(year).4                           -4.162869985e-2
#> 43 s(year).5                           -2.072792874e-2
#> 44 s(year).6                           -1.809834768e-2
#> 45 s(year).7                           -1.126349359e-2
#> 46 s(year).8                            1.289964559e-1
#> 47 s(year).9                           -1.430031523e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.623684980e-25  0.5766265013          4.569162593e-1 0.6028488674
#> 2 observed 2.623684980e-25  0.5542616189          5.715325984e-2 0.1773300761
#> 3 estimate 2.623684980e-25  0.4331896267          9.220398167e-3 0.3812821727
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 200: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mpepr_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(33.663) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.435592582  0.009212709 -372.9188 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df   Chi.sq    p-value    
#> s(spei_12m)                    4.268564  5.347075  20.9017  0.0011836 ** 
#> te(gini_index,gdp_per_capita) 16.292307 17.984087 342.2626 < 2.22e-16 ***
#> s(year)                        6.664815  7.798762 147.6848 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0407   Deviance explained = 7.53%
#> -REML = -18039  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.822568620e+1
#> 2 logLik         1.810385478e+4
#> 3 AIC           -3.614144972e+4
#> 4 BIC           -3.591312990e+4
#> 5 deviance       7.660095941e+3
#> 6 df.residual    7.242774314e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -4.068121593e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -3.540426777e-1
#>  2 mean((Intercept))                   -3.435592582e+0
#>  3 mean(s(spei_12m))                    1.965179815e-2
#>  4 mean(te(gini_index,gdp_per_capita)) -5.107707060e-1
#>  5 mean(s(year))                        3.259868896e-2
#>  6 s(spei_12m).1                        1.442578959e-1
#>  7 s(spei_12m).2                        1.156755619e-2
#>  8 s(spei_12m).3                        4.754701909e-3
#>  9 s(spei_12m).4                        6.337976598e-3
#> 10 s(spei_12m).5                       -1.020097376e-2
#> 11 s(spei_12m).6                       -1.454098915e-2
#> 12 s(spei_12m).7                        8.166513251e-3
#> 13 s(spei_12m).8                       -9.698957616e-2
#> 14 s(spei_12m).9                        1.235130786e-1
#> 15 te(gini_index,gdp_per_capita).1     -8.556457864e-1
#> 16 te(gini_index,gdp_per_capita).2     -7.224516122e-1
#> 17 te(gini_index,gdp_per_capita).3     -2.827645944e-1
#> 18 te(gini_index,gdp_per_capita).4     -1.094567061e+1
#> 19 te(gini_index,gdp_per_capita).5      3.598357623e-1
#> 20 te(gini_index,gdp_per_capita).6      4.827606608e-1
#> 21 te(gini_index,gdp_per_capita).7     -5.899899923e-1
#> 22 te(gini_index,gdp_per_capita).8      5.504596430e-1
#> 23 te(gini_index,gdp_per_capita).9      5.524840940e-1
#> 24 te(gini_index,gdp_per_capita).10     2.844405483e-1
#> 25 te(gini_index,gdp_per_capita).11     2.045659083e-1
#> 26 te(gini_index,gdp_per_capita).12    -1.408739512e-1
#> 27 te(gini_index,gdp_per_capita).13     2.382674646e-1
#> 28 te(gini_index,gdp_per_capita).14     1.964827711e+0
#> 29 te(gini_index,gdp_per_capita).15     5.051195718e-1
#> 30 te(gini_index,gdp_per_capita).16     5.758265299e-1
#> 31 te(gini_index,gdp_per_capita).17    -8.435021101e-2
#> 32 te(gini_index,gdp_per_capita).18     4.331171232e-1
#> 33 te(gini_index,gdp_per_capita).19     1.727817001e+0
#> 34 te(gini_index,gdp_per_capita).20     1.397239247e-1
#> 35 te(gini_index,gdp_per_capita).21     2.023106661e-1
#> 36 te(gini_index,gdp_per_capita).22     1.850316980e-1
#> 37 te(gini_index,gdp_per_capita).23     1.673017311e-1
#> 38 te(gini_index,gdp_per_capita).24    -7.210640222e+0
#> 39 s(year).1                            2.260332599e-1
#> 40 s(year).2                            3.480525980e-1
#> 41 s(year).3                           -1.769362763e-1
#> 42 s(year).4                           -8.164849412e-2
#> 43 s(year).5                            4.943527290e-2
#> 44 s(year).6                           -7.393054959e-2
#> 45 s(year).7                           -7.621420067e-2
#> 46 s(year).8                            4.515143616e-1
#> 47 s(year).9                           -3.729177710e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    1.223297314e-24  0.5789015684           0.3501118687  0.6460694532
#> 2 observed 1.223297314e-24  0.5011029296           0.1069083324  0.4559647681
#> 3 estimate 1.223297314e-24  0.4778441467           0.01041126877 0.4377095149
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(30.113) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.788460599  0.005088725 -744.4812 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq    p-value    
#> s(spei_12m)                    8.693886  8.973164  336.6217 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.413296 19.445870 3048.6243 < 2.22e-16 ***
#> s(year)                        8.126491  8.793665  603.6286 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0107   Deviance explained = 12.5%
#> -REML = -85100  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.623367332e+1
#> 2 logLik         8.519764335e+4
#> 3 AIC           -1.703168613e+5
#> 4 BIC           -1.699923134e+5
#> 5 deviance       3.165534628e+4
#> 6 df.residual    2.900876633e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -1.065536510e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               2.614309967e-2
#>  2 mean((Intercept))                   -3.788460599e+0
#>  3 mean(s(spei_12m))                   -4.213820189e-2
#>  4 mean(te(gini_index,gdp_per_capita))  1.590182328e-1
#>  5 mean(s(year))                        1.639355682e-1
#>  6 s(spei_12m).1                        2.847027221e-1
#>  7 s(spei_12m).2                       -5.242858975e-1
#>  8 s(spei_12m).3                        2.552339559e-1
#>  9 s(spei_12m).4                        5.033466544e-1
#> 10 s(spei_12m).5                       -1.487123986e-1
#> 11 s(spei_12m).6                        5.674860315e-1
#> 12 s(spei_12m).7                       -3.050659231e-1
#> 13 s(spei_12m).8                       -1.407882044e+0
#> 14 s(spei_12m).9                        3.959330818e-1
#> 15 te(gini_index,gdp_per_capita).1     -1.111069076e+0
#> 16 te(gini_index,gdp_per_capita).2     -9.755193797e-1
#> 17 te(gini_index,gdp_per_capita).3     -9.383646574e-1
#> 18 te(gini_index,gdp_per_capita).4     -2.284407943e+0
#> 19 te(gini_index,gdp_per_capita).5      3.588983232e-1
#> 20 te(gini_index,gdp_per_capita).6      2.400235029e-1
#> 21 te(gini_index,gdp_per_capita).7     -5.773962914e-1
#> 22 te(gini_index,gdp_per_capita).8      2.258867873e-1
#> 23 te(gini_index,gdp_per_capita).9     -1.724633743e-1
#> 24 te(gini_index,gdp_per_capita).10     8.201945750e-1
#> 25 te(gini_index,gdp_per_capita).11     3.160445631e-1
#> 26 te(gini_index,gdp_per_capita).12    -6.636427586e-2
#> 27 te(gini_index,gdp_per_capita).13     2.216562372e-1
#> 28 te(gini_index,gdp_per_capita).14     5.604027066e-1
#> 29 te(gini_index,gdp_per_capita).15     9.563603306e-1
#> 30 te(gini_index,gdp_per_capita).16     6.379267936e-1
#> 31 te(gini_index,gdp_per_capita).17    -3.227620763e-1
#> 32 te(gini_index,gdp_per_capita).18     8.227631579e-1
#> 33 te(gini_index,gdp_per_capita).19     1.296138996e+0
#> 34 te(gini_index,gdp_per_capita).20     6.186414897e-1
#> 35 te(gini_index,gdp_per_capita).21    -2.197499782e-1
#> 36 te(gini_index,gdp_per_capita).22    -1.013159674e+0
#> 37 te(gini_index,gdp_per_capita).23    -1.061511936e+0
#> 38 te(gini_index,gdp_per_capita).24     5.484268788e+0
#> 39 s(year).1                            1.298912378e-1
#> 40 s(year).2                            7.920427295e-1
#> 41 s(year).3                            1.715288087e-1
#> 42 s(year).4                           -3.445560324e-1
#> 43 s(year).5                           -8.500264034e-2
#> 44 s(year).6                           -1.370209967e-1
#> 45 s(year).7                           -1.172903492e-1
#> 46 s(year).8                            9.263411627e-1
#> 47 s(year).9                            1.394861936e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    3.135124790e-24  0.4386344126          2.754406321e-1 0.5079354649
#> 2 observed 3.135124790e-24  0.1945362126          8.944062476e-2 0.2661064049
#> 3 estimate 3.135124790e-24  0.3128056866          3.775205272e-3 0.3758159024
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(97.006) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.34517152  0.00381667 -876.4635 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df   Chi.sq    p-value    
#> s(spei_12m)                    6.818805  7.961869 240.8820 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 16.136963 17.554865 909.7967 < 2.22e-16 ***
#> s(year)                        8.546586  8.932752 215.8262 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0414   Deviance explained = 7.85%
#> -REML = -49903  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.142427104e-2 weak           cohen1988
#> 2 SE       2.736152899e-3 <NA>           <NA>     
#> 3 Lower CI 3.606150990e-2 weak           cohen1988
#> 4 Upper CI 4.678703217e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.250235338e+1
#> 2 logLik         4.998610828e+4
#> 3 AIC           -9.989969155e+4
#> 4 BIC           -9.961565862e+4
#> 5 deviance       1.849002609e+4
#> 6 df.residual    1.860049765e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  4.142427104e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -3.047356929e-2
#>  2 mean((Intercept))                   -3.345171523e+0
#>  3 mean(s(spei_12m))                    4.225728384e-2
#>  4 mean(te(gini_index,gdp_per_capita))  2.292862782e-2
#>  5 mean(s(year))                        1.226894913e-1
#>  6 s(spei_12m).1                       -1.875084990e-2
#>  7 s(spei_12m).2                        3.798724462e-2
#>  8 s(spei_12m).3                        6.800823251e-2
#>  9 s(spei_12m).4                        1.810036606e-2
#> 10 s(spei_12m).5                        3.882320265e-2
#> 11 s(spei_12m).6                        3.345659343e-2
#> 12 s(spei_12m).7                       -2.251618924e-3
#> 13 s(spei_12m).8                        1.536563874e-1
#> 14 s(spei_12m).9                        5.128599675e-2
#> 15 te(gini_index,gdp_per_capita).1     -5.657507162e-1
#> 16 te(gini_index,gdp_per_capita).2     -8.166655648e-1
#> 17 te(gini_index,gdp_per_capita).3     -9.351097430e-1
#> 18 te(gini_index,gdp_per_capita).4     -2.045032809e+0
#> 19 te(gini_index,gdp_per_capita).5      1.087263930e-1
#> 20 te(gini_index,gdp_per_capita).6     -4.996336921e-2
#> 21 te(gini_index,gdp_per_capita).7     -6.172350343e-2
#> 22 te(gini_index,gdp_per_capita).8     -1.767549232e-1
#> 23 te(gini_index,gdp_per_capita).9     -4.210277676e-1
#> 24 te(gini_index,gdp_per_capita).10     2.430854408e-1
#> 25 te(gini_index,gdp_per_capita).11     5.746072511e-2
#> 26 te(gini_index,gdp_per_capita).12    -1.307829409e-2
#> 27 te(gini_index,gdp_per_capita).13    -4.046645080e-2
#> 28 te(gini_index,gdp_per_capita).14     7.315849399e-2
#> 29 te(gini_index,gdp_per_capita).15     4.020858376e-1
#> 30 te(gini_index,gdp_per_capita).16     7.232099530e-2
#> 31 te(gini_index,gdp_per_capita).17     1.303862184e-1
#> 32 te(gini_index,gdp_per_capita).18    -8.201898991e-2
#> 33 te(gini_index,gdp_per_capita).19     6.086204874e-1
#> 34 te(gini_index,gdp_per_capita).20     1.056016754e-1
#> 35 te(gini_index,gdp_per_capita).21     1.070040759e-1
#> 36 te(gini_index,gdp_per_capita).22     1.384044511e-1
#> 37 te(gini_index,gdp_per_capita).23     1.064024989e-1
#> 38 te(gini_index,gdp_per_capita).24     3.604621906e+0
#> 39 s(year).1                           -1.350140188e-1
#> 40 s(year).2                            5.566565020e-1
#> 41 s(year).3                            2.245625762e-1
#> 42 s(year).4                           -2.347988636e-1
#> 43 s(year).5                            7.913054830e-2
#> 44 s(year).6                           -6.095078426e-2
#> 45 s(year).7                           -1.439211357e-1
#> 46 s(year).8                            6.996932754e-1
#> 47 s(year).9                            1.188473217e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.588613525e-24  0.8429077979          5.455094612e-1 0.8634520043
#> 2 observed 2.588613525e-24  0.6622285703          1.480704111e-1 0.4259404839
#> 3 estimate 2.588613525e-24  0.6993780697          5.125519725e-3 0.6055875044
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(122.996) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.325435627  0.009245964 -359.6635 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                    edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)                   1.004795 1.009506  0.14867  0.7065947    
#> te(gini_index,gdp_per_capita) 8.455573 9.566611 93.45654 < 2.22e-16 ***
#> s(year)                       3.256705 4.040311 16.43895  0.0026288 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0233   Deviance explained = 5.22%
#> -REML = -6999.6  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.326617198e-2 weak                   cohen1988
#> 2 SE       5.648188107e-3 <NA>                   <NA>     
#> 3 Lower CI 1.219592671e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.433641725e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.371707324e+1
#> 2 logLik         7.023778556e+3
#> 3 AIC           -1.401432425e+4
#> 4 BIC           -1.391729874e+4
#> 5 deviance       2.489902384e+3
#> 6 df.residual    2.524282927e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.326617198e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -8.625410604e-2
#>  2 mean((Intercept))                   -3.325435627e+0
#>  3 mean(s(spei_12m))                    4.791637459e-4
#>  4 mean(te(gini_index,gdp_per_capita)) -1.739341328e-2
#>  5 mean(s(year))                        3.293168048e-3
#>  6 s(spei_12m).1                       -3.000760073e-6
#>  7 s(spei_12m).2                        2.378060235e-5
#>  8 s(spei_12m).3                       -3.825313518e-6
#>  9 s(spei_12m).4                       -1.782378262e-5
#> 10 s(spei_12m).5                       -1.219955622e-6
#> 11 s(spei_12m).6                        1.592070510e-5
#> 12 s(spei_12m).7                        3.877806512e-6
#> 13 s(spei_12m).8                        1.017514304e-4
#> 14 s(spei_12m).9                        4.193012981e-3
#> 15 te(gini_index,gdp_per_capita).1      2.056445091e-1
#> 16 te(gini_index,gdp_per_capita).2      2.025550502e-1
#> 17 te(gini_index,gdp_per_capita).3      1.762393863e-1
#> 18 te(gini_index,gdp_per_capita).4     -1.224984698e+0
#> 19 te(gini_index,gdp_per_capita).5      3.997798585e-2
#> 20 te(gini_index,gdp_per_capita).6     -5.588922976e-2
#> 21 te(gini_index,gdp_per_capita).7      1.003110153e-1
#> 22 te(gini_index,gdp_per_capita).8     -1.097129110e-1
#> 23 te(gini_index,gdp_per_capita).9     -2.744763933e-1
#> 24 te(gini_index,gdp_per_capita).10     1.009906730e-1
#> 25 te(gini_index,gdp_per_capita).11     4.814252520e-2
#> 26 te(gini_index,gdp_per_capita).12     9.443936146e-2
#> 27 te(gini_index,gdp_per_capita).13    -4.685388064e-3
#> 28 te(gini_index,gdp_per_capita).14    -2.249644666e-3
#> 29 te(gini_index,gdp_per_capita).15     8.607675486e-2
#> 30 te(gini_index,gdp_per_capita).16    -1.953587180e-2
#> 31 te(gini_index,gdp_per_capita).17     9.941076722e-2
#> 32 te(gini_index,gdp_per_capita).18    -1.040876840e-1
#> 33 te(gini_index,gdp_per_capita).19     3.400208987e-1
#> 34 te(gini_index,gdp_per_capita).20    -6.789080279e-1
#> 35 te(gini_index,gdp_per_capita).21    -6.223248618e-1
#> 36 te(gini_index,gdp_per_capita).22    -5.815863294e-1
#> 37 te(gini_index,gdp_per_capita).23    -5.333180324e-1
#> 38 te(gini_index,gdp_per_capita).24     2.300508226e+0
#> 39 s(year).1                            4.704513755e-2
#> 40 s(year).2                           -8.055814693e-3
#> 41 s(year).3                            8.333243278e-3
#> 42 s(year).4                           -2.344524022e-2
#> 43 s(year).5                           -9.570532424e-3
#> 44 s(year).6                           -1.405328347e-2
#> 45 s(year).7                           -5.946110945e-3
#> 46 s(year).8                            8.608179055e-2
#> 47 s(year).9                           -5.075067719e-2
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.623684980e-25  0.5766265013          4.569162593e-1 0.6028488674
#> 2 observed 2.623684980e-25  0.5543540266          2.240419253e-2 0.1014019908
#> 3 estimate 2.623684980e-25  0.4331896267          9.220398167e-3 0.3812821727
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 201: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(maper_mpepr_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.355) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.755977108  0.008386769 -328.6101 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq      p-value    
#> s(spei_12m)                    4.776535  5.938639  37.82482 0.0000036304 ***
#> te(gini_index,gdp_per_capita) 18.075045 19.824315 343.32429   < 2.22e-16 ***
#> s(year)                        7.118255  8.171091  97.69835   < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00387   Deviance explained = 7.31%
#> -REML = -13651  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.096983533e+1
#> 2 logLik         1.372709120e+4
#> 3 AIC           -2.738277232e+4
#> 4 BIC           -2.713670572e+4
#> 5 deviance       7.309308647e+3
#> 6 df.residual    7.240030165e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -3.869200836e-3
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -4.406019910e-1
#>  2 mean((Intercept))                   -2.755977108e+0
#>  3 mean(s(spei_12m))                    3.219014311e-2
#>  4 mean(te(gini_index,gdp_per_capita)) -6.829197948e-1
#>  5 mean(s(year))                       -9.949413102e-3
#>  6 s(spei_12m).1                        1.901856231e-1
#>  7 s(spei_12m).2                        8.593523485e-3
#>  8 s(spei_12m).3                        1.887645942e-2
#>  9 s(spei_12m).4                        3.190725471e-3
#> 10 s(spei_12m).5                       -5.489184874e-3
#> 11 s(spei_12m).6                       -7.158724704e-3
#> 12 s(spei_12m).7                        9.845276069e-4
#> 13 s(spei_12m).8                       -4.179726603e-2
#> 14 s(spei_12m).9                        1.223256045e-1
#> 15 te(gini_index,gdp_per_capita).1     -8.133208281e-1
#> 16 te(gini_index,gdp_per_capita).2     -6.051457892e-1
#> 17 te(gini_index,gdp_per_capita).3     -4.607665795e-2
#> 18 te(gini_index,gdp_per_capita).4     -1.824669954e+1
#> 19 te(gini_index,gdp_per_capita).5      4.099811690e-1
#> 20 te(gini_index,gdp_per_capita).6      4.829684339e-1
#> 21 te(gini_index,gdp_per_capita).7     -5.519273677e-1
#> 22 te(gini_index,gdp_per_capita).8      6.056486376e-1
#> 23 te(gini_index,gdp_per_capita).9      1.996272080e+0
#> 24 te(gini_index,gdp_per_capita).10     3.643412525e-1
#> 25 te(gini_index,gdp_per_capita).11     2.128293996e-1
#> 26 te(gini_index,gdp_per_capita).12    -1.541639457e-1
#> 27 te(gini_index,gdp_per_capita).13     2.162996575e-1
#> 28 te(gini_index,gdp_per_capita).14     3.609528286e+0
#> 29 te(gini_index,gdp_per_capita).15     5.284393397e-1
#> 30 te(gini_index,gdp_per_capita).16     5.492881349e-1
#> 31 te(gini_index,gdp_per_capita).17    -9.042076004e-2
#> 32 te(gini_index,gdp_per_capita).18     4.216994722e-1
#> 33 te(gini_index,gdp_per_capita).19     3.167660757e+0
#> 34 te(gini_index,gdp_per_capita).20     3.888327555e-2
#> 35 te(gini_index,gdp_per_capita).21     1.739075164e-1
#> 36 te(gini_index,gdp_per_capita).22     2.076039317e-1
#> 37 te(gini_index,gdp_per_capita).23     2.295642425e-1
#> 38 te(gini_index,gdp_per_capita).24    -9.097235769e+0
#> 39 s(year).1                            1.807572260e-1
#> 40 s(year).2                            1.161355703e-1
#> 41 s(year).3                           -2.251154272e-1
#> 42 s(year).4                           -1.667130746e-2
#> 43 s(year).5                            2.517080232e-2
#> 44 s(year).6                            5.177043688e-2
#> 45 s(year).7                           -4.796922227e-2
#> 46 s(year).8                            1.954662025e-1
#> 47 s(year).9                           -3.690889990e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    1.223297314e-24  0.5789015684           0.3501118687  0.6460694532
#> 2 observed 1.223297314e-24  0.5094922954           0.1125723691  0.3239213260
#> 3 estimate 1.223297314e-24  0.4778441467           0.01041126877 0.4377095149
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(21.349) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.172948414  0.004884498 -649.5956 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq    p-value    
#> s(spei_12m)                    8.666888  8.968644  283.0247 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.608027 19.730851 3171.5181 < 2.22e-16 ***
#> s(year)                        8.388341  8.894377  575.4291 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0111   Deviance explained = 12.8%
#> -REML = -65624  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.111641718e-2 very weak (negligible) cohen1988
#> 2 SE       1.170324273e-3 <NA>                   <NA>     
#> 3 Lower CI 8.822623756e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.341021061e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.666325572e+1
#> 2 logLik         6.572498770e+4
#> 3 AIC           -1.313707877e+5
#> 4 BIC           -1.310430850e+5
#> 5 deviance       3.083079009e+4
#> 6 df.residual    2.900833674e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  1.111641718e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               1.929476076e-2
#>  2 mean((Intercept))                   -3.172948414e+0
#>  3 mean(s(spei_12m))                   -1.514257407e-2
#>  4 mean(te(gini_index,gdp_per_capita))  1.140287882e-1
#>  5 mean(s(year))                        1.558017086e-1
#>  6 s(spei_12m).1                        2.290782865e-1
#>  7 s(spei_12m).2                       -3.341316471e-1
#>  8 s(spei_12m).3                        1.851363596e-1
#>  9 s(spei_12m).4                        3.666112998e-1
#> 10 s(spei_12m).5                       -1.387769113e-1
#> 11 s(spei_12m).6                        4.511793117e-1
#> 12 s(spei_12m).7                       -2.569627908e-1
#> 13 s(spei_12m).8                       -1.003286496e+0
#> 14 s(spei_12m).9                        3.648694214e-1
#> 15 te(gini_index,gdp_per_capita).1     -1.115667926e+0
#> 16 te(gini_index,gdp_per_capita).2     -1.078525120e+0
#> 17 te(gini_index,gdp_per_capita).3     -1.092221740e+0
#> 18 te(gini_index,gdp_per_capita).4     -9.843288210e-2
#> 19 te(gini_index,gdp_per_capita).5      5.527960466e-1
#> 20 te(gini_index,gdp_per_capita).6      1.854050696e-1
#> 21 te(gini_index,gdp_per_capita).7     -4.864994412e-1
#> 22 te(gini_index,gdp_per_capita).8      1.463440865e-1
#> 23 te(gini_index,gdp_per_capita).9      4.322865670e-1
#> 24 te(gini_index,gdp_per_capita).10     8.199258421e-1
#> 25 te(gini_index,gdp_per_capita).11     2.947882962e-1
#> 26 te(gini_index,gdp_per_capita).12    -6.195427247e-2
#> 27 te(gini_index,gdp_per_capita).13     1.475593332e-1
#> 28 te(gini_index,gdp_per_capita).14     6.184043553e-1
#> 29 te(gini_index,gdp_per_capita).15     9.412130801e-1
#> 30 te(gini_index,gdp_per_capita).16     5.459611382e-1
#> 31 te(gini_index,gdp_per_capita).17    -2.565181724e-1
#> 32 te(gini_index,gdp_per_capita).18     6.410611405e-1
#> 33 te(gini_index,gdp_per_capita).19     8.094024602e-1
#> 34 te(gini_index,gdp_per_capita).20     8.493565579e-1
#> 35 te(gini_index,gdp_per_capita).21     1.656340390e-1
#> 36 te(gini_index,gdp_per_capita).22    -9.887089081e-1
#> 37 te(gini_index,gdp_per_capita).23    -1.201792529e+0
#> 38 te(gini_index,gdp_per_capita).24     1.966873895e+0
#> 39 s(year).1                            1.053706023e-1
#> 40 s(year).2                            7.048957870e-1
#> 41 s(year).3                            1.701448202e-1
#> 42 s(year).4                           -3.525761319e-1
#> 43 s(year).5                           -1.379700020e-1
#> 44 s(year).6                           -9.816284554e-2
#> 45 s(year).7                           -8.525749605e-2
#> 46 s(year).8                            8.641039214e-1
#> 47 s(year).9                            2.316667224e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    3.135124790e-24  0.4386344126          2.754406321e-1 0.5079354649
#> 2 observed 3.135124790e-24  0.1740116393          1.114188370e-1 0.2200943491
#> 3 estimate 3.135124790e-24  0.3128056866          3.775205272e-3 0.3758159024
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(51.451) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.651927983  0.003844841 -689.7368 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df   Chi.sq    p-value    
#> s(spei_12m)                    6.641757  7.813143 153.5556 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 14.962768 16.553873 683.3973 < 2.22e-16 ***
#> s(year)                        8.554171  8.934388 196.6720 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0461   Deviance explained = 6.64%
#> -REML = -38025  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.606146655e-2 weak           cohen1988
#> 2 SE       2.871281478e-3 <NA>           <NA>     
#> 3 Lower CI 4.043385826e-2 weak           cohen1988
#> 4 Upper CI 5.168907483e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.115869583e+1
#> 2 logLik         3.810148158e+4
#> 3 AIC           -7.613236036e+4
#> 4 BIC           -7.585585542e+4
#> 5 deviance       1.823573248e+4
#> 6 df.residual    1.860184130e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  4.606146655e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               4.285571478e-2
#>  2 mean((Intercept))                   -2.651927983e+0
#>  3 mean(s(spei_12m))                    6.313432897e-2
#>  4 mean(te(gini_index,gdp_per_capita))  1.352025702e-1
#>  5 mean(s(year))                        7.573923040e-2
#>  6 s(spei_12m).1                        1.452129842e-2
#>  7 s(spei_12m).2                        9.956789165e-2
#>  8 s(spei_12m).3                        3.699797817e-2
#>  9 s(spei_12m).4                        4.469130283e-2
#> 10 s(spei_12m).5                        2.983332191e-2
#> 11 s(spei_12m).6                        6.930840958e-2
#> 12 s(spei_12m).7                       -3.452431812e-3
#> 13 s(spei_12m).8                        2.520160486e-1
#> 14 s(spei_12m).9                        2.472514138e-2
#> 15 te(gini_index,gdp_per_capita).1     -3.668986012e-1
#> 16 te(gini_index,gdp_per_capita).2     -5.469731831e-1
#> 17 te(gini_index,gdp_per_capita).3     -6.559186599e-1
#> 18 te(gini_index,gdp_per_capita).4     -4.691881697e+0
#> 19 te(gini_index,gdp_per_capita).5      1.417652835e-1
#> 20 te(gini_index,gdp_per_capita).6     -6.229878061e-2
#> 21 te(gini_index,gdp_per_capita).7     -6.666018409e-2
#> 22 te(gini_index,gdp_per_capita).8     -1.452393721e-1
#> 23 te(gini_index,gdp_per_capita).9     -9.753825325e-1
#> 24 te(gini_index,gdp_per_capita).10     2.273964125e-1
#> 25 te(gini_index,gdp_per_capita).11     2.939425078e-2
#> 26 te(gini_index,gdp_per_capita).12    -2.212000527e-2
#> 27 te(gini_index,gdp_per_capita).13    -3.783396595e-2
#> 28 te(gini_index,gdp_per_capita).14     1.279722294e-1
#> 29 te(gini_index,gdp_per_capita).15     3.467158628e-1
#> 30 te(gini_index,gdp_per_capita).16     7.329488361e-2
#> 31 te(gini_index,gdp_per_capita).17     1.090954339e-1
#> 32 te(gini_index,gdp_per_capita).18    -5.725255595e-2
#> 33 te(gini_index,gdp_per_capita).19     1.301381627e+0
#> 34 te(gini_index,gdp_per_capita).20     2.238465500e-1
#> 35 te(gini_index,gdp_per_capita).21     1.085876272e-1
#> 36 te(gini_index,gdp_per_capita).22     9.595694236e-2
#> 37 te(gini_index,gdp_per_capita).23     6.102479284e-2
#> 38 te(gini_index,gdp_per_capita).24     8.026889327e+0
#> 39 s(year).1                           -1.504422998e-1
#> 40 s(year).2                            2.357220644e-1
#> 41 s(year).3                            1.583952211e-1
#> 42 s(year).4                           -5.762623951e-2
#> 43 s(year).5                            1.442739384e-2
#> 44 s(year).6                            1.069989405e-1
#> 45 s(year).7                           -7.537140806e-2
#> 46 s(year).8                            2.433103749e-1
#> 47 s(year).9                            2.062390261e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.588613525e-24  0.8429077979          5.455094612e-1 0.8634520043
#> 2 observed 2.588613525e-24  0.6351147850          1.396226946e-1 0.5876180816
#> 3 estimate 2.588613525e-24  0.6993780697          5.125519725e-3 0.6055875044
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(64.445) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.696690087  0.009596718 -281.0013 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                    edf   Ref.df   Chi.sq      p-value    
#> s(spei_12m)                   1.006809 1.013479  0.04768      0.84493    
#> te(gini_index,gdp_per_capita) 7.891249 9.063510 62.00787   < 2.22e-16 ***
#> s(year)                       3.589674 4.450285 33.28154 0.0000030492 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0371   Deviance explained = 4.81%
#> -REML = -5460.6  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.708724622e-2 weak           cohen1988
#> 2 SE       7.030232508e-3 <NA>           <NA>     
#> 3 Lower CI 2.330824370e-2 weak           cohen1988
#> 4 Upper CI 5.086624873e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.348773209e+1
#> 2 logLik         5.483736802e+3
#> 3 AIC           -1.093441906e+4
#> 4 BIC           -1.083791413e+4
#> 5 deviance       2.479754506e+3
#> 6 df.residual    2.524512268e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  3.708724622e-2
#> 9 npar           4.3        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -9.528423826e-2
#>  2 mean((Intercept))                   -2.696690087e+0
#>  3 mean(s(spei_12m))                    3.027541075e-4
#>  4 mean(te(gini_index,gdp_per_capita)) -5.804847399e-2
#>  5 mean(s(year))                       -1.121507684e-3
#>  6 s(spei_12m).1                        1.994354489e-6
#>  7 s(spei_12m).2                        4.738565501e-5
#>  8 s(spei_12m).3                       -6.827216411e-6
#>  9 s(spei_12m).4                       -3.440676403e-5
#> 10 s(spei_12m).5                       -4.793365804e-6
#> 11 s(spei_12m).6                        3.222716085e-5
#> 12 s(spei_12m).7                        7.421792535e-6
#> 13 s(spei_12m).8                        2.055853066e-4
#> 14 s(spei_12m).9                        2.476200045e-3
#> 15 te(gini_index,gdp_per_capita).1      2.334163582e-1
#> 16 te(gini_index,gdp_per_capita).2      2.283275142e-1
#> 17 te(gini_index,gdp_per_capita).3      1.953928059e-1
#> 18 te(gini_index,gdp_per_capita).4     -1.576059212e+0
#> 19 te(gini_index,gdp_per_capita).5      4.004715109e-2
#> 20 te(gini_index,gdp_per_capita).6     -7.059898593e-2
#> 21 te(gini_index,gdp_per_capita).7      1.085244476e-1
#> 22 te(gini_index,gdp_per_capita).8     -1.347438946e-1
#> 23 te(gini_index,gdp_per_capita).9     -5.778155428e-1
#> 24 te(gini_index,gdp_per_capita).10     8.633459914e-2
#> 25 te(gini_index,gdp_per_capita).11     3.286863627e-2
#> 26 te(gini_index,gdp_per_capita).12     9.000450242e-2
#> 27 te(gini_index,gdp_per_capita).13    -1.730461499e-2
#> 28 te(gini_index,gdp_per_capita).14    -2.916474382e-1
#> 29 te(gini_index,gdp_per_capita).15     6.260895042e-2
#> 30 te(gini_index,gdp_per_capita).16    -4.703797272e-2
#> 31 te(gini_index,gdp_per_capita).17     9.549187975e-2
#> 32 te(gini_index,gdp_per_capita).18    -1.294522719e-1
#> 33 te(gini_index,gdp_per_capita).19     5.586287163e-2
#> 34 te(gini_index,gdp_per_capita).20    -4.476376416e-1
#> 35 te(gini_index,gdp_per_capita).21    -4.157154991e-1
#> 36 te(gini_index,gdp_per_capita).22    -3.862159033e-1
#> 37 te(gini_index,gdp_per_capita).23    -3.618983154e-1
#> 38 te(gini_index,gdp_per_capita).24     1.834084200e+0
#> 39 s(year).1                            7.432373471e-2
#> 40 s(year).2                           -1.289563749e-2
#> 41 s(year).3                            6.509401359e-3
#> 42 s(year).4                           -2.220604991e-2
#> 43 s(year).5                           -1.452598432e-2
#> 44 s(year).6                           -1.043189976e-2
#> 45 s(year).7                           -4.549882866e-3
#> 46 s(year).8                            7.621055805e-2
#> 47 s(year).9                           -1.025278089e-1
#> 
#> # A tibble: 3 × 5
#>   names               para `s(spei_12m)` te(gini_index,gdp_per…¹    `s(year)`
#>   <chr>              <dbl>         <dbl>                   <dbl>        <dbl>
#> 1 worst    2.623684980e-25  0.5766265013          4.569162593e-1 0.6028488674
#> 2 observed 2.623684980e-25  0.5546254028          3.650230025e-2 0.1791322168
#> 3 estimate 2.623684980e-25  0.4331896267          9.220398167e-3 0.3812821727
#> # ℹ abbreviated name: ¹​`te(gini_index,gdp_per_capita)`
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 202: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(spei_12m) + te(gini_index, gdp_per_capita) + year (Unordered year)

Code
mbepr_gam_2_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mbepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mbepr_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(20.645) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.794785629  0.009053899 -308.6831 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       2.335405 2.986140  14.35475  0.0023168 ** 
#> s(gini_index)     5.792060 6.961159 518.33928 < 2.22e-16 ***
#> s(gdp_per_capita) 7.273295 8.271906  77.13924 < 2.22e-16 ***
#> s(year)           7.468833 8.414253 202.49518 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0177   Deviance explained =   11%
#> -REML = -13702  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.765931166e-2 very weak (negligible) cohen1988
#> 2 SE       2.928714579e-3 <NA>                   <NA>     
#> 3 Lower CI 1.191913657e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.339948676e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.386959237e+1
#> 2 logLik         1.375878493e+4
#> 3 AIC           -2.746144484e+4
#> 4 BIC           -2.726804787e+4
#> 5 deviance       7.431966409e+3
#> 6 df.residual    7.247130408e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  1.765931166e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -4.010255658e-2
#>  2 mean((Intercept))       -2.794785629e+0
#>  3 mean(s(spei_12m))       -3.284141535e-3
#>  4 mean(s(gini_index))     -3.758782747e-2
#>  5 mean(s(gdp_per_capita))  1.606317999e-2
#>  6 mean(s(year))            1.704744597e-1
#>  7 s(spei_12m).1           -2.800090691e-2
#>  8 s(spei_12m).2           -6.201459178e-3
#>  9 s(spei_12m).3           -2.164087346e-3
#> 10 s(spei_12m).4            7.196284221e-5
#> 11 s(spei_12m).5            7.206934877e-4
#> 12 s(spei_12m).6           -1.404158755e-3
#> 13 s(spei_12m).7            8.579721335e-4
#> 14 s(spei_12m).8           -1.512066963e-2
#> 15 s(spei_12m).9            2.168337953e-2
#> 16 s(gini_index).1         -2.732560574e-1
#> 17 s(gini_index).2         -1.096765477e-1
#> 18 s(gini_index).3          2.284562910e-2
#> 19 s(gini_index).4          6.898758950e-2
#> 20 s(gini_index).5          1.239439639e-3
#> 21 s(gini_index).6          6.072336420e-2
#> 22 s(gini_index).7         -8.495233819e-3
#> 23 s(gini_index).8         -5.348737645e-1
#> 24 s(gini_index).9          4.342151338e-1
#> 25 s(gdp_per_capita).1     -2.693582250e-1
#> 26 s(gdp_per_capita).2      1.302634882e+0
#> 27 s(gdp_per_capita).3     -1.620643315e-1
#> 28 s(gdp_per_capita).4     -1.037084845e+0
#> 29 s(gdp_per_capita).5      3.997390158e-1
#> 30 s(gdp_per_capita).6      3.751029712e-1
#> 31 s(gdp_per_capita).7      3.790632931e-1
#> 32 s(gdp_per_capita).8     -5.283540204e-1
#> 33 s(gdp_per_capita).9     -3.151101197e-1
#> 34 s(year).1               -1.562128861e-1
#> 35 s(year).2                4.628131613e-1
#> 36 s(year).3                4.828498920e-1
#> 37 s(year).4               -4.733164369e-1
#> 38 s(year).5               -9.642104613e-2
#> 39 s(year).6               -1.893058978e-1
#> 40 s(year).7               -1.371664967e-1
#> 41 s(year).8                9.342834430e-1
#> 42 s(year).9                7.067464044e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    6.018316380e-23  0.5761405221   0.07611800630       0.3621822964 
#> 2 observed 6.018316380e-23  0.5536825861   0.04688422748       0.2746839793 
#> 3 estimate 6.018316380e-23  0.4736086041   0.04868857031       0.06453532138
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.424) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.101995783  0.004989292 -621.7307 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df     Chi.sq    p-value    
#> s(spei_12m)       7.497940 8.461656   69.96153 < 2.22e-16 ***
#> s(gini_index)     7.564992 8.510361 1750.90329 < 2.22e-16 ***
#> s(gdp_per_capita) 8.495967 8.918649  357.27585 < 2.22e-16 ***
#> s(year)           8.406827 8.898542  422.94280 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0215   Deviance explained = 9.46%
#> -REML = -63787  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.296572484e+1
#> 2 logLik         6.387643158e+4
#> 3 AIC           -1.276792847e+5
#> 4 BIC           -1.273747951e+5
#> 5 deviance       3.045167811e+4
#> 6 df.residual    2.901203428e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -2.153079024e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -6.509789391e-2
#>  2 mean((Intercept))       -3.101995783e+0
#>  3 mean(s(spei_12m))        2.974273612e-2
#>  4 mean(s(gini_index))     -1.674274894e-2
#>  5 mean(s(gdp_per_capita)) -8.211360504e-2
#>  6 mean(s(year))            1.461551411e-1
#>  7 s(spei_12m).1            1.209334810e-1
#>  8 s(spei_12m).2            4.871584887e-2
#>  9 s(spei_12m).3           -1.666547151e-3
#> 10 s(spei_12m).4            3.415842391e-2
#> 11 s(spei_12m).5           -5.651007575e-2
#> 12 s(spei_12m).6            9.381493253e-2
#> 13 s(spei_12m).7           -5.734312412e-2
#> 14 s(spei_12m).8           -7.567615749e-2
#> 15 s(spei_12m).9            1.612578432e-1
#> 16 s(gini_index).1          1.176940919e-1
#> 17 s(gini_index).2          1.463703123e-1
#> 18 s(gini_index).3         -9.351864039e-2
#> 19 s(gini_index).4         -7.501652163e-2
#> 20 s(gini_index).5         -5.505601871e-2
#> 21 s(gini_index).6          4.673897625e-2
#> 22 s(gini_index).7         -3.410661118e-3
#> 23 s(gini_index).8         -4.915618666e-1
#> 24 s(gini_index).9          2.570755876e-1
#> 25 s(gdp_per_capita).1     -1.059502179e+0
#> 26 s(gdp_per_capita).2      4.444706395e+0
#> 27 s(gdp_per_capita).3     -1.061165770e+0
#> 28 s(gdp_per_capita).4      2.284681762e+0
#> 29 s(gdp_per_capita).5      5.260063747e-2
#> 30 s(gdp_per_capita).6     -2.413318160e+0
#> 31 s(gdp_per_capita).7     -1.405491536e+0
#> 32 s(gdp_per_capita).8     -1.209907718e+0
#> 33 s(gdp_per_capita).9     -3.716258777e-1
#> 34 s(year).1               -4.643236533e-2
#> 35 s(year).2                6.738302062e-1
#> 36 s(year).3                3.075443949e-1
#> 37 s(year).4               -5.761625924e-1
#> 38 s(year).5               -9.161364383e-2
#> 39 s(year).6               -2.217606870e-1
#> 40 s(year).7               -2.072590262e-1
#> 41 s(year).8                1.170922239e+0
#> 42 s(year).9                3.063277447e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    4.416008270e-24  0.4360888285   0.01511824469       0.2789251867 
#> 2 observed 4.416008270e-24  0.2087505077   0.01381410559       0.2667515182 
#> 3 estimate 4.416008270e-24  0.3105041066   0.01025400490       0.03886406860
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(41.671) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.622912858  0.004159424 -630.5952 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq     p-value    
#> s(spei_12m)       7.943946 8.717106  51.02596  < 2.22e-16 ***
#> s(gini_index)     5.513080 6.715607 619.43820  < 2.22e-16 ***
#> s(gdp_per_capita) 8.728594 8.977220 175.28854  < 2.22e-16 ***
#> s(year)           7.785749 8.583187  41.32360 0.000001312 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0588   Deviance explained =  6.7%
#> -REML = -36213  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       5.880111415e-2 weak           cohen1988
#> 2 SE       3.200815774e-3 <NA>           <NA>     
#> 3 Lower CI 5.252763051e-2 weak           cohen1988
#> 4 Upper CI 6.507459779e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.097136877e+1
#> 2 logLik         3.629844913e+4
#> 3 AIC           -7.252691202e+4
#> 4 BIC           -7.225282178e+4
#> 5 deviance       1.814156592e+4
#> 6 df.residual    1.860202863e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  5.880111415e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -1.730125643e-1
#>  2 mean((Intercept))       -2.622912858e+0
#>  3 mean(s(spei_12m))       -9.904104487e-3
#>  4 mean(s(gini_index))      3.324272489e-2
#>  5 mean(s(gdp_per_capita)) -4.884281307e-1
#>  6 mean(s(year))            4.525039672e-2
#>  7 s(spei_12m).1           -2.411235687e-2
#>  8 s(spei_12m).2           -5.150188762e-2
#>  9 s(spei_12m).3            4.418524598e-2
#> 10 s(spei_12m).4           -1.058921762e-1
#> 11 s(spei_12m).5            5.987569521e-2
#> 12 s(spei_12m).6           -7.094119697e-2
#> 13 s(spei_12m).7            1.065834763e-1
#> 14 s(spei_12m).8           -2.320310764e-1
#> 15 s(spei_12m).9            1.846973361e-1
#> 16 s(gini_index).1          1.300029685e-2
#> 17 s(gini_index).2         -1.878149202e-2
#> 18 s(gini_index).3          1.205698947e-2
#> 19 s(gini_index).4          7.150397320e-3
#> 20 s(gini_index).5          9.804081054e-5
#> 21 s(gini_index).6         -4.910243391e-3
#> 22 s(gini_index).7          4.772716960e-3
#> 23 s(gini_index).8          1.742213047e-1
#> 24 s(gini_index).9          1.115765133e-1
#> 25 s(gdp_per_capita).1      7.031719222e-1
#> 26 s(gdp_per_capita).2      2.629725044e+0
#> 27 s(gdp_per_capita).3     -1.163267896e+0
#> 28 s(gdp_per_capita).4     -1.888879027e+0
#> 29 s(gdp_per_capita).5      5.416285616e-1
#> 30 s(gdp_per_capita).6     -2.016915875e+0
#> 31 s(gdp_per_capita).7     -1.271113210e+0
#> 32 s(gdp_per_capita).8     -1.635437685e+0
#> 33 s(gdp_per_capita).9     -2.947650107e-1
#> 34 s(year).1               -6.394348878e-2
#> 35 s(year).2                1.602570153e-1
#> 36 s(year).3                1.124404424e-1
#> 37 s(year).4               -1.214314412e-1
#> 38 s(year).5               -3.382020377e-2
#> 39 s(year).6                3.717539635e-2
#> 40 s(year).7               -4.345216234e-2
#> 41 s(year).8                1.655460317e-1
#> 42 s(year).9                1.944819809e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    2.637050883e-21  0.8426469523   0.03550855298       0.5330944727 
#> 2 observed 2.637050883e-21  0.3495974326   0.03088270092       0.5123841868 
#> 3 estimate 2.637050883e-21  0.6978053901   0.02633734989       0.05260443087
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(37.599) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>               Estimate Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.2875881  0.0104973 -217.9215 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       3.341449 4.220331   8.34256 0.09068169 .  
#> s(gini_index)     2.753885 3.505130  20.37794 0.00042007 ***
#> s(gdp_per_capita) 7.144262 8.140794 135.26661 < 2.22e-16 ***
#> s(year)           6.824398 7.908862  22.45549 0.00503786 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0963   Deviance explained = 11.4%
#> -REML = -4350.4  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.09634833785 weak           cohen1988
#> 2 SE       0.01063392569 <NA>           <NA>     
#> 3 Lower CI 0.07550622650 weak           cohen1988
#> 4 Upper CI 0.1171904492  weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.106399388e+1
#> 2 logLik         4.399800629e+3
#> 3 AIC           -8.748051022e+3
#> 4 BIC           -8.597546717e+3
#> 5 deviance       2.446588085e+3
#> 6 df.residual    2.516936006e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  9.634833785e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -2.990231968e-1
#>  2 mean((Intercept))       -2.287588141e+0
#>  3 mean(s(spei_12m))        7.046285299e-3
#>  4 mean(s(gini_index))     -2.057723480e-2
#>  5 mean(s(gdp_per_capita)) -9.942320383e-1
#>  6 mean(s(year))            3.262186105e-2
#>  7 s(spei_12m).1           -5.749924131e-2
#>  8 s(spei_12m).2            5.465565122e-2
#>  9 s(spei_12m).3            4.979509309e-4
#> 10 s(spei_12m).4           -1.169884383e-2
#> 11 s(spei_12m).5           -8.230836704e-3
#> 12 s(spei_12m).6            1.773257445e-2
#> 13 s(spei_12m).7            1.806013800e-3
#> 14 s(spei_12m).8            1.080750474e-1
#> 15 s(spei_12m).9           -4.192174822e-2
#> 16 s(gini_index).1         -4.055783192e-2
#> 17 s(gini_index).2         -2.733985840e-2
#> 18 s(gini_index).3         -5.465611918e-3
#> 19 s(gini_index).4         -1.252970108e-2
#> 20 s(gini_index).5         -5.801630650e-3
#> 21 s(gini_index).6         -1.213468482e-2
#> 22 s(gini_index).7         -5.168142860e-4
#> 23 s(gini_index).8         -8.685741112e-2
#> 24 s(gini_index).9          6.008431003e-3
#> 25 s(gdp_per_capita).1      7.693324141e-1
#> 26 s(gdp_per_capita).2     -4.848757902e+0
#> 27 s(gdp_per_capita).3     -3.383533165e-1
#> 28 s(gdp_per_capita).4     -3.207648660e+0
#> 29 s(gdp_per_capita).5      7.225122516e-1
#> 30 s(gdp_per_capita).6      2.024340427e+0
#> 31 s(gdp_per_capita).7     -1.436186167e+0
#> 32 s(gdp_per_capita).8     -2.195070964e+0
#> 33 s(gdp_per_capita).9     -4.382564283e-1
#> 34 s(year).1                1.418128481e-2
#> 35 s(year).2                6.211692971e-2
#> 36 s(year).3                1.565449604e-1
#> 37 s(year).4               -2.229009205e-1
#> 38 s(year).5                6.680584230e-3
#> 39 s(year).6                4.854319762e-2
#> 40 s(year).7               -4.388746656e-2
#> 41 s(year).8                1.599205323e-1
#> 42 s(year).9                1.123976474e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    3.858430707e-25  0.5727624185   0.04204433397       0.4205494060 
#> 2 observed 3.858430707e-25  0.3552794535   0.01747489786       0.3370786489 
#> 3 estimate 3.858430707e-25  0.4276408768   0.01993345190       0.04098973891
#> # ℹ 1 more variable: `s(year)` <dbl>
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 203: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_2_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(beipr_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(29.485) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error  z value   Pr(>|z|)    
#> (Intercept) -2.676747933  0.007784276 -343.866 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq     p-value    
#> s(spei_12m)       4.156348 5.201087  30.20657 0.000019399 ***
#> s(gini_index)     7.794767 8.618986 714.31368  < 2.22e-16 ***
#> s(gdp_per_capita) 7.991619 8.720463 112.59631  < 2.22e-16 ***
#> s(year)           5.574152 6.723712 280.48307  < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0909   Deviance explained = 14.7%
#> -REML = -13573  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       9.089254382e-2 weak           cohen1988
#> 2 SE       6.149040868e-3 <NA>           <NA>     
#> 3 Lower CI 7.884064518e-2 weak           cohen1988
#> 4 Upper CI 1.029444425e-1 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.651688584e+1
#> 2 logLik         1.363785208e+4
#> 3 AIC           -2.721434640e+4
#> 4 BIC           -2.700291835e+4
#> 5 deviance       7.384978448e+3
#> 6 df.residual    7.244483114e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  9.089254382e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -7.505897477e-2
#>  2 mean((Intercept))       -2.676747933e+0
#>  3 mean(s(spei_12m))       -3.518964215e-3
#>  4 mean(s(gini_index))     -5.437237290e-2
#>  5 mean(s(gdp_per_capita))  1.368290154e-2
#>  6 mean(s(year))            3.304908738e-2
#>  7 s(spei_12m).1           -7.493039988e-2
#>  8 s(spei_12m).2           -8.673230843e-2
#>  9 s(spei_12m).3            2.876778469e-3
#> 10 s(spei_12m).4           -2.294563216e-2
#> 11 s(spei_12m).5           -1.972962587e-2
#> 12 s(spei_12m).6            3.102751230e-2
#> 13 s(spei_12m).7           -1.516372618e-2
#> 14 s(spei_12m).8            2.004957302e-1
#> 15 s(spei_12m).9           -4.656900638e-2
#> 16 s(gini_index).1         -1.988463686e-2
#> 17 s(gini_index).2         -2.460878440e-1
#> 18 s(gini_index).3          1.213106788e-1
#> 19 s(gini_index).4          1.285509650e-1
#> 20 s(gini_index).5          9.538147034e-2
#> 21 s(gini_index).6          1.336098278e-1
#> 22 s(gini_index).7          4.572985468e-2
#> 23 s(gini_index).8         -6.172210122e-1
#> 24 s(gini_index).9         -1.307406597e-1
#> 25 s(gdp_per_capita).1     -4.920283257e-1
#> 26 s(gdp_per_capita).2      1.782176792e+0
#> 27 s(gdp_per_capita).3     -2.575549406e-1
#> 28 s(gdp_per_capita).4     -1.313757699e+0
#> 29 s(gdp_per_capita).5      6.576504901e-1
#> 30 s(gdp_per_capita).6      7.628282670e-1
#> 31 s(gdp_per_capita).7      6.990502074e-1
#> 32 s(gdp_per_capita).8     -1.376385935e+0
#> 33 s(gdp_per_capita).9     -3.388327432e-1
#> 34 s(year).1                9.356293054e-2
#> 35 s(year).2               -9.931390259e-2
#> 36 s(year).3                1.223787120e-1
#> 37 s(year).4               -3.751492538e-2
#> 38 s(year).5                2.102322445e-2
#> 39 s(year).6                1.598002720e-3
#> 40 s(year).7                5.078362540e-4
#> 41 s(year).8                1.678938543e-2
#> 42 s(year).9                1.784105229e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    6.018316380e-23  0.5761405221   0.07611800630       0.3621822964 
#> 2 observed 6.018316380e-23  0.4968736100   0.04937530226       0.3354585437 
#> 3 estimate 6.018316380e-23  0.4736086041   0.04868857031       0.06453532138
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(26.664) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.875388653  0.004268114 -673.6908 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df     Chi.sq    p-value    
#> s(spei_12m)       8.012988 8.748639   68.07721 < 2.22e-16 ***
#> s(gini_index)     7.202867 8.263537 2203.07043 < 2.22e-16 ***
#> s(gdp_per_capita) 8.460611 8.907337  349.62878 < 2.22e-16 ***
#> s(year)           7.456602 8.414459  407.63012 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0466   Deviance explained =   11%
#> -REML = -57765  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.213306824e+1
#> 2 logLik         5.785090545e+4
#> 3 AIC           -1.156315675e+5
#> 4 BIC           -1.153408793e+5
#> 5 deviance       3.026652769e+4
#> 6 df.residual    2.901286693e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -4.663147104e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -4.242595971e-2
#>  2 mean((Intercept))       -2.875388653e+0
#>  3 mean(s(spei_12m))       -4.281364360e-3
#>  4 mean(s(gini_index))      7.334053918e-2
#>  5 mean(s(gdp_per_capita)) -3.111999236e-2
#>  6 mean(s(year))            1.071306112e-1
#>  7 s(spei_12m).1            1.892045468e-1
#>  8 s(spei_12m).2           -3.115681936e-1
#>  9 s(spei_12m).3            2.050353739e-1
#> 10 s(spei_12m).4            2.862686075e-1
#> 11 s(spei_12m).5           -7.477958765e-2
#> 12 s(spei_12m).6            2.208019701e-1
#> 13 s(spei_12m).7           -1.483630859e-1
#> 14 s(spei_12m).8           -7.353569523e-1
#> 15 s(spei_12m).9            3.302250419e-1
#> 16 s(gini_index).1          1.238974793e-1
#> 17 s(gini_index).2          6.069056416e-3
#> 18 s(gini_index).3         -4.846869766e-2
#> 19 s(gini_index).4         -5.505074234e-3
#> 20 s(gini_index).5          9.342130405e-3
#> 21 s(gini_index).6          8.583941454e-3
#> 22 s(gini_index).7          2.133120986e-2
#> 23 s(gini_index).8          2.300665296e-1
#> 24 s(gini_index).9          3.147482775e-1
#> 25 s(gdp_per_capita).1     -7.656078008e-1
#> 26 s(gdp_per_capita).2      3.446682170e+0
#> 27 s(gdp_per_capita).3     -7.771330820e-1
#> 28 s(gdp_per_capita).4      1.788497240e+0
#> 29 s(gdp_per_capita).5      4.438083677e-2
#> 30 s(gdp_per_capita).6     -1.893039368e+0
#> 31 s(gdp_per_capita).7     -1.132328474e+0
#> 32 s(gdp_per_capita).8     -6.690332114e-1
#> 33 s(gdp_per_capita).9     -3.224982414e-1
#> 34 s(year).1                2.980586938e-2
#> 35 s(year).2                4.550423119e-1
#> 36 s(year).3                2.328937988e-1
#> 37 s(year).4               -3.649894777e-1
#> 38 s(year).5               -1.094505489e-2
#> 39 s(year).6               -1.844159168e-1
#> 40 s(year).7               -1.080741056e-1
#> 41 s(year).8                7.371471256e-1
#> 42 s(year).9                1.777109506e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    4.416008270e-24 0.4360888285    0.01511824469       0.2789251867 
#> 2 observed 4.416008270e-24 0.09039186311   0.01414024439       0.2713209088 
#> 3 estimate 4.416008270e-24 0.3105041066    0.01025400490       0.03886406860
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(80.655) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.516242491  0.002993073 -840.6885 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df     Chi.sq    p-value    
#> s(spei_12m)       8.035094 8.760306   46.92834 < 2.22e-16 ***
#> s(gini_index)     5.822206 7.026123 1141.86412 < 2.22e-16 ***
#> s(gdp_per_capita) 8.877345 8.995242  543.27625 < 2.22e-16 ***
#> s(year)           7.187456 8.163338  177.81744 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =   0.13   Deviance explained = 11.5%
#> -REML = -40263  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       1.296768346e-1 weak           cohen1988
#> 2 SE       4.395398346e-3 <NA>           <NA>     
#> 3 Lower CI 1.210620121e-1 weak           cohen1988
#> 4 Upper CI 1.382916570e-1 moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.092210099e+1
#> 2 logLik         4.035157860e+4
#> 3 AIC           -8.063432088e+4
#> 4 BIC           -8.036473411e+4
#> 5 deviance       1.838219719e+4
#> 6 df.residual    1.860207790e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  1.296768346e-1
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -1.681090152e-1
#>  2 mean((Intercept))       -2.516242491e+0
#>  3 mean(s(spei_12m))       -2.097718165e-2
#>  4 mean(s(gini_index))      1.918423393e-2
#>  5 mean(s(gdp_per_capita)) -4.473367523e-1
#>  6 mean(s(year))            3.759735896e-2
#>  7 s(spei_12m).1           -7.791289962e-2
#>  8 s(spei_12m).2           -8.360011364e-2
#>  9 s(spei_12m).3            3.468262431e-2
#> 10 s(spei_12m).4           -8.548959569e-2
#> 11 s(spei_12m).5            5.070883392e-2
#> 12 s(spei_12m).6           -6.719441350e-2
#> 13 s(spei_12m).7            8.859058409e-2
#> 14 s(spei_12m).8           -2.529316275e-1
#> 15 s(spei_12m).9            2.043519728e-1
#> 16 s(gini_index).1         -3.187519912e-2
#> 17 s(gini_index).2         -1.002617794e-2
#> 18 s(gini_index).3         -1.075940081e-2
#> 19 s(gini_index).4          7.083485252e-3
#> 20 s(gini_index).5         -7.155810467e-3
#> 21 s(gini_index).6         -1.388113269e-3
#> 22 s(gini_index).7          5.680508490e-3
#> 23 s(gini_index).8          1.676177057e-1
#> 24 s(gini_index).9          5.348110755e-2
#> 25 s(gdp_per_capita).1      6.921188742e-1
#> 26 s(gdp_per_capita).2      3.020329505e+0
#> 27 s(gdp_per_capita).3     -1.248736962e+0
#> 28 s(gdp_per_capita).4     -2.206882800e+0
#> 29 s(gdp_per_capita).5      5.449001587e-1
#> 30 s(gdp_per_capita).6     -1.910498920e+0
#> 31 s(gdp_per_capita).7     -1.320684518e+0
#> 32 s(gdp_per_capita).8     -1.202908590e+0
#> 33 s(gdp_per_capita).9     -3.936675184e-1
#> 34 s(year).1                3.167103085e-2
#> 35 s(year).2                2.458912020e-1
#> 36 s(year).3                8.925693988e-2
#> 37 s(year).4               -2.523857034e-1
#> 38 s(year).5                1.189731529e-2
#> 39 s(year).6               -1.086563866e-1
#> 40 s(year).7               -5.449428992e-2
#> 41 s(year).8                3.568766457e-1
#> 42 s(year).9                1.831947698e-2
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    2.637050883e-21  0.8426469523   0.03550855298       0.5330944727 
#> 2 observed 2.637050883e-21  0.4919278244   0.03317385933       0.5311107434 
#> 3 estimate 2.637050883e-21  0.6978053901   0.02633734989       0.05260443087
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(62.179) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.945338037  0.007425162 -261.9927 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       1.627049 2.045801   9.66952 0.00825501 ** 
#> s(gini_index)     1.004156 1.008299 205.13799 < 2.22e-16 ***
#> s(gdp_per_capita) 8.083926 8.757352 260.35579 < 2.22e-16 ***
#> s(year)           1.254570 1.460922  17.58299 0.00011179 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.204   Deviance explained = 18.3%
#> -REML = -4515.3  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.2041550603  moderate       cohen1988
#> 2 SE       0.01363260933 <NA>           <NA>     
#> 3 Lower CI 0.1774356369  moderate       cohen1988
#> 4 Upper CI 0.2308744836  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.296970122e+1
#> 2 logLik         4.553735025e+3
#> 3 AIC           -9.076925302e+3
#> 4 BIC           -8.987747901e+3
#> 5 deviance       2.490663774e+3
#> 6 df.residual    2.525030299e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.041550603e-1
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -1.976879119e-1
#>  2 mean((Intercept))       -1.945338037e+0
#>  3 mean(s(spei_12m))       -9.040345112e-4
#>  4 mean(s(gini_index))      1.142711493e-2
#>  5 mean(s(gdp_per_capita)) -6.122982989e-1
#>  6 mean(s(year))            5.206918380e-3
#>  7 s(spei_12m).1           -1.958101522e-3
#>  8 s(spei_12m).2           -3.552279139e-3
#>  9 s(spei_12m).3            3.259372611e-4
#> 10 s(spei_12m).4            3.841980429e-3
#> 11 s(spei_12m).5            2.409598234e-4
#> 12 s(spei_12m).6           -3.734707327e-3
#> 13 s(spei_12m).7           -9.641894585e-4
#> 14 s(spei_12m).8           -2.438529262e-2
#> 15 s(spei_12m).9            2.204938195e-2
#> 16 s(gini_index).1         -2.261651841e-5
#> 17 s(gini_index).2         -1.667714974e-5
#> 18 s(gini_index).3         -2.978785438e-6
#> 19 s(gini_index).4         -2.461338570e-6
#> 20 s(gini_index).5          3.339809062e-7
#> 21 s(gini_index).6         -2.913064404e-6
#> 22 s(gini_index).7         -4.249251679e-7
#> 23 s(gini_index).8         -1.592494747e-5
#> 24 s(gini_index).9          1.029076971e-1
#> 25 s(gdp_per_capita).1      4.122639266e-1
#> 26 s(gdp_per_capita).2     -4.195777911e+0
#> 27 s(gdp_per_capita).3      4.067134863e-1
#> 28 s(gdp_per_capita).4     -2.527517650e+0
#> 29 s(gdp_per_capita).5      4.641889218e-1
#> 30 s(gdp_per_capita).6      1.889120453e+0
#> 31 s(gdp_per_capita).7     -1.194993449e+0
#> 32 s(gdp_per_capita).8     -1.828381949e-1
#> 33 s(gdp_per_capita).9     -5.818442731e-1
#> 34 s(year).1               -6.024627634e-4
#> 35 s(year).2                2.056365168e-3
#> 36 s(year).3                9.986499434e-4
#> 37 s(year).4               -2.046973706e-3
#> 38 s(year).5               -1.300628238e-4
#> 39 s(year).6               -1.575038417e-3
#> 40 s(year).7               -7.006118909e-4
#> 41 s(year).8                7.982712326e-3
#> 42 s(year).9                4.087968758e-2
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    3.858430707e-25  0.5727624185   0.04204433397       0.4205494060 
#> 2 observed 3.858430707e-25  0.5272068669   0.02123109702       0.3640072697 
#> 3 estimate 3.858430707e-25  0.4276408768   0.01993345190       0.04098973891
#> # ℹ 1 more variable: `s(year)` <dbl>
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 204: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_2_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mbepr_beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mbepr_beipr_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(19.551) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.945910508  0.007329794 -265.4796 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       1.003418 1.006653  12.80477 0.00035794 ***
#> s(gini_index)     6.303245 7.462475 528.95724 < 2.22e-16 ***
#> s(gdp_per_capita) 8.247014 8.838725 186.23619 < 2.22e-16 ***
#> s(year)           7.070276 8.143459 194.63389 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.105   Deviance explained = 11.5%
#> -REML = -9462.8  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       1.045460825e-1 weak           cohen1988
#> 2 SE       6.495687949e-3 <NA>           <NA>     
#> 3 Lower CI 9.181476807e-2 weak           cohen1988
#> 4 Upper CI 1.172773969e-1 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.362395311e+1
#> 2 logLik         9.523282817e+3
#> 3 AIC           -1.899357014e+4
#> 4 BIC           -1.881095696e+4
#> 5 deviance       7.117607737e+3
#> 6 df.residual    7.247376047e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  1.045460825e-1
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -3.232229013e-2
#>  2 mean((Intercept))       -1.945910508e+0
#>  3 mean(s(spei_12m))        4.003418722e-3
#>  4 mean(s(gini_index))     -2.971501376e-2
#>  5 mean(s(gdp_per_capita))  2.016867518e-2
#>  6 mean(s(year))            8.887467248e-2
#>  7 s(spei_12m).1           -2.093817356e-5
#>  8 s(spei_12m).2           -1.924424663e-5
#>  9 s(spei_12m).3           -2.352387929e-6
#> 10 s(spei_12m).4           -1.394401073e-5
#> 11 s(spei_12m).5           -5.400803529e-6
#> 12 s(spei_12m).6            1.367789370e-5
#> 13 s(spei_12m).7           -5.960023198e-6
#> 14 s(spei_12m).8            8.604957169e-5
#> 15 s(spei_12m).9            3.599888068e-2
#> 16 s(gini_index).1         -1.443460257e-1
#> 17 s(gini_index).2         -9.533088378e-2
#> 18 s(gini_index).3          3.897969820e-2
#> 19 s(gini_index).4          5.218344086e-2
#> 20 s(gini_index).5          3.607275203e-2
#> 21 s(gini_index).6          5.966654807e-2
#> 22 s(gini_index).7          1.584341641e-2
#> 23 s(gini_index).8         -4.318492323e-1
#> 24 s(gini_index).9          2.013451624e-1
#> 25 s(gdp_per_capita).1     -6.675152206e-1
#> 26 s(gdp_per_capita).2      2.370273175e+0
#> 27 s(gdp_per_capita).3     -3.366053163e-1
#> 28 s(gdp_per_capita).4     -1.718857064e+0
#> 29 s(gdp_per_capita).5      8.687900691e-1
#> 30 s(gdp_per_capita).6      1.144460283e+0
#> 31 s(gdp_per_capita).7      9.419116715e-1
#> 32 s(gdp_per_capita).8     -2.010040213e+0
#> 33 s(gdp_per_capita).9     -4.108993088e-1
#> 34 s(year).1               -5.898033825e-2
#> 35 s(year).2                1.628631675e-1
#> 36 s(year).3                2.847954098e-1
#> 37 s(year).4               -2.873995244e-1
#> 38 s(year).5               -3.848686253e-2
#> 39 s(year).6               -8.236453647e-2
#> 40 s(year).7               -6.634186255e-2
#> 41 s(year).8                4.632190442e-1
#> 42 s(year).9                4.225675550e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    6.018316380e-23  0.5761405221   0.07611800630       0.3621822964 
#> 2 observed 6.018316380e-23  0.5414997969   0.05199945624       0.3388508553 
#> 3 estimate 6.018316380e-23  0.4736086041   0.04868857031       0.06453532138
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.198) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.223472325  0.004068594 -546.4964 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df     Chi.sq    p-value    
#> s(spei_12m)       4.580721 5.684681   20.54131  0.0015191 ** 
#> s(gini_index)     7.552575 8.500302 1651.13276 < 2.22e-16 ***
#> s(gdp_per_capita) 8.606992 8.949712  398.04358 < 2.22e-16 ***
#> s(year)           7.950739 8.699337  267.97736 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0054   Deviance explained = 9.02%
#> -REML = -41923  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.969102766e+1
#> 2 logLik         4.200357481e+4
#> 3 AIC           -8.394154322e+4
#> 4 BIC           -8.367004423e+4
#> 5 deviance       2.914830302e+4
#> 6 df.residual    2.901530897e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -5.396796153e-3
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -1.881688874e-2
#>  2 mean((Intercept))       -2.223472325e+0
#>  3 mean(s(spei_12m))        2.079908558e-2
#>  4 mean(s(gini_index))      1.064474813e-1
#>  5 mean(s(gdp_per_capita)) -5.937331299e-2
#>  6 mean(s(year))            1.018209063e-1
#>  7 s(spei_12m).1            5.666503089e-2
#>  8 s(spei_12m).2            2.366081899e-2
#>  9 s(spei_12m).3            2.975570787e-2
#> 10 s(spei_12m).4            1.106682622e-2
#> 11 s(spei_12m).5           -1.254945517e-3
#> 12 s(spei_12m).6            5.162226884e-3
#> 13 s(spei_12m).7           -3.296965317e-3
#> 14 s(spei_12m).8           -1.433971864e-2
#> 15 s(spei_12m).9            7.977278887e-2
#> 16 s(gini_index).1          1.625756326e-1
#> 17 s(gini_index).2         -8.927697661e-2
#> 18 s(gini_index).3         -4.597450110e-2
#> 19 s(gini_index).4          6.911505579e-3
#> 20 s(gini_index).5          1.151900582e-2
#> 21 s(gini_index).6         -3.104878047e-3
#> 22 s(gini_index).7          3.033182170e-2
#> 23 s(gini_index).8          5.106338533e-1
#> 24 s(gini_index).9          3.744118682e-1
#> 25 s(gdp_per_capita).1     -8.424019207e-1
#> 26 s(gdp_per_capita).2      3.762018674e+0
#> 27 s(gdp_per_capita).3     -8.954713629e-1
#> 28 s(gdp_per_capita).4      1.791474455e+0
#> 29 s(gdp_per_capita).5      4.240802344e-2
#> 30 s(gdp_per_capita).6     -2.036836416e+0
#> 31 s(gdp_per_capita).7     -1.320766438e+0
#> 32 s(gdp_per_capita).8     -6.862104988e-1
#> 33 s(gdp_per_capita).9     -3.485743325e-1
#> 34 s(year).1               -2.931261263e-2
#> 35 s(year).2                4.257582418e-1
#> 36 s(year).3                2.400639037e-1
#> 37 s(year).4               -4.010987508e-1
#> 38 s(year).5               -3.571963203e-2
#> 39 s(year).6               -1.569960831e-1
#> 40 s(year).7               -1.157625565e-1
#> 41 s(year).8                7.567311511e-1
#> 42 s(year).9                2.327244953e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    4.416008270e-24  0.4360888285   0.01511824469       0.2789251867 
#> 2 observed 4.416008270e-24  0.1756918946   0.01383392847       0.2646467725 
#> 3 estimate 4.416008270e-24  0.3105041066   0.01025400490       0.03886406860
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(35.833) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.792695244  0.003359515 -533.6173 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.444250 8.915436  83.26847 < 2.22e-16 ***
#> s(gini_index)     5.806227 7.013244 901.56623 < 2.22e-16 ***
#> s(gdp_per_capita) 8.831283 8.991069 385.20948 < 2.22e-16 ***
#> s(year)           6.729683 7.785974  71.93643 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.113   Deviance explained = 10.8%
#> -REML = -27483  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       1.127066170e-1 weak           cohen1988
#> 2 SE       4.177615315e-3 <NA>           <NA>     
#> 3 Lower CI 1.045186414e-1 weak           cohen1988
#> 4 Upper CI 1.208945925e-1 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.081144262e+1
#> 2 logLik         2.757065233e+4
#> 3 AIC           -5.507221176e+4
#> 4 BIC           -5.480162017e+4
#> 5 deviance       1.819949563e+4
#> 6 df.residual    1.860218856e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  1.127066170e-1
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -1.654796937e-1
#>  2 mean((Intercept))       -1.792695244e+0
#>  3 mean(s(spei_12m))       -3.617529624e-2
#>  4 mean(s(gini_index))      1.078593726e-2
#>  5 mean(s(gdp_per_capita)) -4.947698835e-1
#>  6 mean(s(year))            3.904219548e-2
#>  7 s(spei_12m).1           -8.057848735e-2
#>  8 s(spei_12m).2           -1.317406854e-1
#>  9 s(spei_12m).3            5.644587955e-2
#> 10 s(spei_12m).4           -1.543562045e-1
#> 11 s(spei_12m).5            7.697780080e-2
#> 12 s(spei_12m).6           -1.082296481e-1
#> 13 s(spei_12m).7            1.413339448e-1
#> 14 s(spei_12m).8           -3.967795179e-1
#> 15 s(spei_12m).9            2.713492520e-1
#> 16 s(gini_index).1         -4.237426050e-2
#> 17 s(gini_index).2          5.147366513e-3
#> 18 s(gini_index).3          2.792763686e-3
#> 19 s(gini_index).4          1.582936648e-2
#> 20 s(gini_index).5         -4.475130023e-3
#> 21 s(gini_index).6         -5.440228862e-3
#> 22 s(gini_index).7          2.628567804e-3
#> 23 s(gini_index).8          8.094244095e-2
#> 24 s(gini_index).9          4.202254928e-2
#> 25 s(gdp_per_capita).1      7.358709918e-1
#> 26 s(gdp_per_capita).2      2.978580378e+0
#> 27 s(gdp_per_capita).3     -1.276524065e+0
#> 28 s(gdp_per_capita).4     -2.150693107e+0
#> 29 s(gdp_per_capita).5      5.790580735e-1
#> 30 s(gdp_per_capita).6     -2.034475741e+0
#> 31 s(gdp_per_capita).7     -1.349530161e+0
#> 32 s(gdp_per_capita).8     -1.581393559e+0
#> 33 s(gdp_per_capita).9     -3.538217627e-1
#> 34 s(year).1               -2.507636695e-2
#> 35 s(year).2                2.170644443e-1
#> 36 s(year).3                9.218674646e-2
#> 37 s(year).4               -1.754727765e-1
#> 38 s(year).5               -8.932512031e-3
#> 39 s(year).6               -5.426776850e-2
#> 40 s(year).7               -3.954110912e-2
#> 41 s(year).8                2.537703826e-1
#> 42 s(year).9                9.164871903e-2
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    2.637050883e-21  0.8426469523   0.03550855298       0.5330944727 
#> 2 observed 2.637050883e-21  0.3932285379   0.03327152924       0.5269628893 
#> 3 estimate 2.637050883e-21  0.6978053901   0.02633734989       0.05260443087
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(27.938) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.279180283  0.008828889 -144.8858 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       1.004514 1.009012   7.51582  0.0062855 ** 
#> s(gini_index)     3.223456 4.083940 118.60448 < 2.22e-16 ***
#> s(gdp_per_capita) 8.037661 8.735704 246.81382 < 2.22e-16 ***
#> s(year)           1.000164 1.000327   0.50660  0.4767646    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =   0.18   Deviance explained = 17.5%
#> -REML = -2957.3  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.1802743753  moderate       cohen1988
#> 2 SE       0.01319489585 <NA>           <NA>     
#> 3 Lower CI 0.1544128546  moderate       cohen1988
#> 4 Upper CI 0.2061358959  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.426579469e+1
#> 2 logLik         2.996752550e+3
#> 3 AIC           -5.959847137e+3
#> 4 BIC           -5.861580499e+3
#> 5 deviance       2.464535338e+3
#> 6 df.residual    2.523734205e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  1.802743753e-1
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -2.497960809e-1
#>  2 mean((Intercept))       -1.279180283e+0
#>  3 mean(s(spei_12m))        2.906739583e-3
#>  4 mean(s(gini_index))     -2.291235448e-2
#>  5 mean(s(gdp_per_capita)) -8.656923664e-1
#>  6 mean(s(year))            8.896803235e-4
#>  7 s(spei_12m).1           -4.291904292e-5
#>  8 s(spei_12m).2            1.537382490e-5
#>  9 s(spei_12m).3           -7.265770598e-7
#> 10 s(spei_12m).4           -1.165336086e-6
#> 11 s(spei_12m).5           -3.068578689e-6
#> 12 s(spei_12m).6            3.588602863e-6
#> 13 s(spei_12m).7            5.243951699e-8
#> 14 s(spei_12m).8            2.592332269e-5
#> 15 s(spei_12m).9            2.616359760e-2
#> 16 s(gini_index).1         -4.065301628e-2
#> 17 s(gini_index).2         -4.662534265e-2
#> 18 s(gini_index).3         -1.051659004e-2
#> 19 s(gini_index).4         -1.686131491e-2
#> 20 s(gini_index).5         -6.410104021e-3
#> 21 s(gini_index).6         -1.842838625e-2
#> 22 s(gini_index).7         -1.318860303e-3
#> 23 s(gini_index).8         -1.280484242e-1
#> 24 s(gini_index).9          6.265084834e-2
#> 25 s(gdp_per_capita).1      6.447688502e-1
#> 26 s(gdp_per_capita).2     -5.200019304e+0
#> 27 s(gdp_per_capita).3      1.092288010e-1
#> 28 s(gdp_per_capita).4     -3.295364863e+0
#> 29 s(gdp_per_capita).5      6.352279295e-1
#> 30 s(gdp_per_capita).6      2.406589613e+0
#> 31 s(gdp_per_capita).7     -1.527402683e+0
#> 32 s(gdp_per_capita).8     -9.171303174e-1
#> 33 s(gdp_per_capita).9     -6.471293236e-1
#> 34 s(year).1                2.883535455e-7
#> 35 s(year).2               -2.787778174e-7
#> 36 s(year).3                7.755783821e-8
#> 37 s(year).4                4.112403855e-8
#> 38 s(year).5                1.492531608e-8
#> 39 s(year).6                2.337766431e-7
#> 40 s(year).7                8.975575541e-8
#> 41 s(year).8               -1.228747909e-6
#> 42 s(year).9                8.007884944e-3
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    3.858430707e-25  0.5727624185   0.04204433397       0.4205494060 
#> 2 observed 3.858430707e-25  0.5496223602   0.01954065894       0.3603385144 
#> 3 estimate 3.858430707e-25  0.4276408768   0.01993345190       0.04098973891
#> # ℹ 1 more variable: `s(year)` <dbl>
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 205: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_2_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(maper ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(maper_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.436) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.55372323  0.01011614 -351.2923 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       4.113080 5.154101  14.64520 0.01365674 *  
#> s(gini_index)     8.581226 8.948759 345.40318 < 2.22e-16 ***
#> s(gdp_per_capita) 4.615878 5.662645  26.60202 0.00013376 ***
#> s(year)           5.254940 6.368155  61.50738 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0256   Deviance explained = 6.73%
#> -REML = -19240  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.356512451e+1
#> 2 logLik         1.929784544e+4
#> 3 AIC           -3.853942357e+4
#> 4 BIC           -3.834553626e+4
#> 5 deviance       7.671577595e+3
#> 6 df.residual    7.247434875e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -2.559198136e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -1.106539449e-1
#>  2 mean((Intercept))       -3.553723228e+0
#>  3 mean(s(spei_12m))        3.445938870e-2
#>  4 mean(s(gini_index))     -7.109274045e-2
#>  5 mean(s(gdp_per_capita)) -7.195954761e-2
#>  6 mean(s(year))            4.854037343e-2
#>  7 s(spei_12m).1            1.649015908e-1
#>  8 s(spei_12m).2           -5.928211332e-2
#>  9 s(spei_12m).3           -2.104444590e-3
#> 10 s(spei_12m).4           -2.237539723e-2
#> 11 s(spei_12m).5           -1.988072645e-2
#> 12 s(spei_12m).6            2.249579585e-2
#> 13 s(spei_12m).7           -1.485979187e-2
#> 14 s(spei_12m).8            9.519931804e-2
#> 15 s(spei_12m).9            1.460402671e-1
#> 16 s(gini_index).1         -4.837605086e-1
#> 17 s(gini_index).2         -9.506421908e-2
#> 18 s(gini_index).3         -1.098176705e-1
#> 19 s(gini_index).4          7.584729884e-2
#> 20 s(gini_index).5         -1.694673073e-1
#> 21 s(gini_index).6          9.863693737e-2
#> 22 s(gini_index).7         -3.324018690e-1
#> 23 s(gini_index).8         -8.737856344e-1
#> 24 s(gini_index).9          1.249978309e+0
#> 25 s(gdp_per_capita).1     -4.367425630e-1
#> 26 s(gdp_per_capita).2      1.075437347e+0
#> 27 s(gdp_per_capita).3     -1.657026658e-1
#> 28 s(gdp_per_capita).4     -6.454054222e-1
#> 29 s(gdp_per_capita).5      4.687865302e-1
#> 30 s(gdp_per_capita).6      5.571571512e-1
#> 31 s(gdp_per_capita).7      4.982885217e-1
#> 32 s(gdp_per_capita).8     -2.002683890e+0
#> 33 s(gdp_per_capita).9      3.229062085e-3
#> 34 s(year).1                1.130700078e-1
#> 35 s(year).2                2.444487318e-1
#> 36 s(year).3               -1.923785560e-2
#> 37 s(year).4               -1.229935964e-1
#> 38 s(year).5               -1.557627039e-2
#> 39 s(year).6               -4.784526508e-2
#> 40 s(year).7               -4.160383741e-2
#> 41 s(year).8                4.191197780e-1
#> 42 s(year).9               -9.251833185e-2
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    6.018316380e-23  0.5761405221   0.07611800630       0.3621822964 
#> 2 observed 6.018316380e-23  0.4316980359   0.04048267056       0.2457249655 
#> 3 estimate 6.018316380e-23  0.4736086041   0.04868857031       0.06453532138
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(26.317) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -4.001505562  0.005376465 -744.2632 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.210939 8.836300  236.7607 < 2.22e-16 ***
#> s(gini_index)     8.077608 8.784498 1651.9376 < 2.22e-16 ***
#> s(gdp_per_capita) 8.756783 8.980268  716.4921 < 2.22e-16 ***
#> s(year)           8.389551 8.893945  449.1530 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00366   Deviance explained = 10.2%
#> -REML = -97297  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       3.663588781e-3 very weak (negligible) cohen1988
#> 2 SE       6.769210032e-4 <NA>                   <NA>     
#> 3 Lower CI 2.336847995e-3 very weak (negligible) cohen1988
#> 4 Upper CI 4.990329568e-3 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.443488098e+1
#> 2 logLik         9.739538595e+4
#> 3 AIC           -1.947157819e+5
#> 4 BIC           -1.944054506e+5
#> 5 deviance       3.094525714e+4
#> 6 df.residual    2.901056512e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  3.663588781e-3
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -1.745737202e-1
#>  2 mean((Intercept))       -4.001505562e+0
#>  3 mean(s(spei_12m))       -1.925856788e-2
#>  4 mean(s(gini_index))     -2.326698830e-1
#>  5 mean(s(gdp_per_capita)) -1.592239957e-1
#>  6 mean(s(year))            1.380722149e-1
#>  7 s(spei_12m).1            1.586183047e-1
#>  8 s(spei_12m).2           -2.292014611e-1
#>  9 s(spei_12m).3            1.118733668e-1
#> 10 s(spei_12m).4            3.024565661e-1
#> 11 s(spei_12m).5           -9.777801210e-2
#> 12 s(spei_12m).6            3.324546425e-1
#> 13 s(spei_12m).7           -1.362083220e-1
#> 14 s(spei_12m).8           -7.638556477e-1
#> 15 s(spei_12m).9            1.483134520e-1
#> 16 s(gini_index).1          2.380566368e-1
#> 17 s(gini_index).2          4.706366685e-1
#> 18 s(gini_index).3         -2.438446598e-1
#> 19 s(gini_index).4         -2.041981228e-1
#> 20 s(gini_index).5         -2.317090611e-1
#> 21 s(gini_index).6          1.380387019e-1
#> 22 s(gini_index).7         -1.751966133e-1
#> 23 s(gini_index).8         -2.524826481e+0
#> 24 s(gini_index).9          4.390139838e-1
#> 25 s(gdp_per_capita).1     -1.868333716e+0
#> 26 s(gdp_per_capita).2      6.667845459e+0
#> 27 s(gdp_per_capita).3     -1.709985136e+0
#> 28 s(gdp_per_capita).4      4.421859225e+0
#> 29 s(gdp_per_capita).5      9.942565347e-2
#> 30 s(gdp_per_capita).6     -3.844612138e+0
#> 31 s(gdp_per_capita).7     -2.457071709e+0
#> 32 s(gdp_per_capita).8     -2.132570497e+0
#> 33 s(gdp_per_capita).9     -6.095731039e-1
#> 34 s(year).1                9.793529391e-2
#> 35 s(year).2                5.651348794e-1
#> 36 s(year).3                2.393304510e-1
#> 37 s(year).4               -4.294250522e-1
#> 38 s(year).5               -1.045097771e-1
#> 39 s(year).6               -8.301186806e-2
#> 40 s(year).7               -1.454583117e-1
#> 41 s(year).8                8.954133844e-1
#> 42 s(year).9                2.072409342e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    4.416008270e-24  0.4360888285   0.01511824469       0.2789251867 
#> 2 observed 4.416008270e-24  0.2401821782   0.01323209222       0.2668620292 
#> 3 estimate 4.416008270e-24  0.3105041066   0.01025400490       0.03886406860
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(55.804) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.424445506  0.004881016 -701.5845 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       7.161619 8.229169  80.32860 < 2.22e-16 ***
#> s(gini_index)     6.889101 7.986024 572.69175 < 2.22e-16 ***
#> s(gdp_per_capita) 7.018473 8.074307  40.16179 < 2.22e-16 ***
#> s(year)           8.490436 8.916492 150.50445 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0177   Deviance explained = 5.66%
#> -REML = -47449  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.768102117e-2 very weak (negligible) cohen1988
#> 2 SE       1.831861788e-3 <NA>                   <NA>     
#> 3 Lower CI 1.409063804e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.127140430e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.055962913e+1
#> 2 logLik         4.752765979e+4
#> 3 AIC           -9.498587505e+4
#> 4 BIC           -9.471390632e+4
#> 5 deviance       1.836576587e+4
#> 6 df.residual    1.860244037e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  1.768102117e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -7.527115987e-2
#>  2 mean((Intercept))       -3.424445506e+0
#>  3 mean(s(spei_12m))       -2.311479480e-2
#>  4 mean(s(gini_index))      1.138726038e-1
#>  5 mean(s(gdp_per_capita)) -9.749392801e-2
#>  6 mean(s(year))            7.778196237e-2
#>  7 s(spei_12m).1           -4.460129638e-2
#>  8 s(spei_12m).2           -1.197672351e-1
#>  9 s(spei_12m).3            1.162018281e-1
#> 10 s(spei_12m).4           -1.166797649e-1
#> 11 s(spei_12m).5            8.747829230e-2
#> 12 s(spei_12m).6           -8.129209915e-2
#> 13 s(spei_12m).7            1.355109826e-2
#> 14 s(spei_12m).8           -2.303867616e-1
#> 15 s(spei_12m).9            1.674627853e-1
#> 16 s(gini_index).1          1.044786458e-1
#> 17 s(gini_index).2         -1.349250789e-1
#> 18 s(gini_index).3          2.944760076e-2
#> 19 s(gini_index).4         -4.589490159e-2
#> 20 s(gini_index).5         -1.428876056e-2
#> 21 s(gini_index).6          2.450839515e-2
#> 22 s(gini_index).7          6.145810385e-3
#> 23 s(gini_index).8          7.264780518e-1
#> 24 s(gini_index).9          3.289036716e-1
#> 25 s(gdp_per_capita).1      2.068528477e-1
#> 26 s(gdp_per_capita).2      1.164618613e+0
#> 27 s(gdp_per_capita).3     -4.138210578e-1
#> 28 s(gdp_per_capita).4     -7.307624695e-1
#> 29 s(gdp_per_capita).5      1.922035749e-1
#> 30 s(gdp_per_capita).6     -3.681403569e-1
#> 31 s(gdp_per_capita).7     -4.023220024e-1
#> 32 s(gdp_per_capita).8     -4.073524458e-1
#> 33 s(gdp_per_capita).9     -1.187220553e-1
#> 34 s(year).1               -1.095087764e-1
#> 35 s(year).2                1.467518568e-1
#> 36 s(year).3                1.959990191e-1
#> 37 s(year).4                4.961799740e-2
#> 38 s(year).5               -7.192713394e-2
#> 39 s(year).6                1.439371312e-1
#> 40 s(year).7               -8.576111164e-2
#> 41 s(year).8                1.273731022e-1
#> 42 s(year).9                3.035555766e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    2.637050883e-21  0.8426469523   0.03550855298       0.5330944727 
#> 2 observed 2.637050883e-21  0.3644542805   0.02825186336       0.4581028538 
#> 3 estimate 2.637050883e-21  0.6978053901   0.02633734989       0.05260443087
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(90.823) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.53297521  0.01140356 -309.8134 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq      p-value    
#> s(spei_12m)       1.008800 1.017394  0.85717   0.35871450    
#> s(gini_index)     2.311721 2.953696 20.22636   0.00014603 ***
#> s(gdp_per_capita) 1.932969 2.385962 17.28336   0.00035302 ***
#> s(year)           4.127904 5.101936 34.95994 0.0000024976 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.029   Deviance explained = 3.91%
#> -REML = -7007.1  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.902683092e-2 weak                   cohen1988
#> 2 SE       6.271587655e-3 <NA>                   <NA>     
#> 3 Lower CI 1.673474499e-2 very weak (negligible) cohen1988
#> 4 Upper CI 4.131891685e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.038139459e+1
#> 2 logLik         7.032652920e+3
#> 3 AIC           -1.403838786e+4
#> 4 BIC           -1.395979906e+4
#> 5 deviance       2.478416827e+3
#> 6 df.residual    2.527618605e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.902683092e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -1.074071773e-1
#>  2 mean((Intercept))       -3.532975214e+0
#>  3 mean(s(spei_12m))        1.445538749e-3
#>  4 mean(s(gini_index))     -1.572054810e-2
#>  5 mean(s(gdp_per_capita)) -4.594037210e-2
#>  6 mean(s(year))            1.120534306e-2
#>  7 s(spei_12m).1           -5.246191870e-5
#>  8 s(spei_12m).2            7.911560782e-5
#>  9 s(spei_12m).3           -6.546630252e-6
#> 10 s(spei_12m).4           -2.099433823e-5
#> 11 s(spei_12m).5           -4.311465908e-6
#> 12 s(spei_12m).6            2.053736876e-5
#> 13 s(spei_12m).7            5.090792195e-6
#> 14 s(spei_12m).8            1.111326723e-4
#> 15 s(spei_12m).9            1.287828666e-2
#> 16 s(gini_index).1         -1.692034737e-2
#> 17 s(gini_index).2         -2.571074331e-2
#> 18 s(gini_index).3         -1.813728614e-4
#> 19 s(gini_index).4         -5.284963237e-3
#> 20 s(gini_index).5          1.475779983e-5
#> 21 s(gini_index).6         -4.347145058e-3
#> 22 s(gini_index).7         -2.853251551e-5
#> 23 s(gini_index).8         -1.959840935e-2
#> 24 s(gini_index).9         -6.942817699e-2
#> 25 s(gdp_per_capita).1      3.175399357e-2
#> 26 s(gdp_per_capita).2     -3.683384558e-2
#> 27 s(gdp_per_capita).3     -3.958986926e-2
#> 28 s(gdp_per_capita).4     -6.000206771e-2
#> 29 s(gdp_per_capita).5      3.210002181e-2
#> 30 s(gdp_per_capita).6      5.636466360e-2
#> 31 s(gdp_per_capita).7     -5.455418944e-2
#> 32 s(gdp_per_capita).8     -2.985064154e-1
#> 33 s(gdp_per_capita).9     -4.419564048e-2
#> 34 s(year).1                1.461104942e-1
#> 35 s(year).2                2.195879142e-2
#> 36 s(year).3                4.034004192e-2
#> 37 s(year).4               -4.162116379e-2
#> 38 s(year).5               -2.101659377e-2
#> 39 s(year).6               -1.793355690e-2
#> 40 s(year).7               -1.119086450e-2
#> 41 s(year).8                1.277835373e-1
#> 42 s(year).9               -1.435825983e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    3.858430707e-25  0.5727624185   0.04204433397       0.4205494060 
#> 2 observed 3.858430707e-25  0.5496907770   0.01758235337       0.1177282312 
#> 3 estimate 3.858430707e-25  0.4276408768   0.01993345190       0.04098973891
#> # ℹ 1 more variable: `s(year)` <dbl>
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 206: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_2_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mpepr_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(33.486) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.434856604  0.009225496 -372.3222 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       4.165144 5.223105  18.19919  0.0032841 ** 
#> s(gini_index)     6.712438 7.839625 206.09680 < 2.22e-16 ***
#> s(gdp_per_capita) 7.373456 8.340552  77.66143 < 2.22e-16 ***
#> s(year)           6.445394 7.601074 144.55994 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0463   Deviance explained = 7.01%
#> -REML = -18024  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.569643256e+1
#> 2 logLik         1.808331196e+4
#> 3 AIC           -3.610461521e+4
#> 4 BIC           -3.589094407e+4
#> 5 deviance       7.667142034e+3
#> 6 df.residual    7.245303567e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -4.629109189e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -3.494413062e-2
#>  2 mean((Intercept))       -3.434856604e+0
#>  3 mean(s(spei_12m))        1.964062625e-2
#>  4 mean(s(gini_index))      1.232521861e-1
#>  5 mean(s(gdp_per_capita))  5.601046968e-2
#>  6 mean(s(year))            3.908824802e-2
#>  7 s(spei_12m).1            1.361697653e-1
#>  8 s(spei_12m).2            1.715062814e-3
#>  9 s(spei_12m).3            5.489769184e-3
#> 10 s(spei_12m).4            1.360244836e-3
#> 11 s(spei_12m).5           -1.164418587e-2
#> 12 s(spei_12m).6           -9.359979648e-3
#> 13 s(spei_12m).7            5.169578044e-3
#> 14 s(spei_12m).8           -6.561587627e-2
#> 15 s(spei_12m).9            1.134812579e-1
#> 16 s(gini_index).1         -8.564231171e-2
#> 17 s(gini_index).2          2.694956733e-1
#> 18 s(gini_index).3          4.072328006e-2
#> 19 s(gini_index).4         -1.478197531e-1
#> 20 s(gini_index).5         -4.121173320e-2
#> 21 s(gini_index).6         -9.455594074e-2
#> 22 s(gini_index).7         -6.697722938e-2
#> 23 s(gini_index).8          9.618259727e-1
#> 24 s(gini_index).9          2.734317174e-1
#> 25 s(gdp_per_capita).1     -3.526411690e-1
#> 26 s(gdp_per_capita).2      1.439788439e+0
#> 27 s(gdp_per_capita).3     -1.932460723e-1
#> 28 s(gdp_per_capita).4     -9.456433763e-1
#> 29 s(gdp_per_capita).5      5.484758744e-1
#> 30 s(gdp_per_capita).6      7.725993345e-1
#> 31 s(gdp_per_capita).7      5.242949569e-1
#> 32 s(gdp_per_capita).8     -9.633720077e-1
#> 33 s(gdp_per_capita).9     -3.261617526e-1
#> 34 s(year).1                2.134698595e-1
#> 35 s(year).2                3.621564177e-1
#> 36 s(year).3               -1.526613940e-1
#> 37 s(year).4               -9.195351450e-2
#> 38 s(year).5                3.818738853e-2
#> 39 s(year).6               -8.565398833e-2
#> 40 s(year).7               -7.452982589e-2
#> 41 s(year).8                4.728942259e-1
#> 42 s(year).9               -3.301149368e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    6.018316380e-23  0.5761405221   0.07611800630       0.3621822964 
#> 2 observed 6.018316380e-23  0.5003118419   0.03604859644       0.3455076705 
#> 3 estimate 6.018316380e-23  0.4736086041   0.04868857031       0.06453532138
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(30.017) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.787295147  0.005091077 -743.9084 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.705871 8.975143  334.3871 < 2.22e-16 ***
#> s(gini_index)     7.818827 8.657748 1926.6325 < 2.22e-16 ***
#> s(gdp_per_capita) 8.791225 8.985325  780.0611 < 2.22e-16 ***
#> s(year)           8.100767 8.782282  604.5306 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0117   Deviance explained = 12.3%
#> -REML = -85060  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.441669034e+1
#> 2 logLik         8.515993299e+4
#> 3 AIC           -1.702450650e+5
#> 4 BIC           -1.699355160e+5
#> 5 deviance       3.165452107e+4
#> 6 df.residual    2.901058331e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -1.165001197e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -1.582608370e-1
#>  2 mean((Intercept))       -3.787295147e+0
#>  3 mean(s(spei_12m))       -4.457326608e-2
#>  4 mean(s(gini_index))     -1.586575402e-1
#>  5 mean(s(gdp_per_capita)) -1.886307554e-1
#>  6 mean(s(year))            1.620442482e-1
#>  7 s(spei_12m).1            2.841394667e-1
#>  8 s(spei_12m).2           -5.391838031e-1
#>  9 s(spei_12m).3            2.627270061e-1
#> 10 s(spei_12m).4            5.133005645e-1
#> 11 s(spei_12m).5           -1.461767298e-1
#> 12 s(spei_12m).6            5.768797573e-1
#> 13 s(spei_12m).7           -3.161925924e-1
#> 14 s(spei_12m).8           -1.438436340e+0
#> 15 s(spei_12m).9            4.017832758e-1
#> 16 s(gini_index).1          1.440479654e-1
#> 17 s(gini_index).2          4.038848698e-1
#> 18 s(gini_index).3         -1.244612017e-1
#> 19 s(gini_index).4         -1.532931167e-1
#> 20 s(gini_index).5         -1.591211639e-1
#> 21 s(gini_index).6          9.622253580e-2
#> 22 s(gini_index).7         -1.173343648e-1
#> 23 s(gini_index).8         -1.771926835e+0
#> 24 s(gini_index).9          2.540634492e-1
#> 25 s(gdp_per_capita).1     -1.886843793e+0
#> 26 s(gdp_per_capita).2      6.554054442e+0
#> 27 s(gdp_per_capita).3     -1.785521637e+0
#> 28 s(gdp_per_capita).4      4.574095945e+0
#> 29 s(gdp_per_capita).5      9.837035612e-2
#> 30 s(gdp_per_capita).6     -3.978723586e+0
#> 31 s(gdp_per_capita).7     -2.473079565e+0
#> 32 s(gdp_per_capita).8     -2.194704818e+0
#> 33 s(gdp_per_capita).9     -6.053241430e-1
#> 34 s(year).1                1.360579485e-1
#> 35 s(year).2                7.838635781e-1
#> 36 s(year).3                1.702919485e-1
#> 37 s(year).4               -3.438891934e-1
#> 38 s(year).5               -8.518351732e-2
#> 39 s(year).6               -1.382085520e-1
#> 40 s(year).7               -1.152448862e-1
#> 41 s(year).8                9.163512592e-1
#> 42 s(year).9                1.343596486e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    4.416008270e-24  0.4360888285   0.01511824469       0.2789251867 
#> 2 observed 4.416008270e-24  0.1884469727   0.01289371706       0.2635596774 
#> 3 estimate 4.416008270e-24  0.3105041066   0.01025400490       0.03886406860
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(97.08) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.345236572  0.003815571 -876.7328 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       6.802120 7.947547 243.0474 < 2.22e-16 ***
#> s(gini_index)     8.118038 8.779012 684.6377 < 2.22e-16 ***
#> s(gdp_per_capita) 8.095966 8.771660 164.5220 < 2.22e-16 ***
#> s(year)           8.515898 8.924000 214.2495 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0411   Deviance explained = 7.92%
#> -REML = -49904  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.108916126e-2 weak           cohen1988
#> 2 SE       2.726015760e-3 <NA>           <NA>     
#> 3 Lower CI 3.574626855e-2 weak           cohen1988
#> 4 Upper CI 4.643205397e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.253202212e+1
#> 2 logLik         4.999319384e+4
#> 3 AIC           -9.991450445e+4
#> 4 BIC           -9.963298493e+4
#> 5 deviance       1.848966195e+4
#> 6 df.residual    1.860046798e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  4.108916126e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -3.831497942e-2
#>  2 mean((Intercept))       -3.345236572e+0
#>  3 mean(s(spei_12m))        4.556567363e-2
#>  4 mean(s(gini_index))      1.435808433e-1
#>  5 mean(s(gdp_per_capita)) -9.842680671e-2
#>  6 mean(s(year))            1.234561045e-1
#>  7 s(spei_12m).1           -1.379283490e-2
#>  8 s(spei_12m).2            4.393551483e-2
#>  9 s(spei_12m).3            6.541188612e-2
#> 10 s(spei_12m).4            2.327286428e-2
#> 11 s(spei_12m).5            3.768461630e-2
#> 12 s(spei_12m).6            3.608298460e-2
#> 13 s(spei_12m).7           -2.331846887e-3
#> 14 s(spei_12m).8            1.706403278e-1
#> 15 s(spei_12m).9            4.918755053e-2
#> 16 s(gini_index).1          2.040557270e-1
#> 17 s(gini_index).2         -1.755282187e-1
#> 18 s(gini_index).3          6.085929746e-2
#> 19 s(gini_index).4         -5.139256491e-2
#> 20 s(gini_index).5         -2.923984808e-2
#> 21 s(gini_index).6          5.589509610e-2
#> 22 s(gini_index).7         -2.428891148e-2
#> 23 s(gini_index).8          7.260435467e-1
#> 24 s(gini_index).9          5.258234658e-1
#> 25 s(gdp_per_capita).1      2.250277377e-1
#> 26 s(gdp_per_capita).2      1.544888953e+0
#> 27 s(gdp_per_capita).3     -5.717738617e-1
#> 28 s(gdp_per_capita).4     -7.505482659e-1
#> 29 s(gdp_per_capita).5      2.194923592e-1
#> 30 s(gdp_per_capita).6     -6.945598035e-1
#> 31 s(gdp_per_capita).7     -4.637604864e-1
#> 32 s(gdp_per_capita).8     -1.916317577e-1
#> 33 s(gdp_per_capita).9     -2.029761355e-1
#> 34 s(year).1               -1.386036369e-1
#> 35 s(year).2                5.657238111e-1
#> 36 s(year).3                2.270403459e-1
#> 37 s(year).4               -2.246780096e-1
#> 38 s(year).5                7.264059589e-2
#> 39 s(year).6               -6.914501548e-2
#> 40 s(year).7               -1.428020712e-1
#> 41 s(year).8                6.950617426e-1
#> 42 s(year).9                1.258671786e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    2.637050883e-21  0.8426469523   0.03550855298       0.5330944727 
#> 2 observed 2.637050883e-21  0.6451303506   0.02688775665       0.4713195237 
#> 3 estimate 2.637050883e-21  0.6978053901   0.02633734989       0.05260443087
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(122.989) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.325421007  0.009246172 -359.6538 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       1.007548 1.014949  0.15084  0.7086245    
#> s(gini_index)     4.878724 6.014189 75.46973 < 2.22e-16 ***
#> s(gdp_per_capita) 3.003962 3.677160 16.85097  0.0017233 ** 
#> s(year)           3.280415 4.069538 15.10457  0.0049117 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0239   Deviance explained =  5.2%
#> -REML = -6991.8  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.387317808e-2 weak                   cohen1988
#> 2 SE       5.717837663e-3 <NA>                   <NA>     
#> 3 Lower CI 1.266642219e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.507993397e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.317064856e+1
#> 2 logLik         7.023495794e+3
#> 3 AIC           -1.401343992e+4
#> 4 BIC           -1.391548360e+4
#> 5 deviance       2.490328399e+3
#> 6 df.residual    2.524829351e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.387317808e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -9.970824520e-2
#>  2 mean((Intercept))       -3.325421007e+0
#>  3 mean(s(spei_12m))        4.908493579e-4
#>  4 mean(s(gini_index))     -1.593089475e-2
#>  5 mean(s(gdp_per_capita)) -2.883650447e-2
#>  6 mean(s(year))            3.856098161e-3
#>  7 s(spei_12m).1           -2.611617651e-6
#>  8 s(spei_12m).2            3.962309063e-5
#>  9 s(spei_12m).3           -6.472759894e-6
#> 10 s(spei_12m).4           -2.937876457e-5
#> 11 s(spei_12m).5           -2.404269832e-6
#> 12 s(spei_12m).6            2.667080466e-5
#> 13 s(spei_12m).7            6.470647656e-6
#> 14 s(spei_12m).8            1.703588031e-4
#> 15 s(spei_12m).9            4.215388287e-3
#> 16 s(gini_index).1         -1.042351235e-1
#> 17 s(gini_index).2         -4.591296766e-2
#> 18 s(gini_index).3          2.566487781e-2
#> 19 s(gini_index).4          8.803861077e-3
#> 20 s(gini_index).5          3.162618505e-2
#> 21 s(gini_index).6          7.270185050e-3
#> 22 s(gini_index).7          3.006996708e-3
#> 23 s(gini_index).8          1.153306231e-1
#> 24 s(gini_index).9         -1.849326905e-1
#> 25 s(gdp_per_capita).1     -4.310647188e-2
#> 26 s(gdp_per_capita).2     -9.540324500e-2
#> 27 s(gdp_per_capita).3      5.093162616e-3
#> 28 s(gdp_per_capita).4     -4.972354593e-2
#> 29 s(gdp_per_capita).5      8.768640910e-3
#> 30 s(gdp_per_capita).6      1.658280333e-2
#> 31 s(gdp_per_capita).7     -1.520323204e-2
#> 32 s(gdp_per_capita).8     -2.852245503e-2
#> 33 s(gdp_per_capita).9     -5.801419719e-2
#> 34 s(year).1                4.914947372e-2
#> 35 s(year).2               -7.639088715e-3
#> 36 s(year).3                8.354107799e-3
#> 37 s(year).4               -2.397705052e-2
#> 38 s(year).5               -9.787014025e-3
#> 39 s(year).6               -1.422994620e-2
#> 40 s(year).7               -6.028367962e-3
#> 41 s(year).8                8.654712383e-2
#> 42 s(year).9               -4.768435447e-2
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    3.858430707e-25  0.5727624185   0.04204433397       0.4205494060 
#> 2 observed 3.858430707e-25  0.5498684970   0.01114936125       0.2254475458 
#> 3 estimate 3.858430707e-25  0.4276408768   0.01993345190       0.04098973891
#> # ℹ 1 more variable: `s(year)` <dbl>
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 207: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_2_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(maper_mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(maper_mpepr_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.099) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.754435921  0.008411639 -327.4553 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq      p-value    
#> s(spei_12m)       4.672689 5.817499  33.61398 0.0000073993 ***
#> s(gini_index)     8.107389 8.783806 169.54162   < 2.22e-16 ***
#> s(gdp_per_capita) 7.221601 8.228600  92.36727   < 2.22e-16 ***
#> s(year)           6.820652 7.932548  90.60290   < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0106   Deviance explained = 6.34%
#> -REML = -13623  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.782233197e+1
#> 2 logLik         1.368997982e+4
#> 3 AIC           -2.731443474e+4
#> 4 BIC           -2.708864741e+4
#> 5 deviance       7.314057274e+3
#> 6 df.residual    7.243177668e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -1.056645647e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -5.007228067e-2
#>  2 mean((Intercept))       -2.754435921e+0
#>  3 mean(s(spei_12m))        3.206410280e-2
#>  4 mean(s(gini_index))      1.142572710e-1
#>  5 mean(s(gdp_per_capita)) -4.883316071e-2
#>  6 mean(s(year))            2.707513105e-3
#>  7 s(spei_12m).1            1.760832329e-1
#>  8 s(spei_12m).2           -1.524371506e-2
#>  9 s(spei_12m).3            2.015529933e-2
#> 10 s(spei_12m).4           -8.265319084e-3
#> 11 s(spei_12m).5           -1.058832496e-2
#> 12 s(spei_12m).6            3.152072111e-3
#> 13 s(spei_12m).7           -4.670031387e-3
#> 14 s(spei_12m).8            2.469860923e-2
#> 15 s(spei_12m).9            1.032551021e-1
#> 16 s(gini_index).1         -2.524632676e-1
#> 17 s(gini_index).2          3.249365828e-1
#> 18 s(gini_index).3         -2.583286725e-2
#> 19 s(gini_index).4         -1.609615306e-1
#> 20 s(gini_index).5         -1.226457370e-1
#> 21 s(gini_index).6         -1.281554470e-1
#> 22 s(gini_index).7         -1.532815129e-1
#> 23 s(gini_index).8          8.518538032e-1
#> 24 s(gini_index).9          6.948654156e-1
#> 25 s(gdp_per_capita).1     -5.465292568e-1
#> 26 s(gdp_per_capita).2      1.590548451e+0
#> 27 s(gdp_per_capita).3     -2.207406118e-1
#> 28 s(gdp_per_capita).4     -1.220619152e+0
#> 29 s(gdp_per_capita).5      7.028827997e-1
#> 30 s(gdp_per_capita).6      9.063363849e-1
#> 31 s(gdp_per_capita).7      7.439170928e-1
#> 32 s(gdp_per_capita).8     -2.213091538e+0
#> 33 s(gdp_per_capita).9     -1.822026151e-1
#> 34 s(year).1                1.652308618e-1
#> 35 s(year).2                1.630562540e-1
#> 36 s(year).3               -1.822994781e-1
#> 37 s(year).4               -5.347137516e-2
#> 38 s(year).5                1.440633184e-2
#> 39 s(year).6                1.923467541e-2
#> 40 s(year).7               -5.066330062e-2
#> 41 s(year).8                2.662287697e-1
#> 42 s(year).9               -3.173551209e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    6.018316380e-23  0.5761405221   0.07611800630       0.3621822964 
#> 2 observed 6.018316380e-23  0.5049675190   0.02906446008       0.3131364400 
#> 3 estimate 6.018316380e-23  0.4736086041   0.04868857031       0.06453532138
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(21.296) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.172234215  0.004886527 -649.1798 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.678425 8.970716  277.2088 < 2.22e-16 ***
#> s(gini_index)     8.069006 8.779763 1780.7193 < 2.22e-16 ***
#> s(gdp_per_capita) 8.826432 8.989826 1053.8210 < 2.22e-16 ***
#> s(year)           8.390146 8.895002  584.1082 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0104   Deviance explained = 12.6%
#> -REML = -65588  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.044675105e-2 very weak (negligible) cohen1988
#> 2 SE       1.135294200e-3 <NA>                   <NA>     
#> 3 Lower CI 8.221615305e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.267188679e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.496400951e+1
#> 2 logLik         6.569251257e+4
#> 3 AIC           -1.313097545e+5
#> 4 BIC           -1.309982621e+5
#> 5 deviance       3.083323622e+4
#> 6 df.residual    2.901003599e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  1.044675105e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -1.476114771e-1
#>  2 mean((Intercept))       -3.172234215e+0
#>  3 mean(s(spei_12m))       -1.702305315e-2
#>  4 mean(s(gini_index))     -1.817748664e-1
#>  5 mean(s(gdp_per_capita)) -2.096481819e-1
#>  6 mean(s(year))            1.540693859e-1
#>  7 s(spei_12m).1            2.250014407e-1
#>  8 s(spei_12m).2           -3.405513696e-1
#>  9 s(spei_12m).3            1.885168524e-1
#> 10 s(spei_12m).4            3.700521594e-1
#> 11 s(spei_12m).5           -1.339453641e-1
#> 12 s(spei_12m).6            4.554122512e-1
#> 13 s(spei_12m).7           -2.666845532e-1
#> 14 s(spei_12m).8           -1.017885822e+0
#> 15 s(spei_12m).9            3.668769268e-1
#> 16 s(gini_index).1          2.826479644e-1
#> 17 s(gini_index).2          4.120744404e-1
#> 18 s(gini_index).3         -2.019740777e-1
#> 19 s(gini_index).4         -1.770208269e-1
#> 20 s(gini_index).5         -1.981862247e-1
#> 21 s(gini_index).6          1.259152928e-1
#> 22 s(gini_index).7         -1.474396308e-1
#> 23 s(gini_index).8         -2.174645204e+0
#> 24 s(gini_index).9          4.426544696e-1
#> 25 s(gdp_per_capita).1     -2.053619376e+0
#> 26 s(gdp_per_capita).2      7.315256829e+0
#> 27 s(gdp_per_capita).3     -1.925762054e+0
#> 28 s(gdp_per_capita).4      4.795155103e+0
#> 29 s(gdp_per_capita).5      1.248153827e-1
#> 30 s(gdp_per_capita).6     -4.240558276e+0
#> 31 s(gdp_per_capita).7     -2.818157389e+0
#> 32 s(gdp_per_capita).8     -2.420388937e+0
#> 33 s(gdp_per_capita).9     -6.635749189e-1
#> 34 s(year).1                1.114142976e-1
#> 35 s(year).2                6.971093786e-1
#> 36 s(year).3                1.672375367e-1
#> 37 s(year).4               -3.487828787e-1
#> 38 s(year).5               -1.410763730e-1
#> 39 s(year).6               -9.605317159e-2
#> 40 s(year).7               -8.220028457e-2
#> 41 s(year).8                8.479166437e-1
#> 42 s(year).9                2.310593244e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    4.416008270e-24  0.4360888285   0.01511824469       0.2789251867 
#> 2 observed 4.416008270e-24  0.1648447847   0.01316367878       0.2695935208 
#> 3 estimate 4.416008270e-24  0.3105041066   0.01025400490       0.03886406860
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(51.382) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.651746893  0.003846583 -689.3772 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       6.696953 7.859763 161.3680 < 2.22e-16 ***
#> s(gini_index)     6.841539 7.947518 479.4436 < 2.22e-16 ***
#> s(gdp_per_capita) 7.634824 8.517122 124.1043 < 2.22e-16 ***
#> s(year)           8.514893 8.923327 188.3863 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0442   Deviance explained = 6.52%
#> -REML = -38009  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.416876512e-2 weak           cohen1988
#> 2 SE       2.817249716e-3 <NA>           <NA>     
#> 3 Lower CI 3.864705714e-2 weak           cohen1988
#> 4 Upper CI 4.969047310e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.068820926e+1
#> 2 logLik         3.808981478e+4
#> 3 AIC           -7.610997660e+4
#> 4 BIC           -7.583719155e+4
#> 5 deviance       1.823469728e+4
#> 6 df.residual    1.860231179e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  4.416876512e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -3.728128067e-2
#>  2 mean((Intercept))       -2.651746893e+0
#>  3 mean(s(spei_12m))        6.611272216e-2
#>  4 mean(s(gini_index))      6.932181917e-2
#>  5 mean(s(gdp_per_capita)) -7.188967017e-2
#>  6 mean(s(year))            7.782618535e-2
#>  7 s(spei_12m).1            2.060368968e-2
#>  8 s(spei_12m).2            1.017599845e-1
#>  9 s(spei_12m).3            3.684981846e-2
#> 10 s(spei_12m).4            4.728982184e-2
#> 11 s(spei_12m).5            3.109644600e-2
#> 12 s(spei_12m).6            7.093981679e-2
#> 13 s(spei_12m).7           -2.918434312e-3
#> 14 s(spei_12m).8            2.639258682e-1
#> 15 s(spei_12m).9            2.546748828e-2
#> 16 s(gini_index).1          8.444321389e-2
#> 17 s(gini_index).2         -6.780643536e-2
#> 18 s(gini_index).3          3.988797866e-2
#> 19 s(gini_index).4         -1.720389427e-2
#> 20 s(gini_index).5         -1.172141409e-2
#> 21 s(gini_index).6          2.102838010e-2
#> 22 s(gini_index).7         -5.969355598e-3
#> 23 s(gini_index).8          3.221583336e-1
#> 24 s(gini_index).9          2.590795655e-1
#> 25 s(gdp_per_capita).1      1.751977335e-1
#> 26 s(gdp_per_capita).2      1.305133374e+0
#> 27 s(gdp_per_capita).3     -4.578829314e-1
#> 28 s(gdp_per_capita).4     -6.671013914e-1
#> 29 s(gdp_per_capita).5      1.905222109e-1
#> 30 s(gdp_per_capita).6     -4.587545383e-1
#> 31 s(gdp_per_capita).7     -3.802488465e-1
#> 32 s(gdp_per_capita).8     -1.951691219e-1
#> 33 s(gdp_per_capita).9     -1.587035204e-1
#> 34 s(year).1               -1.514676533e-1
#> 35 s(year).2                2.514417196e-1
#> 36 s(year).3                1.636085973e-1
#> 37 s(year).4               -4.717353758e-2
#> 38 s(year).5                8.053616250e-3
#> 39 s(year).6                9.384634440e-2
#> 40 s(year).7               -7.532136823e-2
#> 41 s(year).8                2.453975950e-1
#> 42 s(year).9                2.120503548e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    2.637050883e-21  0.8426469523   0.03550855298       0.5330944727 
#> 2 observed 2.637050883e-21  0.6040950096   0.02956931348       0.4452222253 
#> 3 estimate 2.637050883e-21  0.6978053901   0.02633734989       0.05260443087
#> # ℹ 1 more variable: `s(year)` <dbl>
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(64.399) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gini_index) + s(gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error  z value   Pr(>|z|)    
#> (Intercept) -2.696651837  0.009599427 -280.918 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq      p-value    
#> s(spei_12m)       1.004137 1.008195  0.05373   0.82621612    
#> s(gini_index)     4.219623 5.267194 42.31875   < 2.22e-16 ***
#> s(gdp_per_capita) 2.258568 2.771123 17.48275   0.00058502 ***
#> s(year)           3.615511 4.481865 31.76082 0.0000065322 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0373   Deviance explained =  4.7%
#> -REML = -5452.9  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.729930867e-2 weak           cohen1988
#> 2 SE       7.048750374e-3 <NA>           <NA>     
#> 3 Lower CI 2.348401180e-2 weak           cohen1988
#> 4 Upper CI 5.111460554e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.209783779e+1
#> 2 logLik         5.482303656e+3
#> 3 AIC           -1.093355056e+4
#> 4 BIC           -1.084287832e+4
#> 5 deviance       2.480839104e+3
#> 6 df.residual    2.525902162e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  3.729930867e-2
#> 9 npar           3.7        e+1
#> 
#> # A tibble: 42 × 2
#>    name                              value
#>    <chr>                             <dbl>
#>  1 [Mean]                  -9.366030700e-2
#>  2 mean((Intercept))       -2.696651837e+0
#>  3 mean(s(spei_12m))        3.114213471e-4
#>  4 mean(s(gini_index))     -4.721254303e-2
#>  5 mean(s(gdp_per_capita)) -3.748773334e-2
#>  6 mean(s(year))           -1.031091875e-3
#>  7 s(spei_12m).1            1.603446727e-6
#>  8 s(spei_12m).2            2.945206642e-5
#>  9 s(spei_12m).3           -4.258552834e-6
#> 10 s(spei_12m).4           -2.108326387e-5
#> 11 s(spei_12m).5           -3.006398452e-6
#> 12 s(spei_12m).6            1.982741659e-5
#> 13 s(spei_12m).7            4.552717443e-6
#> 14 s(spei_12m).8            1.263965302e-4
#> 15 s(spei_12m).9            2.649308162e-3
#> 16 s(gini_index).1         -6.881606560e-2
#> 17 s(gini_index).2         -9.891381261e-2
#> 18 s(gini_index).3          6.414335204e-3
#> 19 s(gini_index).4         -1.838687282e-2
#> 20 s(gini_index).5          8.285615140e-3
#> 21 s(gini_index).6         -2.243903256e-2
#> 22 s(gini_index).7          2.143593933e-3
#> 23 s(gini_index).8         -1.081026546e-1
#> 24 s(gini_index).9         -1.250979934e-1
#> 25 s(gdp_per_capita).1      9.879072190e-3
#> 26 s(gdp_per_capita).2     -2.591351541e-2
#> 27 s(gdp_per_capita).3     -2.671643883e-2
#> 28 s(gdp_per_capita).4     -4.624284419e-2
#> 29 s(gdp_per_capita).5      2.377537177e-2
#> 30 s(gdp_per_capita).6      4.219574863e-2
#> 31 s(gdp_per_capita).7     -4.041394305e-2
#> 32 s(gdp_per_capita).8     -2.347643931e-1
#> 33 s(gdp_per_capita).9     -3.918865803e-2
#> 34 s(year).1                7.611043022e-2
#> 35 s(year).2               -1.330910550e-2
#> 36 s(year).3                6.535445877e-3
#> 37 s(year).4               -2.240308328e-2
#> 38 s(year).5               -1.487999615e-2
#> 39 s(year).6               -1.032341486e-2
#> 40 s(year).7               -4.492602871e-3
#> 41 s(year).8                7.559972575e-2
#> 42 s(year).9               -1.021172261e-1
#> 
#> # A tibble: 3 × 6
#>   names               para `s(spei_12m)` `s(gini_index)` `s(gdp_per_capita)`
#>   <chr>              <dbl>         <dbl>           <dbl>               <dbl>
#> 1 worst    3.858430707e-25  0.5727624185   0.04204433397       0.4205494060 
#> 2 observed 3.858430707e-25  0.5498755857   0.01266713794       0.1523034877 
#> 3 estimate 3.858430707e-25  0.4276408768   0.01993345190       0.04098973891
#> # ℹ 1 more variable: `s(year)` <dbl>
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 208: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(spei_12m) + te(gini_index, gdp_per_capita) + year (Unordered year)

In this model, the year variable is treated as a unordered categorical variable.

Code
mbepr_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mbepr_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(20.768) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value          Pr(>|z|)    
#> (Intercept) -3.23298563  0.03756706 -86.05905        < 2.22e-16 ***
#> year2009     0.30857421  0.04867295   6.33975 0.000000000230143 ***
#> year2011     0.29875880  0.04611862   6.47805 0.000000000092915 ***
#> year2012     0.29360245  0.04860732   6.04029 0.000000001538346 ***
#> year2013     0.43346187  0.04713174   9.19681        < 2.22e-16 ***
#> year2014     0.59671139  0.04808051  12.41067        < 2.22e-16 ***
#> year2015     0.52057111  0.05246582   9.92210        < 2.22e-16 ***
#> year2016     0.65402002  0.05289714  12.36400        < 2.22e-16 ***
#> year2017     0.51828339  0.05159178  10.04585        < 2.22e-16 ***
#> year2018     0.54472383  0.04867521  11.19099        < 2.22e-16 ***
#> year2019     0.59986065  0.05461938  10.98256        < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq  p-value    
#> s(spei_12m)                    2.180163  2.811902  10.65033 0.010606 *  
#> te(gini_index,gdp_per_capita) 15.214784 17.061690 715.08585  < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0216   Deviance explained = 11.5%
#> -REML = -13717  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.161223834e-2 weak                   cohen1988
#> 2 SE       3.226925333e-3 <NA>                   <NA>     
#> 3 Lower CI 1.528758091e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.793689578e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.839494693e+1
#> 2 logLik         1.377852396e+4
#> 3 AIC           -2.749330074e+4
#> 4 BIC           -2.727363913e+4
#> 5 deviance       7.432364137e+3
#> 6 df.residual    7.242605053e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  2.161223834e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.289992222e-1
#>  2 mean((Intercept))                   -3.232985626e+0
#>  3 year2009                             3.085742055e-1
#>  4 year2011                             2.987587976e-1
#>  5 year2012                             2.936024493e-1
#>  6 year2013                             4.334618656e-1
#>  7 year2014                             5.967113941e-1
#>  8 year2015                             5.205711055e-1
#>  9 year2016                             6.540200177e-1
#> 10 year2017                             5.182833917e-1
#> 11 year2018                             5.447238270e-1
#> 12 year2019                             5.998606538e-1
#> 13 mean(s(spei_12m))                   -2.016154349e-3
#> 14 mean(te(gini_index,gdp_per_capita)) -2.997251030e-1
#> 15 s(spei_12m).1                       -2.178341836e-2
#> 16 s(spei_12m).2                       -8.195725078e-3
#> 17 s(spei_12m).3                       -3.286372738e-3
#> 18 s(spei_12m).4                       -5.901580994e-4
#> 19 s(spei_12m).5                        7.330446184e-4
#> 20 s(spei_12m).6                       -3.700543432e-4
#> 21 s(spei_12m).7                        4.768776783e-4
#> 22 s(spei_12m).8                       -8.255590377e-3
#> 23 s(spei_12m).9                        2.312600756e-2
#> 24 te(gini_index,gdp_per_capita).1     -7.795052746e-1
#> 25 te(gini_index,gdp_per_capita).2     -7.932672096e-1
#> 26 te(gini_index,gdp_per_capita).3     -7.587539514e-1
#> 27 te(gini_index,gdp_per_capita).4     -1.502772633e+0
#> 28 te(gini_index,gdp_per_capita).5      2.667280121e-2
#> 29 te(gini_index,gdp_per_capita).6      2.733278277e-1
#> 30 te(gini_index,gdp_per_capita).7     -5.209039948e-1
#> 31 te(gini_index,gdp_per_capita).8      3.939809631e-1
#> 32 te(gini_index,gdp_per_capita).9     -1.870418978e+0
#> 33 te(gini_index,gdp_per_capita).10     3.096843911e-1
#> 34 te(gini_index,gdp_per_capita).11     1.984118079e-1
#> 35 te(gini_index,gdp_per_capita).12    -1.016724690e-1
#> 36 te(gini_index,gdp_per_capita).13     1.926253195e-1
#> 37 te(gini_index,gdp_per_capita).14    -2.027085910e+0
#> 38 te(gini_index,gdp_per_capita).15     5.655569768e-1
#> 39 te(gini_index,gdp_per_capita).16     4.696572474e-1
#> 40 te(gini_index,gdp_per_capita).17    -6.867545317e-2
#> 41 te(gini_index,gdp_per_capita).18     3.314525056e-1
#> 42 te(gini_index,gdp_per_capita).19    -2.226209784e+0
#> 43 te(gini_index,gdp_per_capita).20     1.293901350e+0
#> 44 te(gini_index,gdp_per_capita).21     1.080069668e+0
#> 45 te(gini_index,gdp_per_capita).22     8.908346670e-1
#> 46 te(gini_index,gdp_per_capita).23     8.156460438e-1
#> 47 te(gini_index,gdp_per_capita).24    -3.385958383e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9420895447  0.5836182392                   0.3501207456 
#> 2 observed 0.9420895447  0.5578745296                   0.05464660180
#> 3 estimate 0.9420895447  0.4793905047                   0.01046755054
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.446) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value             Pr(>|z|)    
#> (Intercept) -3.39815230  0.01911937 -177.73348           < 2.22e-16 ***
#> year2009     0.22739102  0.02514366    9.04367           < 2.22e-16 ***
#> year2011     0.27305721  0.02474664   11.03411           < 2.22e-16 ***
#> year2012     0.19932994  0.02676493    7.44743 0.000000000000095176 ***
#> year2013     0.41410899  0.02586480   16.01052           < 2.22e-16 ***
#> year2014     0.38615506  0.02703733   14.28229           < 2.22e-16 ***
#> year2015     0.37087621  0.02597773   14.27670           < 2.22e-16 ***
#> year2016     0.41707153  0.02650261   15.73700           < 2.22e-16 ***
#> year2017     0.37855626  0.02683989   14.10424           < 2.22e-16 ***
#> year2018     0.32137718  0.02695880   11.92105           < 2.22e-16 ***
#> year2019     0.26049893  0.02793545    9.32503           < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    7.544149  8.494998   81.46421 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.250114 19.305117 2269.29789 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0216   Deviance explained = 9.54%
#> -REML = -63791  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.679426317e+1
#> 2 logLik         6.388920899e+4
#> 3 AIC           -1.276988177e+5
#> 4 BIC           -1.273694081e+5
#> 5 deviance       3.045683309e+4
#> 6 df.residual    2.900820574e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -2.157398657e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -3.588826921e-2
#>  2 mean((Intercept))                   -3.398152299e+0
#>  3 year2009                             2.273910229e-1
#>  4 year2011                             2.730572054e-1
#>  5 year2012                             1.993299403e-1
#>  6 year2013                             4.141089877e-1
#>  7 year2014                             3.861550560e-1
#>  8 year2015                             3.708762140e-1
#>  9 year2016                             4.170715259e-1
#> 10 year2017                             3.785562559e-1
#> 11 year2018                             3.213771824e-1
#> 12 year2019                             2.604989311e-1
#> 13 mean(s(spei_12m))                    3.177973298e-2
#> 14 mean(te(gini_index,gdp_per_capita)) -7.147381105e-2
#> 15 s(spei_12m).1                        1.414419830e-1
#> 16 s(spei_12m).2                        4.983657501e-2
#> 17 s(spei_12m).3                       -1.000067657e-2
#> 18 s(spei_12m).4                        2.886979127e-2
#> 19 s(spei_12m).5                       -5.796387621e-2
#> 20 s(spei_12m).6                        9.581636604e-2
#> 21 s(spei_12m).7                       -5.731463229e-2
#> 22 s(spei_12m).8                       -7.255839536e-2
#> 23 s(spei_12m).9                        1.678904620e-1
#> 24 te(gini_index,gdp_per_capita).1     -1.119698183e+0
#> 25 te(gini_index,gdp_per_capita).2     -1.429534583e+0
#> 26 te(gini_index,gdp_per_capita).3     -1.477217965e+0
#> 27 te(gini_index,gdp_per_capita).4      7.597639909e+0
#> 28 te(gini_index,gdp_per_capita).5      2.091013498e-1
#> 29 te(gini_index,gdp_per_capita).6      1.930054492e-1
#> 30 te(gini_index,gdp_per_capita).7     -4.098893822e-1
#> 31 te(gini_index,gdp_per_capita).8      2.474898097e-1
#> 32 te(gini_index,gdp_per_capita).9      2.698633202e+0
#> 33 te(gini_index,gdp_per_capita).10     5.884835433e-1
#> 34 te(gini_index,gdp_per_capita).11     2.365696765e-1
#> 35 te(gini_index,gdp_per_capita).12    -6.255963264e-2
#> 36 te(gini_index,gdp_per_capita).13     1.790936008e-1
#> 37 te(gini_index,gdp_per_capita).14     1.002323927e+0
#> 38 te(gini_index,gdp_per_capita).15     6.552461715e-1
#> 39 te(gini_index,gdp_per_capita).16     5.486526326e-1
#> 40 te(gini_index,gdp_per_capita).17    -2.473203466e-1
#> 41 te(gini_index,gdp_per_capita).18     7.048645160e-1
#> 42 te(gini_index,gdp_per_capita).19    -6.473846294e-1
#> 43 te(gini_index,gdp_per_capita).20     9.211046114e-1
#> 44 te(gini_index,gdp_per_capita).21    -3.881025403e-1
#> 45 te(gini_index,gdp_per_capita).22    -1.175299397e+0
#> 46 te(gini_index,gdp_per_capita).23    -1.210277199e+0
#> 47 te(gini_index,gdp_per_capita).24    -9.330296007e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9275958816  0.4992052948                  2.793717330e-1
#> 2 observed 0.9275958816  0.3008987825                  6.330303072e-2
#> 3 estimate 0.9275958816  0.3728479981                  3.827404525e-3
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(42.126) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.620766968  0.020476782 -127.98725 < 2.22e-16 ***
#> year2009     0.058218265  0.019910319    2.92402  0.0034554 ** 
#> year2011     0.038676379  0.022443692    1.72326  0.0848410 .  
#> year2012    -0.083675116  0.030752475   -2.72092  0.0065100 ** 
#> year2013     0.002978312  0.023432023    0.12710  0.8988578    
#> year2014     0.034189294  0.022643802    1.50987  0.1310755    
#> year2015    -0.074015507  0.031962288   -2.31571  0.0205739 *  
#> year2016     0.007198837  0.034989284    0.20574  0.8369909    
#> year2017     0.002247012  0.029728428    0.07558  0.9397496    
#> year2018    -0.027084949  0.030651037   -0.88366  0.3768824    
#> year2019     0.004140489  0.029769408    0.13909  0.8893827    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf   Ref.df    Chi.sq     p-value    
#> s(spei_12m)                    7.717382  8.59962   32.9246 0.000069845 ***
#> te(gini_index,gdp_per_capita) 16.001065 17.37288 1083.9345  < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0684   Deviance explained = 7.72%
#> -REML = -36306  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       6.841481644e-2 weak           cohen1988
#> 2 SE       3.417308229e-3 <NA>           <NA>     
#> 3 Lower CI 6.171701538e-2 weak           cohen1988
#> 4 Upper CI 7.511261749e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.471844696e+1
#> 2 logLik         3.639786101e+4
#> 3 AIC           -7.271977703e+4
#> 4 BIC           -7.242235022e+4
#> 5 deviance       1.813998341e+4
#> 6 df.residual    1.859828155e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  6.841481644e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               7.341697776e-2
#>  2 mean((Intercept))                   -2.620766968e+0
#>  3 year2009                             5.821826482e-2
#>  4 year2011                             3.867637915e-2
#>  5 year2012                            -8.367511554e-2
#>  6 year2013                             2.978312096e-3
#>  7 year2014                             3.418929394e-2
#>  8 year2015                            -7.401550733e-2
#>  9 year2016                             7.198836531e-3
#> 10 year2017                             2.247011635e-3
#> 11 year2018                            -2.708494893e-2
#> 12 year2019                             4.140489198e-3
#> 13 mean(s(spei_12m))                   -9.236287904e-3
#> 14 mean(te(gini_index,gdp_per_capita))  2.488069819e-1
#> 15 s(spei_12m).1                       -4.613486732e-2
#> 16 s(spei_12m).2                       -2.568979579e-2
#> 17 s(spei_12m).3                        2.783719058e-2
#> 18 s(spei_12m).4                       -8.535310676e-2
#> 19 s(spei_12m).5                        4.753607602e-2
#> 20 s(spei_12m).6                       -6.322519744e-2
#> 21 s(spei_12m).7                        9.152273212e-2
#> 22 s(spei_12m).8                       -1.873058954e-1
#> 23 s(spei_12m).9                        1.576862729e-1
#> 24 te(gini_index,gdp_per_capita).1     -7.813995718e-1
#> 25 te(gini_index,gdp_per_capita).2     -7.569836534e-1
#> 26 te(gini_index,gdp_per_capita).3     -6.940614281e-1
#> 27 te(gini_index,gdp_per_capita).4     -7.089830406e+0
#> 28 te(gini_index,gdp_per_capita).5      1.283558724e-1
#> 29 te(gini_index,gdp_per_capita).6      1.077560846e-1
#> 30 te(gini_index,gdp_per_capita).7     -3.063741771e-1
#> 31 te(gini_index,gdp_per_capita).8      2.150074993e-1
#> 32 te(gini_index,gdp_per_capita).9     -1.386925154e+0
#> 33 te(gini_index,gdp_per_capita).10     3.438434786e-1
#> 34 te(gini_index,gdp_per_capita).11     8.137262586e-2
#> 35 te(gini_index,gdp_per_capita).12    -3.889470758e-2
#> 36 te(gini_index,gdp_per_capita).13    -1.302864867e-2
#> 37 te(gini_index,gdp_per_capita).14     2.801625533e-1
#> 38 te(gini_index,gdp_per_capita).15     7.450813057e-1
#> 39 te(gini_index,gdp_per_capita).16     4.156350439e-1
#> 40 te(gini_index,gdp_per_capita).17    -4.115556263e-1
#> 41 te(gini_index,gdp_per_capita).18     5.201646160e-1
#> 42 te(gini_index,gdp_per_capita).19     2.008179825e+0
#> 43 te(gini_index,gdp_per_capita).20     5.280315458e-1
#> 44 te(gini_index,gdp_per_capita).21     1.886566377e-1
#> 45 te(gini_index,gdp_per_capita).22     8.057516073e-2
#> 46 te(gini_index,gdp_per_capita).23     7.554931055e-2
#> 47 te(gini_index,gdp_per_capita).24     1.173204938e+1
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9613644170  0.8446129978                  5.458642390e-1
#> 2 observed 0.9613644170  0.2866361195                  1.253845810e-1
#> 3 estimate 0.9613644170  0.7107244449                  5.201532273e-3
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(37.864) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.268682114  0.040889938 -55.48265 < 2.22e-16 ***
#> year2009     0.047345573  0.047524977   0.99623  0.3191408    
#> year2011    -0.005831165  0.050681181  -0.11506  0.9084009    
#> year2012    -0.182957757  0.054786015  -3.33950  0.0008393 ***
#> year2013     0.027363913  0.053526948   0.51122  0.6091988    
#> year2014     0.075493640  0.054150664   1.39414  0.1632752    
#> year2015    -0.078631740  0.068362733  -1.15021  0.2500559    
#> year2016    -0.025645711  0.059225682  -0.43302  0.6650026    
#> year2017    -0.018970228  0.059479389  -0.31894  0.7497736    
#> year2018    -0.043299827  0.057217108  -0.75676  0.4491915    
#> year2019    -0.014019059  0.057290398  -0.24470  0.8066874    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf   Ref.df    Chi.sq p-value    
#> s(spei_12m)                    2.889359  3.68932   5.60371 0.27368    
#> te(gini_index,gdp_per_capita) 11.349574 13.45282 174.36664 < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0989   Deviance explained = 12.1%
#> -REML = -4359.5  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.09890811359 weak           cohen1988
#> 2 SE       0.01074374012 <NA>           <NA>     
#> 3 Lower CI 0.07785076991 weak           cohen1988
#> 4 Upper CI 0.1199654573  weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.523893311e+1
#> 2 logLik         4.409426275e+3
#> 3 AIC           -8.760568268e+3
#> 4 BIC           -8.590403466e+3
#> 5 deviance       2.444972252e+3
#> 6 df.residual    2.512761067e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  9.890811359e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -7.592613248e-2
#>  2 mean((Intercept))                   -2.268682114e+0
#>  3 year2009                             4.734557350e-2
#>  4 year2011                            -5.831164999e-3
#>  5 year2012                            -1.829577572e-1
#>  6 year2013                             2.736391258e-2
#>  7 year2014                             7.549363953e-2
#>  8 year2015                            -7.863174013e-2
#>  9 year2016                            -2.564571120e-2
#> 10 year2017                            -1.897022808e-2
#> 11 year2018                            -4.329982719e-2
#> 12 year2019                            -1.401905860e-2
#> 13 mean(s(spei_12m))                    6.540169102e-3
#> 14 mean(te(gini_index,gdp_per_capita)) -3.799070311e-2
#> 15 s(spei_12m).1                       -4.008651089e-2
#> 16 s(spei_12m).2                        4.079581844e-2
#> 17 s(spei_12m).3                       -3.119093474e-3
#> 18 s(spei_12m).4                       -1.254935350e-2
#> 19 s(spei_12m).5                       -5.362924734e-3
#> 20 s(spei_12m).6                        1.559926540e-2
#> 21 s(spei_12m).7                        2.704535051e-3
#> 22 s(spei_12m).8                        9.883023392e-2
#> 23 s(spei_12m).9                       -3.795044830e-2
#> 24 te(gini_index,gdp_per_capita).1      5.519785492e-2
#> 25 te(gini_index,gdp_per_capita).2     -7.264806716e-2
#> 26 te(gini_index,gdp_per_capita).3     -1.352418407e-1
#> 27 te(gini_index,gdp_per_capita).4     -2.055574387e+0
#> 28 te(gini_index,gdp_per_capita).5      4.875974026e-1
#> 29 te(gini_index,gdp_per_capita).6     -1.587450968e-1
#> 30 te(gini_index,gdp_per_capita).7      1.296215092e-1
#> 31 te(gini_index,gdp_per_capita).8     -4.128260909e-1
#> 32 te(gini_index,gdp_per_capita).9     -9.377897912e-1
#> 33 te(gini_index,gdp_per_capita).10     4.764039750e-1
#> 34 te(gini_index,gdp_per_capita).11     2.109089096e-2
#> 35 te(gini_index,gdp_per_capita).12     5.150093123e-2
#> 36 te(gini_index,gdp_per_capita).13    -1.872209458e-1
#> 37 te(gini_index,gdp_per_capita).14    -6.183323791e-1
#> 38 te(gini_index,gdp_per_capita).15     4.394543335e-1
#> 39 te(gini_index,gdp_per_capita).16    -5.029370748e-2
#> 40 te(gini_index,gdp_per_capita).17     1.270925793e-1
#> 41 te(gini_index,gdp_per_capita).18    -3.755606471e-1
#> 42 te(gini_index,gdp_per_capita).19    -2.330163689e-1
#> 43 te(gini_index,gdp_per_capita).20     2.585909656e-1
#> 44 te(gini_index,gdp_per_capita).21     3.130989722e-1
#> 45 te(gini_index,gdp_per_capita).22     2.737408539e-1
#> 46 te(gini_index,gdp_per_capita).23     6.763256467e-2
#> 47 te(gini_index,gdp_per_capita).24     1.624449615e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9464494757  0.6150541202                  4.570217924e-1
#> 2 observed 0.9464494757  0.2304707413                  3.277731155e-1
#> 3 estimate 0.9464494757  0.4655127094                  9.695469040e-3
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 209: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(beipr_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(29.936) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value          Pr(>|z|)    
#> (Intercept) -2.99878598  0.03261588 -91.94252        < 2.22e-16 ***
#> year2009     0.07081325  0.04421256   1.60165        0.10923203    
#> year2011     0.13677162  0.03945138   3.46684        0.00052661 ***
#> year2012     0.15511255  0.04247901   3.65151        0.00026070 ***
#> year2013     0.26970425  0.04060933   6.64143 0.000000000031064 ***
#> year2014     0.41027628  0.04231045   9.69681        < 2.22e-16 ***
#> year2015     0.48791945  0.04610164  10.58356        < 2.22e-16 ***
#> year2016     0.44953306  0.04613775   9.74328        < 2.22e-16 ***
#> year2017     0.46841422  0.04464446  10.49210        < 2.22e-16 ***
#> year2018     0.49898124  0.04156296  12.00543        < 2.22e-16 ***
#> year2019     0.54047605  0.04762814  11.34783        < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    4.141069  5.234906   24.74406 0.00018972 ***
#> te(gini_index,gdp_per_capita) 18.295511 19.713229 1101.49830 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.112   Deviance explained =   16%
#> -REML = -13609  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       1.115294580e-1 weak           cohen1988
#> 2 SE       6.656805371e-3 <NA>           <NA>     
#> 3 Lower CI 9.848235918e-2 weak           cohen1988
#> 4 Upper CI 1.245765567e-1 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.343658047e+1
#> 2 logLik         1.369171308e+4
#> 3 AIC           -2.731027342e+4
#> 4 BIC           -2.705820190e+4
#> 5 deviance       7.382702348e+3
#> 6 df.residual    7.237563420e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  1.115294580e-1
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.283507270e-1
#>  2 mean((Intercept))                   -2.998785985e+0
#>  3 year2009                             7.081324919e-2
#>  4 year2011                             1.367716203e-1
#>  5 year2012                             1.551125543e-1
#>  6 year2013                             2.697042483e-1
#>  7 year2014                             4.102762779e-1
#>  8 year2015                             4.879194535e-1
#>  9 year2016                             4.495330638e-1
#> 10 year2017                             4.684142227e-1
#> 11 year2018                             4.989812392e-1
#> 12 year2019                             5.404760498e-1
#> 13 mean(s(spei_12m))                   -9.625153504e-3
#> 14 mean(te(gini_index,gdp_per_capita)) -2.520842334e-1
#> 15 s(spei_12m).1                       -9.635650001e-2
#> 16 s(spei_12m).2                       -8.006567200e-2
#> 17 s(spei_12m).3                        2.276201699e-3
#> 18 s(spei_12m).4                       -2.233211896e-2
#> 19 s(spei_12m).5                       -1.791541793e-2
#> 20 s(spei_12m).6                        2.604322717e-2
#> 21 s(spei_12m).7                       -1.286176649e-2
#> 22 s(spei_12m).8                        1.803594563e-1
#> 23 s(spei_12m).9                       -6.577379134e-2
#> 24 te(gini_index,gdp_per_capita).1     -9.735629435e-1
#> 25 te(gini_index,gdp_per_capita).2     -6.422293103e-1
#> 26 te(gini_index,gdp_per_capita).3     -4.647335464e-1
#> 27 te(gini_index,gdp_per_capita).4      1.316316608e+0
#> 28 te(gini_index,gdp_per_capita).5      3.506072661e-1
#> 29 te(gini_index,gdp_per_capita).6      8.705321292e-2
#> 30 te(gini_index,gdp_per_capita).7     -4.759918274e-1
#> 31 te(gini_index,gdp_per_capita).8      2.841693395e-1
#> 32 te(gini_index,gdp_per_capita).9     -6.816867580e-1
#> 33 te(gini_index,gdp_per_capita).10     5.687276783e-1
#> 34 te(gini_index,gdp_per_capita).11     1.408928335e-1
#> 35 te(gini_index,gdp_per_capita).12    -9.040005533e-2
#> 36 te(gini_index,gdp_per_capita).13     1.444079150e-1
#> 37 te(gini_index,gdp_per_capita).14    -1.441666103e+0
#> 38 te(gini_index,gdp_per_capita).15     7.032678760e-1
#> 39 te(gini_index,gdp_per_capita).16     4.229160834e-1
#> 40 te(gini_index,gdp_per_capita).17    -1.045149770e-2
#> 41 te(gini_index,gdp_per_capita).18     2.794978765e-1
#> 42 te(gini_index,gdp_per_capita).19    -2.224607890e+0
#> 43 te(gini_index,gdp_per_capita).20     7.387072543e-1
#> 44 te(gini_index,gdp_per_capita).21     1.123575597e+0
#> 45 te(gini_index,gdp_per_capita).22     3.705866655e-1
#> 46 te(gini_index,gdp_per_capita).23     4.785325026e-1
#> 47 te(gini_index,gdp_per_capita).24    -6.053950378e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9420895447  0.5836182392                   0.3501207456 
#> 2 observed 0.9420895447  0.5115158900                   0.05841210345
#> 3 estimate 0.9420895447  0.4793905047                   0.01046755054
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(26.729) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value            Pr(>|z|)    
#> (Intercept) -3.09758344  0.01635898 -189.35070          < 2.22e-16 ***
#> year2009     0.14724818  0.02140509    6.87912 0.00000000000602239 ***
#> year2011     0.15368581  0.02124160    7.23513 0.00000000000046507 ***
#> year2012     0.08356946  0.02304343    3.62661          0.00028717 ***
#> year2013     0.25192005  0.02214861   11.37408          < 2.22e-16 ***
#> year2014     0.24869881  0.02318614   10.72619          < 2.22e-16 ***
#> year2015     0.32492541  0.02206083   14.72861          < 2.22e-16 ***
#> year2016     0.29693782  0.02269660   13.08292          < 2.22e-16 ***
#> year2017     0.32556156  0.02281932   14.26693          < 2.22e-16 ***
#> year2018     0.31283156  0.02288037   13.67249          < 2.22e-16 ***
#> year2019     0.28252383  0.02369961   11.92103          < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    7.901213  8.698504   60.63316 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 17.850119 18.963616 2713.35083 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.048   Deviance explained = 11.2%
#> -REML = -57784  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.675133179e+1
#> 2 logLik         5.788346961e+4
#> 3 AIC           -1.156876150e+5
#> 4 BIC           -1.153593474e+5
#> 5 deviance       3.026805245e+4
#> 6 df.residual    2.900824867e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -4.800591416e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -8.554078786e-2
#>  2 mean((Intercept))                   -3.097583437e+0
#>  3 year2009                             1.472481847e-1
#>  4 year2011                             1.536858069e-1
#>  5 year2012                             8.356945881e-2
#>  6 year2013                             2.519200497e-1
#>  7 year2014                             2.486988140e-1
#>  8 year2015                             3.249254061e-1
#>  9 year2016                             2.969378204e-1
#> 10 year2017                             3.255615550e-1
#> 11 year2018                             3.128315572e-1
#> 12 year2019                             2.825238325e-1
#> 13 mean(s(spei_12m))                   -3.597975302e-4
#> 14 mean(te(gini_index,gdp_per_capita)) -1.287864807e-1
#> 15 s(spei_12m).1                        2.021638934e-1
#> 16 s(spei_12m).2                       -2.823769474e-1
#> 17 s(spei_12m).3                        1.810484441e-1
#> 18 s(spei_12m).4                        2.612947635e-1
#> 19 s(spei_12m).5                       -6.860153445e-2
#> 20 s(spei_12m).6                        2.009209323e-1
#> 21 s(spei_12m).7                       -1.395550199e-1
#> 22 s(spei_12m).8                       -6.710101164e-1
#> 23 s(spei_12m).9                        3.128774072e-1
#> 24 te(gini_index,gdp_per_capita).1     -1.300480953e+0
#> 25 te(gini_index,gdp_per_capita).2     -1.403615873e+0
#> 26 te(gini_index,gdp_per_capita).3     -1.413501674e+0
#> 27 te(gini_index,gdp_per_capita).4      1.599849003e+1
#> 28 te(gini_index,gdp_per_capita).5      2.679432580e-1
#> 29 te(gini_index,gdp_per_capita).6      1.864322651e-1
#> 30 te(gini_index,gdp_per_capita).7     -3.995998658e-1
#> 31 te(gini_index,gdp_per_capita).8      2.345051111e-1
#> 32 te(gini_index,gdp_per_capita).9      5.433299705e+0
#> 33 te(gini_index,gdp_per_capita).10     4.662637856e-1
#> 34 te(gini_index,gdp_per_capita).11     2.150365022e-1
#> 35 te(gini_index,gdp_per_capita).12    -5.842308641e-2
#> 36 te(gini_index,gdp_per_capita).13     1.773377538e-1
#> 37 te(gini_index,gdp_per_capita).14     1.751293438e+0
#> 38 te(gini_index,gdp_per_capita).15     5.437910133e-1
#> 39 te(gini_index,gdp_per_capita).16     5.393299690e-1
#> 40 te(gini_index,gdp_per_capita).17    -2.173888487e-1
#> 41 te(gini_index,gdp_per_capita).18     6.910824492e-1
#> 42 te(gini_index,gdp_per_capita).19    -1.866339996e+0
#> 43 te(gini_index,gdp_per_capita).20     1.795199471e-1
#> 44 te(gini_index,gdp_per_capita).21    -4.537530539e-1
#> 45 te(gini_index,gdp_per_capita).22    -7.555563964e-1
#> 46 te(gini_index,gdp_per_capita).23    -5.792240575e-1
#> 47 te(gini_index,gdp_per_capita).24    -2.132731696e+1
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9275958816  0.4992052948                  2.793717330e-1
#> 2 observed 0.9275958816  0.1083056916                  5.241800592e-2
#> 3 estimate 0.9275958816  0.3728479981                  3.827404525e-3
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(81.808) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value    Pr(>|z|)    
#> (Intercept) -2.53875962  0.01482117 -171.29275  < 2.22e-16 ***
#> year2009     0.03096156  0.01430873    2.16382  0.03047787 *  
#> year2011    -0.02356886  0.01637470   -1.43935  0.15005250    
#> year2012    -0.07698674  0.02219359   -3.46887  0.00052265 ***
#> year2013     0.02015739  0.01706305    1.18135  0.23746489    
#> year2014     0.02300799  0.01655738    1.38959  0.16465306    
#> year2015     0.02532993  0.02295406    1.10351  0.26980788    
#> year2016    -0.01366767  0.02530460   -0.54013  0.58911037    
#> year2017     0.06771156  0.02144729    3.15711  0.00159339 ** 
#> year2018     0.10345396  0.02199161    4.70425 0.000002548 ***
#> year2019     0.08563376  0.02147626    3.98737 0.000066810 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    7.994388  8.744933   53.07363 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 15.069627 16.636388 2140.57662 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.143   Deviance explained = 12.8%
#> -REML = -40389  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       1.432321617e-1 moderate       cohen1988
#> 2 SE       4.547470866e-3 <NA>           <NA>     
#> 3 Lower CI 1.343192826e-1 moderate       cohen1988
#> 4 Upper CI 1.521450408e-1 moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.406401500e+1
#> 2 logLik         4.048503568e+4
#> 3 AIC           -8.089544008e+4
#> 4 BIC           -8.060315824e+4
#> 5 deviance       1.837760439e+4
#> 6 df.residual    1.859893598e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  1.432321617e-1
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               4.330707128e-2
#>  2 mean((Intercept))                   -2.538759625e+0
#>  3 year2009                             3.096156183e-2
#>  4 year2011                            -2.356886354e-2
#>  5 year2012                            -7.698673974e-2
#>  6 year2013                             2.015738543e-2
#>  7 year2014                             2.300799097e-2
#>  8 year2015                             2.532992637e-2
#>  9 year2016                            -1.366766665e-2
#> 10 year2017                             6.771156410e-2
#> 11 year2018                             1.034539591e-1
#> 12 year2019                             8.563376216e-2
#> 13 mean(s(spei_12m))                   -2.210519091e-2
#> 14 mean(te(gini_index,gdp_per_capita))  1.833826916e-1
#> 15 s(spei_12m).1                       -8.489617037e-2
#> 16 s(spei_12m).2                       -7.388802165e-2
#> 17 s(spei_12m).3                        3.610451454e-2
#> 18 s(spei_12m).4                       -7.931824913e-2
#> 19 s(spei_12m).5                        4.635180161e-2
#> 20 s(spei_12m).6                       -6.954696071e-2
#> 21 s(spei_12m).7                        8.679941785e-2
#> 22 s(spei_12m).8                       -2.559302061e-1
#> 23 s(spei_12m).9                        1.953771557e-1
#> 24 te(gini_index,gdp_per_capita).1     -5.254341623e-1
#> 25 te(gini_index,gdp_per_capita).2     -4.800486715e-1
#> 26 te(gini_index,gdp_per_capita).3     -4.109513460e-1
#> 27 te(gini_index,gdp_per_capita).4     -3.583947740e+0
#> 28 te(gini_index,gdp_per_capita).5      3.330085685e-1
#> 29 te(gini_index,gdp_per_capita).6     -1.551848345e-2
#> 30 te(gini_index,gdp_per_capita).7     -1.891532199e-1
#> 31 te(gini_index,gdp_per_capita).8     -3.684561886e-2
#> 32 te(gini_index,gdp_per_capita).9     -8.634146385e-1
#> 33 te(gini_index,gdp_per_capita).10     4.972739945e-1
#> 34 te(gini_index,gdp_per_capita).11     6.218926914e-2
#> 35 te(gini_index,gdp_per_capita).12    -5.211366224e-2
#> 36 te(gini_index,gdp_per_capita).13    -6.350505861e-2
#> 37 te(gini_index,gdp_per_capita).14    -6.054313867e-2
#> 38 te(gini_index,gdp_per_capita).15     6.679448815e-1
#> 39 te(gini_index,gdp_per_capita).16     2.471151161e-1
#> 40 te(gini_index,gdp_per_capita).17    -1.166431762e-1
#> 41 te(gini_index,gdp_per_capita).18     1.335971202e-1
#> 42 te(gini_index,gdp_per_capita).19     7.889725360e-1
#> 43 te(gini_index,gdp_per_capita).20     1.424272475e+0
#> 44 te(gini_index,gdp_per_capita).21     3.969634709e-1
#> 45 te(gini_index,gdp_per_capita).22     3.048509850e-1
#> 46 te(gini_index,gdp_per_capita).23     2.647556846e-1
#> 47 te(gini_index,gdp_per_capita).24     5.678359414e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9613644170  0.8446129978                  5.458642390e-1
#> 2 observed 0.9613644170  0.3864015807                  2.094565480e-1
#> 3 estimate 0.9613644170  0.7107244449                  5.201532273e-3
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(63.448) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value      Pr(>|z|)    
#> (Intercept) -2.09494545  0.03006017 -69.69173    < 2.22e-16 ***
#> year2009     0.12205175  0.03440710   3.54728    0.00038923 ***
#> year2011     0.10476896  0.03663616   2.85971    0.00424023 ** 
#> year2012     0.10385703  0.03904733   2.65977    0.00781934 ** 
#> year2013     0.16644869  0.03855557   4.31711 0.00001580845 ***
#> year2014     0.18325322  0.03940017   4.65108 0.00000330206 ***
#> year2015     0.17205214  0.04820913   3.56887    0.00035852 ***
#> year2016     0.15921902  0.04282270   3.71810    0.00020073 ***
#> year2017     0.20706134  0.04261368   4.85903 0.00000117960 ***
#> year2018     0.20204117  0.04081477   4.95020 0.00000074138 ***
#> year2019     0.20191820  0.04093094   4.93314 0.00000080917 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq  p-value    
#> s(spei_12m)                    2.024018  2.598938   8.29005 0.031124 *  
#> te(gini_index,gdp_per_capita) 13.263294 15.366068 516.04372  < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.213   Deviance explained = 20.3%
#> -REML = -4525.3  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.2129726201  moderate       cohen1988
#> 2 SE       0.01376962725 <NA>           <NA>     
#> 3 Lower CI 0.1859846466  moderate       cohen1988
#> 4 Upper CI 0.2399605936  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.628731266e+1
#> 2 logLik         4.584839832e+3
#> 3 AIC           -9.109749651e+3
#> 4 BIC           -8.934780035e+3
#> 5 deviance       2.479699760e+3
#> 6 df.residual    2.511712687e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.129726201e-1
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.391040551e-2
#>  2 mean((Intercept))                   -2.094945446e+0
#>  3 year2009                             1.220517501e-1
#>  4 year2011                             1.047689573e-1
#>  5 year2012                             1.038570276e-1
#>  6 year2013                             1.664486903e-1
#>  7 year2014                             1.832532249e-1
#>  8 year2015                             1.720521379e-1
#>  9 year2016                             1.592190196e-1
#> 10 year2017                             2.070613374e-1
#> 11 year2018                             2.020411740e-1
#> 12 year2019                             2.019181953e-1
#> 13 mean(s(spei_12m))                   -4.745622149e-3
#> 14 mean(te(gini_index,gdp_per_capita)) -4.044721336e-3
#> 15 s(spei_12m).1                       -3.047227584e-4
#> 16 s(spei_12m).2                       -1.147448985e-2
#> 17 s(spei_12m).3                        3.719335499e-4
#> 18 s(spei_12m).4                        8.709914490e-3
#> 19 s(spei_12m).5                        7.306053092e-4
#> 20 s(spei_12m).6                       -8.731379643e-3
#> 21 s(spei_12m).7                       -2.210018583e-3
#> 22 s(spei_12m).8                       -5.565715943e-2
#> 23 s(spei_12m).9                        2.585471758e-2
#> 24 te(gini_index,gdp_per_capita).1     -9.482904515e-2
#> 25 te(gini_index,gdp_per_capita).2     -3.058664409e-1
#> 26 te(gini_index,gdp_per_capita).3     -4.166153170e-1
#> 27 te(gini_index,gdp_per_capita).4     -6.568713411e-1
#> 28 te(gini_index,gdp_per_capita).5      5.335863338e-1
#> 29 te(gini_index,gdp_per_capita).6     -2.264846448e-1
#> 30 te(gini_index,gdp_per_capita).7      9.748295032e-2
#> 31 te(gini_index,gdp_per_capita).8     -5.090429813e-1
#> 32 te(gini_index,gdp_per_capita).9     -3.817064285e-1
#> 33 te(gini_index,gdp_per_capita).10     5.294958947e-1
#> 34 te(gini_index,gdp_per_capita).11     1.059180066e-2
#> 35 te(gini_index,gdp_per_capita).12     5.054846519e-2
#> 36 te(gini_index,gdp_per_capita).13    -2.025307535e-1
#> 37 te(gini_index,gdp_per_capita).14    -3.026506524e-1
#> 38 te(gini_index,gdp_per_capita).15     4.966251051e-1
#> 39 te(gini_index,gdp_per_capita).16    -5.129588333e-2
#> 40 te(gini_index,gdp_per_capita).17     1.837182573e-1
#> 41 te(gini_index,gdp_per_capita).18    -3.674527732e-1
#> 42 te(gini_index,gdp_per_capita).19    -2.065892592e-1
#> 43 te(gini_index,gdp_per_capita).20     1.688851234e-1
#> 44 te(gini_index,gdp_per_capita).21     3.670049804e-1
#> 45 te(gini_index,gdp_per_capita).22     4.994908252e-1
#> 46 te(gini_index,gdp_per_capita).23     4.325636563e-1
#> 47 te(gini_index,gdp_per_capita).24     2.548688160e-1
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9464494757  0.6150541202                  4.570217924e-1
#> 2 observed 0.9464494757  0.4864079381                  2.629026647e-1
#> 3 estimate 0.9464494757  0.4655127094                  9.695469040e-3
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 210: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mbepr_beipr_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(19.864) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value      Pr(>|z|)    
#> (Intercept) -2.26110956  0.02990933 -75.59880    < 2.22e-16 ***
#> year2009     0.18657418  0.03614334   5.16206 0.00000024424 ***
#> year2011     0.18934856  0.03698799   5.11919 0.00000030685 ***
#> year2012     0.18524859  0.03859079   4.80033 0.00000158403 ***
#> year2013     0.32125482  0.03800938   8.45199    < 2.22e-16 ***
#> year2014     0.44275762  0.03852650  11.49229    < 2.22e-16 ***
#> year2015     0.39136231  0.04165843   9.39455    < 2.22e-16 ***
#> year2016     0.44803384  0.04254300  10.53132    < 2.22e-16 ***
#> year2017     0.38823352  0.04129933   9.40048    < 2.22e-16 ***
#> year2018     0.41050953  0.03919475  10.47359    < 2.22e-16 ***
#> year2019     0.45309294  0.04356627  10.40009    < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                    edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    1.02077  1.041268    8.19951  0.0048905 ** 
#> te(gini_index,gdp_per_capita) 18.11940 19.554231 1027.57116 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.123   Deviance explained = 12.9%
#> -REML = -9501.9  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       1.226379351e-1 weak           cohen1988
#> 2 SE       6.893174901e-3 <NA>           <NA>     
#> 3 Lower CI 1.091275605e-1 weak           cohen1988
#> 4 Upper CI 1.361483096e-1 moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.014016920e+1
#> 2 logLik         9.580520680e+3
#> 3 AIC           -1.909614870e+4
#> 4 BIC           -1.887253998e+4
#> 5 deviance       7.117102258e+3
#> 6 df.residual    7.240859831e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  1.226379351e-1
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -8.287916410e-2
#>  2 mean((Intercept))                   -2.261109559e+0
#>  3 year2009                             1.865741833e-1
#>  4 year2011                             1.893485625e-1
#>  5 year2012                             1.852485891e-1
#>  6 year2013                             3.212548185e-1
#>  7 year2014                             4.427576210e-1
#>  8 year2015                             3.913623111e-1
#>  9 year2016                             4.480338422e-1
#> 10 year2017                             3.882335213e-1
#> 11 year2018                             4.105095322e-1
#> 12 year2019                             4.530929441e-1
#> 13 mean(s(spei_12m))                    3.343720200e-3
#> 14 mean(te(gini_index,gdp_per_capita)) -2.013367945e-1
#> 15 s(spei_12m).1                       -1.183891425e-4
#> 16 s(spei_12m).2                       -1.334528614e-4
#> 17 s(spei_12m).3                       -1.951257306e-5
#> 18 s(spei_12m).4                       -9.645384905e-5
#> 19 s(spei_12m).5                       -3.501842488e-5
#> 20 s(spei_12m).6                        9.353217265e-5
#> 21 s(spei_12m).7                       -4.019795500e-5
#> 22 s(spei_12m).8                        5.916065103e-4
#> 23 s(spei_12m).9                        2.985136792e-2
#> 24 te(gini_index,gdp_per_capita).1     -6.556604755e-1
#> 25 te(gini_index,gdp_per_capita).2     -4.253556020e-1
#> 26 te(gini_index,gdp_per_capita).3     -3.268514768e-1
#> 27 te(gini_index,gdp_per_capita).4      5.420572433e-1
#> 28 te(gini_index,gdp_per_capita).5      4.720109573e-1
#> 29 te(gini_index,gdp_per_capita).6      5.760015280e-2
#> 30 te(gini_index,gdp_per_capita).7     -3.244730945e-1
#> 31 te(gini_index,gdp_per_capita).8      1.024164612e-1
#> 32 te(gini_index,gdp_per_capita).9     -8.624828135e-1
#> 33 te(gini_index,gdp_per_capita).10     6.533478937e-1
#> 34 te(gini_index,gdp_per_capita).11     8.098775814e-2
#> 35 te(gini_index,gdp_per_capita).12    -9.390397193e-2
#> 36 te(gini_index,gdp_per_capita).13     4.447231485e-2
#> 37 te(gini_index,gdp_per_capita).14    -1.412189826e+0
#> 38 te(gini_index,gdp_per_capita).15     7.743257500e-1
#> 39 te(gini_index,gdp_per_capita).16     2.216821208e-1
#> 40 te(gini_index,gdp_per_capita).17    -3.912953897e-2
#> 41 te(gini_index,gdp_per_capita).18     1.250515717e-1
#> 42 te(gini_index,gdp_per_capita).19    -2.005190509e+0
#> 43 te(gini_index,gdp_per_capita).20     8.146573496e-1
#> 44 te(gini_index,gdp_per_capita).21     1.388504646e+0
#> 45 te(gini_index,gdp_per_capita).22     5.053862750e-1
#> 46 te(gini_index,gdp_per_capita).23     5.504320109e-1
#> 47 te(gini_index,gdp_per_capita).24    -5.019778266e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9420895447  0.5836182392                   0.3501207456 
#> 2 observed 0.9420895447  0.5455348897                   0.1024102286 
#> 3 estimate 0.9420895447  0.4793905047                   0.01046755054
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.222) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.41284681  0.01544003 -156.27216 < 2.22e-16 ***
#> year2009     0.15627995  0.02013884    7.76013 8.4845e-15 ***
#> year2011     0.15719654  0.01995409    7.87791 3.3290e-15 ***
#> year2012     0.09868045  0.02164855    4.55829 5.1571e-06 ***
#> year2013     0.24957222  0.02071353   12.04875 < 2.22e-16 ***
#> year2014     0.25448240  0.02187936   11.63116 < 2.22e-16 ***
#> year2015     0.25530574  0.02096622   12.17701 < 2.22e-16 ***
#> year2016     0.25053660  0.02150300   11.65124 < 2.22e-16 ***
#> year2017     0.24614222  0.02156012   11.41655 < 2.22e-16 ***
#> year2018     0.21630095  0.02179149    9.92594 < 2.22e-16 ***
#> year2019     0.19263680  0.02261202    8.51922 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    4.581591  5.702138   25.74091 0.00027842 ***
#> te(gini_index,gdp_per_capita) 18.141427 19.135790 2191.28265 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00514   Deviance explained = 9.14%
#> -REML = -41930  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.372301717e+1
#> 2 logLik         4.202198817e+4
#> 3 AIC           -8.397111148e+4
#> 4 BIC           -8.366957474e+4
#> 5 deviance       2.914746739e+4
#> 6 df.residual    2.901127698e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -5.137377310e-3
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -7.937436818e-2
#>  2 mean((Intercept))                   -2.412846810e+0
#>  3 year2009                             1.562799455e-1
#>  4 year2011                             1.571965415e-1
#>  5 year2012                             9.868044570e-2
#>  6 year2013                             2.495722170e-1
#>  7 year2014                             2.544823989e-1
#>  8 year2015                             2.553057421e-1
#>  9 year2016                             2.505365974e-1
#> 10 year2017                             2.461422192e-1
#> 11 year2018                             2.163009527e-1
#> 12 year2019                             1.926368027e-1
#> 13 mean(s(spei_12m))                    2.220722510e-2
#> 14 mean(te(gini_index,gdp_per_capita)) -1.398593450e-1
#> 15 s(spei_12m).1                        7.470939163e-2
#> 16 s(spei_12m).2                        2.060639235e-2
#> 17 s(spei_12m).3                        2.607572959e-2
#> 18 s(spei_12m).4                        1.127371402e-2
#> 19 s(spei_12m).5                       -1.992804321e-3
#> 20 s(spei_12m).6                        6.510494472e-3
#> 21 s(spei_12m).7                       -3.641605409e-3
#> 22 s(spei_12m).8                       -1.791678280e-2
#> 23 s(spei_12m).9                        8.424049641e-2
#> 24 te(gini_index,gdp_per_capita).1     -1.232318746e+0
#> 25 te(gini_index,gdp_per_capita).2     -1.377029617e+0
#> 26 te(gini_index,gdp_per_capita).3     -1.446143511e+0
#> 27 te(gini_index,gdp_per_capita).4      1.588242862e+1
#> 28 te(gini_index,gdp_per_capita).5      3.168539699e-1
#> 29 te(gini_index,gdp_per_capita).6      2.313719071e-1
#> 30 te(gini_index,gdp_per_capita).7     -3.359799879e-1
#> 31 te(gini_index,gdp_per_capita).8      3.106900588e-1
#> 32 te(gini_index,gdp_per_capita).9      5.303062177e+0
#> 33 te(gini_index,gdp_per_capita).10     4.587259247e-1
#> 34 te(gini_index,gdp_per_capita).11     1.898342220e-1
#> 35 te(gini_index,gdp_per_capita).12    -7.495064321e-2
#> 36 te(gini_index,gdp_per_capita).13     1.633345198e-1
#> 37 te(gini_index,gdp_per_capita).14     1.625577822e+0
#> 38 te(gini_index,gdp_per_capita).15     5.277746590e-1
#> 39 te(gini_index,gdp_per_capita).16     5.006469800e-1
#> 40 te(gini_index,gdp_per_capita).17    -2.737283618e-1
#> 41 te(gini_index,gdp_per_capita).18     6.542806015e-1
#> 42 te(gini_index,gdp_per_capita).19    -1.975342407e+0
#> 43 te(gini_index,gdp_per_capita).20     3.763151288e-1
#> 44 te(gini_index,gdp_per_capita).21    -4.358908280e-1
#> 45 te(gini_index,gdp_per_capita).22    -7.976308733e-1
#> 46 te(gini_index,gdp_per_capita).23    -6.930983309e-1
#> 47 te(gini_index,gdp_per_capita).24    -2.125540756e+1
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9275958816  0.4992052948                  2.793717330e-1
#> 2 observed 0.9275958816  0.2133469931                  6.540552484e-2
#> 3 estimate 0.9275958816  0.3728479981                  3.827404525e-3
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(36.38) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -1.762100351  0.016528791 -106.60794 < 2.22e-16 ***
#> year2009     0.040616092  0.016004302    2.53782 0.01115442 *  
#> year2011    -0.011530744  0.018166960   -0.63471 0.52561785    
#> year2012    -0.114974674  0.024833559   -4.62981 0.00000366 ***
#> year2013    -0.033710114  0.018986031   -1.77552 0.07581175 .  
#> year2014    -0.017840139  0.018370682   -0.97112 0.33148848    
#> year2015    -0.087072399  0.025785421   -3.37681 0.00073332 ***
#> year2016    -0.072810365  0.028339260   -2.56924 0.01019218 *  
#> year2017    -0.019535221  0.024035329   -0.81277 0.41634930    
#> year2018    -0.017910866  0.024722667   -0.72447 0.46877635    
#> year2019    -0.007282555  0.024084815   -0.30237 0.76236909    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    8.407795  8.906442   71.01221 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 16.085850 17.531023 1720.11854 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.127   Deviance explained = 12.2%
#> -REML = -27616  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       1.265527675e-1 weak           cohen1988
#> 2 SE       4.357716704e-3 <NA>           <NA>     
#> 3 Lower CI 1.180117997e-1 weak           cohen1988
#> 4 Upper CI 1.350937353e-1 moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.549364570e+1
#> 2 logLik         2.771416957e+4
#> 3 AIC           -5.535149222e+4
#> 4 BIC           -5.505053315e+4
#> 5 deviance       1.819512600e+4
#> 6 df.residual    1.859750635e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  1.265527675e-1
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               7.986986201e-2
#>  2 mean((Intercept))                   -1.762100351e+0
#>  3 year2009                             4.061609199e-2
#>  4 year2011                            -1.153074360e-2
#>  5 year2012                            -1.149746744e-1
#>  6 year2013                            -3.371011393e-2
#>  7 year2014                            -1.784013892e-2
#>  8 year2015                            -8.707239899e-2
#>  9 year2016                            -7.281036466e-2
#> 10 year2017                            -1.953522123e-2
#> 11 year2018                            -1.791086600e-2
#> 12 year2019                            -7.282554817e-3
#> 13 mean(s(spei_12m))                   -3.840474957e-2
#> 14 mean(te(gini_index,gdp_per_capita))  2.485028337e-1
#> 15 s(spei_12m).1                       -1.072273411e-1
#> 16 s(spei_12m).2                       -1.154165089e-1
#> 17 s(spei_12m).3                        4.945723250e-2
#> 18 s(spei_12m).4                       -1.439433298e-1
#> 19 s(spei_12m).5                        6.996767967e-2
#> 20 s(spei_12m).6                       -1.097231487e-1
#> 21 s(spei_12m).7                        1.370875641e-1
#> 22 s(spei_12m).8                       -3.868453717e-1
#> 23 s(spei_12m).9                        2.610004778e-1
#> 24 te(gini_index,gdp_per_capita).1     -5.166978009e-1
#> 25 te(gini_index,gdp_per_capita).2     -5.095557142e-1
#> 26 te(gini_index,gdp_per_capita).3     -4.531864512e-1
#> 27 te(gini_index,gdp_per_capita).4     -5.534340920e+0
#> 28 te(gini_index,gdp_per_capita).5      2.227672830e-1
#> 29 te(gini_index,gdp_per_capita).6      5.372567225e-2
#> 30 te(gini_index,gdp_per_capita).7     -2.601701383e-1
#> 31 te(gini_index,gdp_per_capita).8      1.030327767e-1
#> 32 te(gini_index,gdp_per_capita).9     -1.146912022e+0
#> 33 te(gini_index,gdp_per_capita).10     4.698944228e-1
#> 34 te(gini_index,gdp_per_capita).11     5.982159232e-2
#> 35 te(gini_index,gdp_per_capita).12    -5.683294936e-2
#> 36 te(gini_index,gdp_per_capita).13    -4.567634995e-2
#> 37 te(gini_index,gdp_per_capita).14     1.431379131e-1
#> 38 te(gini_index,gdp_per_capita).15     7.526157224e-1
#> 39 te(gini_index,gdp_per_capita).16     3.526763759e-1
#> 40 te(gini_index,gdp_per_capita).17    -2.919630870e-1
#> 41 te(gini_index,gdp_per_capita).18     3.475163719e-1
#> 42 te(gini_index,gdp_per_capita).19     1.499146412e+0
#> 43 te(gini_index,gdp_per_capita).20     9.077592358e-1
#> 44 te(gini_index,gdp_per_capita).21     3.043757509e-1
#> 45 te(gini_index,gdp_per_capita).22     1.762325650e-1
#> 46 te(gini_index,gdp_per_capita).23     1.442425831e-1
#> 47 te(gini_index,gdp_per_capita).24     9.242458765e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9613644170  0.8446129978                  5.458642390e-1
#> 2 observed 0.9613644170  0.2987294683                  1.836180887e-1
#> 3 estimate 0.9613644170  0.7107244449                  5.201532273e-3
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(28.338) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.33610450  0.03499282 -38.18225 < 2.22e-16 ***
#> year2009     0.09001304  0.04038002   2.22915  0.0258040 *  
#> year2011     0.04804506  0.04300756   1.11713  0.2639385    
#> year2012    -0.02774088  0.04561549  -0.60815  0.5430906    
#> year2013     0.09277751  0.04526176   2.04980  0.0403841 *  
#> year2014     0.12393361  0.04592994   2.69832  0.0069691 ** 
#> year2015     0.02278094  0.05622437   0.40518  0.6853458    
#> year2016     0.04023587  0.05044976   0.79754  0.4251356    
#> year2017     0.07525792  0.05020046   1.49915  0.1338352    
#> year2018     0.06523783  0.04783426   1.36383  0.1726208    
#> year2019     0.08298043  0.04818955   1.72196  0.0850769 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq p-value    
#> s(spei_12m)                    1.002721  1.005432   1.05766 0.30509    
#> te(gini_index,gdp_per_capita) 13.002208 15.125685 390.07962 < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.188   Deviance explained =   19%
#> -REML = -2964.5  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.1882061432  moderate       cohen1988
#> 2 SE       0.01335159388 <NA>           <NA>     
#> 3 Lower CI 0.1620375001  moderate       cohen1988
#> 4 Upper CI 0.2143747864  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.500492919e+1
#> 2 logLik         3.019197024e+3
#> 3 AIC           -5.982153705e+3
#> 4 BIC           -5.817956320e+3
#> 5 deviance       2.456029500e+3
#> 6 df.residual    2.512995071e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  1.882061432e-1
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -2.389202638e-2
#>  2 mean((Intercept))                   -1.336104497e+0
#>  3 year2009                             9.001304327e-2
#>  4 year2011                             4.804505631e-2
#>  5 year2012                            -2.774088097e-2
#>  6 year2013                             9.277750613e-2
#>  7 year2014                             1.239336123e-1
#>  8 year2015                             2.278094348e-2
#>  9 year2016                             4.023586851e-2
#> 10 year2017                             7.525792199e-2
#> 11 year2018                             6.523783236e-2
#> 12 year2019                             8.298042727e-2
#> 13 mean(s(spei_12m))                    1.510173110e-3
#> 14 mean(te(gini_index,gdp_per_capita)) -1.426073136e-2
#> 15 s(spei_12m).1                       -2.137951608e-5
#> 16 s(spei_12m).2                        5.949304750e-6
#> 17 s(spei_12m).3                       -1.151352833e-6
#> 18 s(spei_12m).4                        4.795969543e-7
#> 19 s(spei_12m).5                       -1.312179698e-6
#> 20 s(spei_12m).6                        3.080323014e-7
#> 21 s(spei_12m).7                       -2.725205338e-7
#> 22 s(spei_12m).8                        3.992088277e-6
#> 23 s(spei_12m).9                        1.360494454e-2
#> 24 te(gini_index,gdp_per_capita).1     -2.206324150e-2
#> 25 te(gini_index,gdp_per_capita).2     -2.142599619e-1
#> 26 te(gini_index,gdp_per_capita).3     -3.144377531e-1
#> 27 te(gini_index,gdp_per_capita).4     -1.278317687e+0
#> 28 te(gini_index,gdp_per_capita).5      6.059420784e-1
#> 29 te(gini_index,gdp_per_capita).6     -2.485431116e-1
#> 30 te(gini_index,gdp_per_capita).7      1.318362326e-1
#> 31 te(gini_index,gdp_per_capita).8     -5.403294380e-1
#> 32 te(gini_index,gdp_per_capita).9     -6.611084789e-1
#> 33 te(gini_index,gdp_per_capita).10     5.965493947e-1
#> 34 te(gini_index,gdp_per_capita).11    -1.082196576e-3
#> 35 te(gini_index,gdp_per_capita).12     5.710221542e-2
#> 36 te(gini_index,gdp_per_capita).13    -2.229016145e-1
#> 37 te(gini_index,gdp_per_capita).14    -4.843941526e-1
#> 38 te(gini_index,gdp_per_capita).15     5.586914133e-1
#> 39 te(gini_index,gdp_per_capita).16    -7.252068559e-2
#> 40 te(gini_index,gdp_per_capita).17     1.861321706e-1
#> 41 te(gini_index,gdp_per_capita).18    -4.302729290e-1
#> 42 te(gini_index,gdp_per_capita).19    -2.706966724e-1
#> 43 te(gini_index,gdp_per_capita).20     2.795492465e-1
#> 44 te(gini_index,gdp_per_capita).21     4.392165134e-1
#> 45 te(gini_index,gdp_per_capita).22     4.782570926e-1
#> 46 te(gini_index,gdp_per_capita).23     3.271892543e-1
#> 47 te(gini_index,gdp_per_capita).24     7.582047580e-1
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9464494757  0.6150541202                  4.570217924e-1
#> 2 observed 0.9464494757  0.5721258327                  2.953352797e-1
#> 3 estimate 0.9464494757  0.4655127094                  9.695469040e-3
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 211: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(maper_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.384) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value        Pr(>|z|)    
#> (Intercept) -3.73346658  0.04104188 -90.96723      < 2.22e-16 ***
#> year2009     0.02450501  0.05802295   0.42233       0.6727820    
#> year2011     0.19704580  0.04995546   3.94443 0.0000799900209 ***
#> year2012     0.13813359  0.05375818   2.56954       0.0101835 *  
#> year2013     0.25817974  0.05122611   5.04000 0.0000004655246 ***
#> year2014     0.28340033  0.05407015   5.24134 0.0000001594105 ***
#> year2015     0.17978275  0.05960435   3.01627       0.0025591 ** 
#> year2016     0.29334757  0.05922263   4.95330 0.0000007296459 ***
#> year2017     0.33229810  0.05715417   5.81407 0.0000000060973 ***
#> year2018     0.17434396  0.05396910   3.23044       0.0012360 ** 
#> year2019     0.08223870  0.06233016   1.31940       0.1870339    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq    p-value    
#> s(spei_12m)                    4.248646  5.369023  16.35531  0.0082676 ** 
#> te(gini_index,gdp_per_capita) 12.623438 14.461457 370.40161 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0261   Deviance explained = 6.48%
#> -REML = -19233  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.787208422e+1
#> 2 logLik         1.928775653e+4
#> 3 AIC           -3.851185211e+4
#> 4 BIC           -3.829248761e+4
#> 5 deviance       7.679191156e+3
#> 6 df.residual    7.243127916e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -2.607898815e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -2.359438966e-2
#>  2 mean((Intercept))                   -3.733466576e+0
#>  3 year2009                             2.450500892e-2
#>  4 year2011                             1.970457961e-1
#>  5 year2012                             1.381335852e-1
#>  6 year2013                             2.581797353e-1
#>  7 year2014                             2.834003259e-1
#>  8 year2015                             1.797827495e-1
#>  9 year2016                             2.933475748e-1
#> 10 year2017                             3.322981004e-1
#> 11 year2018                             1.743439556e-1
#> 12 year2019                             8.223870417e-2
#> 13 mean(s(spei_12m))                    3.398904539e-2
#> 14 mean(te(gini_index,gdp_per_capita))  1.775568694e-2
#> 15 s(spei_12m).1                        1.864848736e-1
#> 16 s(spei_12m).2                       -3.038103354e-2
#> 17 s(spei_12m).3                        1.066732211e-3
#> 18 s(spei_12m).4                       -1.555935772e-2
#> 19 s(spei_12m).5                       -1.424133341e-2
#> 20 s(spei_12m).6                        7.087890556e-3
#> 21 s(spei_12m).7                       -9.590646808e-3
#> 22 s(spei_12m).8                        1.719201702e-2
#> 23 s(spei_12m).9                        1.638422666e-1
#> 24 te(gini_index,gdp_per_capita).1     -6.526371992e-1
#> 25 te(gini_index,gdp_per_capita).2     -6.723661740e-1
#> 26 te(gini_index,gdp_per_capita).3     -5.918966832e-1
#> 27 te(gini_index,gdp_per_capita).4     -3.501989130e+0
#> 28 te(gini_index,gdp_per_capita).5     -1.996066182e-2
#> 29 te(gini_index,gdp_per_capita).6      1.605975487e-1
#> 30 te(gini_index,gdp_per_capita).7     -4.254557007e-1
#> 31 te(gini_index,gdp_per_capita).8      2.912379670e-1
#> 32 te(gini_index,gdp_per_capita).9     -1.025100533e+0
#> 33 te(gini_index,gdp_per_capita).10     1.859576677e-1
#> 34 te(gini_index,gdp_per_capita).11     1.731129477e-1
#> 35 te(gini_index,gdp_per_capita).12    -6.144073907e-2
#> 36 te(gini_index,gdp_per_capita).13     1.425040080e-1
#> 37 te(gini_index,gdp_per_capita).14    -1.499858438e-1
#> 38 te(gini_index,gdp_per_capita).15     3.869104759e-1
#> 39 te(gini_index,gdp_per_capita).16     4.663127935e-1
#> 40 te(gini_index,gdp_per_capita).17     7.557062864e-2
#> 41 te(gini_index,gdp_per_capita).18     3.493856372e-1
#> 42 te(gini_index,gdp_per_capita).19     7.169519606e-1
#> 43 te(gini_index,gdp_per_capita).20     2.762318088e-1
#> 44 te(gini_index,gdp_per_capita).21     7.599898598e-2
#> 45 te(gini_index,gdp_per_capita).22    -8.259154531e-2
#> 46 te(gini_index,gdp_per_capita).23    -3.091525752e-1
#> 47 te(gini_index,gdp_per_capita).24     4.617940843e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9420895447  0.5836182392                   0.3501207456 
#> 2 observed 0.9420895447  0.4757696016                   0.04300342020
#> 3 estimate 0.9420895447  0.4793905047                   0.01046755054
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(26.451) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -4.24946263  0.02025034 -209.84650 < 2.22e-16 ***
#> year2009     0.18939868  0.02686504    7.05001 1.7891e-12 ***
#> year2011     0.21047686  0.02643413    7.96231 1.6885e-15 ***
#> year2012     0.07436565  0.02861895    2.59848  0.0093639 ** 
#> year2013     0.37753834  0.02776169   13.59925 < 2.22e-16 ***
#> year2014     0.29259610  0.02906827   10.06582 < 2.22e-16 ***
#> year2015     0.36885861  0.02775309   13.29072 < 2.22e-16 ***
#> year2016     0.37871180  0.02834834   13.35922 < 2.22e-16 ***
#> year2017     0.43071661  0.02859091   15.06481 < 2.22e-16 ***
#> year2018     0.22397123  0.02890018    7.74982 9.2022e-15 ***
#> year2019     0.15744724  0.02991504    5.26315 1.4161e-07 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq    p-value    
#> s(spei_12m)                    8.117519  8.799981  273.4042 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.910886 20.009740 2608.8432 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0041   Deviance explained = 10.6%
#> -REML = -97345  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       4.099472321e-3 very weak (negligible) cohen1988
#> 2 SE       7.157454056e-4 <NA>                   <NA>     
#> 3 Lower CI 2.696637104e-3 very weak (negligible) cohen1988
#> 4 Upper CI 5.502307538e-3 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.802840435e+1
#> 2 logLik         9.745044429e+4
#> 3 AIC           -1.948192691e+5
#> 4 BIC           -1.944815033e+5
#> 5 deviance       3.094611376e+4
#> 6 df.residual    2.900697160e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  4.099472321e-3
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               1.524895547e-3
#>  2 mean((Intercept))                   -4.249462627e+0
#>  3 year2009                             1.893986827e-1
#>  4 year2011                             2.104768568e-1
#>  5 year2012                             7.436565165e-2
#>  6 year2013                             3.775383372e-1
#>  7 year2014                             2.925960971e-1
#>  8 year2015                             3.688586144e-1
#>  9 year2016                             3.787118042e-1
#> 10 year2017                             4.307166053e-1
#> 11 year2018                             2.239712301e-1
#> 12 year2019                             1.574472407e-1
#> 13 mean(s(spei_12m))                   -7.182056926e-3
#> 14 mean(te(gini_index,gdp_per_capita))  6.987980930e-2
#> 15 s(spei_12m).1                        1.800235264e-1
#> 16 s(spei_12m).2                       -1.482051603e-1
#> 17 s(spei_12m).3                        5.667018832e-2
#> 18 s(spei_12m).4                        2.283860846e-1
#> 19 s(spei_12m).5                       -8.716226679e-2
#> 20 s(spei_12m).6                        2.791472137e-1
#> 21 s(spei_12m).7                       -1.174688605e-1
#> 22 s(spei_12m).8                       -5.828332364e-1
#> 23 s(spei_12m).9                        1.268039987e-1
#> 24 te(gini_index,gdp_per_capita).1     -8.044438444e-1
#> 25 te(gini_index,gdp_per_capita).2     -9.419494068e-1
#> 26 te(gini_index,gdp_per_capita).3     -1.003552452e+0
#> 27 te(gini_index,gdp_per_capita).4      5.154215357e-1
#> 28 te(gini_index,gdp_per_capita).5      4.627941210e-1
#> 29 te(gini_index,gdp_per_capita).6      1.393900485e-2
#> 30 te(gini_index,gdp_per_capita).7     -4.042617727e-1
#> 31 te(gini_index,gdp_per_capita).8     -4.785681259e-2
#> 32 te(gini_index,gdp_per_capita).9      6.364770528e-1
#> 33 te(gini_index,gdp_per_capita).10     7.757228400e-1
#> 34 te(gini_index,gdp_per_capita).11     2.140928668e-1
#> 35 te(gini_index,gdp_per_capita).12    -4.901736950e-2
#> 36 te(gini_index,gdp_per_capita).13     5.958796520e-2
#> 37 te(gini_index,gdp_per_capita).14     6.771764502e-1
#> 38 te(gini_index,gdp_per_capita).15     9.022708031e-1
#> 39 te(gini_index,gdp_per_capita).16     4.136674682e-1
#> 40 te(gini_index,gdp_per_capita).17    -6.084435235e-2
#> 41 te(gini_index,gdp_per_capita).18     4.508746931e-1
#> 42 te(gini_index,gdp_per_capita).19     7.224198122e-1
#> 43 te(gini_index,gdp_per_capita).20     5.891617746e-1
#> 44 te(gini_index,gdp_per_capita).21     4.725668235e-1
#> 45 te(gini_index,gdp_per_capita).22    -1.271219996e+0
#> 46 te(gini_index,gdp_per_capita).23    -1.672837134e+0
#> 47 te(gini_index,gdp_per_capita).24     1.026925352e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9275958816  0.4992052948                  2.793717330e-1
#> 2 observed 0.9275958816  0.3546033663                  9.987968201e-2
#> 3 estimate 0.9275958816  0.3728479981                  3.827404525e-3
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(55.942) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value             Pr(>|z|)    
#> (Intercept) -3.47268260  0.02396811 -144.88766           < 2.22e-16 ***
#> year2009     0.11399245  0.02412185    4.72569 0.000002293319784105 ***
#> year2011     0.19892649  0.02634536    7.55072 0.000000000000043285 ***
#> year2012    -0.01515274  0.03580161   -0.42324            0.6721189    
#> year2013     0.11484222  0.02699430    4.25431 0.000020969193241340 ***
#> year2014     0.07917419  0.02634827    3.00491            0.0026566 ** 
#> year2015     0.03304342  0.03699320    0.89323            0.3717342    
#> year2016     0.10594640  0.04056898    2.61151            0.0090143 ** 
#> year2017     0.03949576  0.03447254    1.14572            0.2519125    
#> year2018    -0.09500500  0.03580470   -2.65342            0.0079680 ** 
#> year2019    -0.05623283  0.03470991   -1.62008            0.1052151    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq    p-value    
#> s(spei_12m)                    7.127516  8.208168  76.74172 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 13.966254 15.370672 691.04221 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0204   Deviance explained = 5.86%
#> -REML = -47469  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.037359509e-2 weak                   cohen1988
#> 2 SE       1.961014544e-3 <NA>                   <NA>     
#> 3 Lower CI 1.653007721e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.421711297e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.209376921e+1
#> 2 logLik         4.754628763e+4
#> 3 AIC           -9.502156139e+4
#> 4 BIC           -9.474344654e+4
#> 5 deviance       1.837163406e+4
#> 6 df.residual    1.860090623e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  2.037359509e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.935658449e-2
#>  2 mean((Intercept))                   -3.472682603e+0
#>  3 year2009                             1.139924517e-1
#>  4 year2011                             1.989264929e-1
#>  5 year2012                            -1.515273853e-2
#>  6 year2013                             1.148422150e-1
#>  7 year2014                             7.917418855e-2
#>  8 year2015                             3.304341830e-2
#>  9 year2016                             1.059463973e-1
#> 10 year2017                             3.949576069e-2
#> 11 year2018                            -9.500499711e-2
#> 12 year2019                            -5.623283478e-2
#> 13 mean(s(spei_12m))                   -2.243424998e-2
#> 14 mean(te(gini_index,gdp_per_capita))  9.599461587e-2
#> 15 s(spei_12m).1                       -5.733006143e-2
#> 16 s(spei_12m).2                       -1.035713643e-1
#> 17 s(spei_12m).3                        1.140584453e-1
#> 18 s(spei_12m).4                       -1.146246716e-1
#> 19 s(spei_12m).5                        8.508208634e-2
#> 20 s(spei_12m).6                       -7.900618837e-2
#> 21 s(spei_12m).7                        1.225952740e-2
#> 22 s(spei_12m).8                       -2.209733940e-1
#> 23 s(spei_12m).9                        1.621973708e-1
#> 24 te(gini_index,gdp_per_capita).1     -6.729672970e-1
#> 25 te(gini_index,gdp_per_capita).2     -7.961051055e-1
#> 26 te(gini_index,gdp_per_capita).3     -8.828229263e-1
#> 27 te(gini_index,gdp_per_capita).4     -6.877117458e+0
#> 28 te(gini_index,gdp_per_capita).5      2.501397753e-2
#> 29 te(gini_index,gdp_per_capita).6     -6.930706014e-3
#> 30 te(gini_index,gdp_per_capita).7     -1.817279255e-1
#> 31 te(gini_index,gdp_per_capita).8      2.281804762e-2
#> 32 te(gini_index,gdp_per_capita).9     -1.710024479e+0
#> 33 te(gini_index,gdp_per_capita).10     1.308286125e-1
#> 34 te(gini_index,gdp_per_capita).11     4.853494061e-2
#> 35 te(gini_index,gdp_per_capita).12    -3.424118298e-3
#> 36 te(gini_index,gdp_per_capita).13     1.022315614e-2
#> 37 te(gini_index,gdp_per_capita).14    -1.762721429e-1
#> 38 te(gini_index,gdp_per_capita).15     3.399162825e-1
#> 39 te(gini_index,gdp_per_capita).16     2.384757516e-1
#> 40 te(gini_index,gdp_per_capita).17    -9.926595833e-2
#> 41 te(gini_index,gdp_per_capita).18     2.509679661e-1
#> 42 te(gini_index,gdp_per_capita).19     1.452889817e+0
#> 43 te(gini_index,gdp_per_capita).20     1.842994498e-1
#> 44 te(gini_index,gdp_per_capita).21     1.130646516e-1
#> 45 te(gini_index,gdp_per_capita).22     8.041115731e-2
#> 46 te(gini_index,gdp_per_capita).23     7.278992382e-2
#> 47 te(gini_index,gdp_per_capita).24     1.074029516e+1
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9613644170  0.8446129978                  5.458642390e-1
#> 2 observed 0.9613644170  0.4579109894                  4.838741590e-2
#> 3 estimate 0.9613644170  0.7107244449                  5.201532273e-3
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(91.14) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                  Estimate    Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.4857750677  0.0406219138 -85.81021 < 2.22e-16 ***
#> year2009     0.0410538281  0.0526859704   0.77922 0.43585163    
#> year2011    -0.0772799868  0.0534653254  -1.44542 0.14833923    
#> year2012    -0.0875375123  0.0557086564  -1.57134 0.11610256    
#> year2013     0.0344811835  0.0527583587   0.65357 0.51339006    
#> year2014    -0.0166816924  0.0540773690  -0.30848 0.75771844    
#> year2015     0.0008749625  0.0683956423   0.01279 0.98979321    
#> year2016     0.0168850667  0.0594492241   0.28403 0.77639121    
#> year2017    -0.0334522769  0.0595925658  -0.56135 0.57455908    
#> year2018    -0.2040584340  0.0572673081  -3.56326 0.00036627 ***
#> year2019    -0.2026920999  0.0578227409  -3.50540 0.00045591 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                    edf   Ref.df   Chi.sq p-value    
#> s(spei_12m)                   1.006124 1.012218  0.55997 0.45857    
#> te(gini_index,gdp_per_capita) 6.111906 7.494555 39.81401 < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0261   Deviance explained = 4.41%
#> -REML = -7006.7  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.608824754e-2 weak                   cohen1988
#> 2 SE       5.963655059e-3 <NA>                   <NA>     
#> 3 Lower CI 1.439969841e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.777679667e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.811802961e+1
#> 2 logLik         7.039032592e+3
#> 3 AIC           -1.403705164e+4
#> 4 BIC           -1.391730990e+4
#> 5 deviance       2.474162995e+3
#> 6 df.residual    2.519881970e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.608824754e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -1.350050177e-1
#>  2 mean((Intercept))                   -3.485775068e+0
#>  3 year2009                             4.105382811e-2
#>  4 year2011                            -7.727998680e-2
#>  5 year2012                            -8.753751227e-2
#>  6 year2013                             3.448118355e-2
#>  7 year2014                            -1.668169241e-2
#>  8 year2015                             8.749625208e-4
#>  9 year2016                             1.688506672e-2
#> 10 year2017                            -3.345227687e-2
#> 11 year2018                            -2.040584340e-1
#> 12 year2019                            -2.026920999e-1
#> 13 mean(s(spei_12m))                    1.445047203e-3
#> 14 mean(te(gini_index,gdp_per_capita)) -8.079350722e-2
#> 15 s(spei_12m).1                       -5.226934587e-5
#> 16 s(spei_12m).2                        6.343864285e-5
#> 17 s(spei_12m).3                       -9.155629613e-6
#> 18 s(spei_12m).4                       -2.403559537e-5
#> 19 s(spei_12m).5                       -4.403602830e-6
#> 20 s(spei_12m).6                        2.343791971e-5
#> 21 s(spei_12m).7                        5.923302300e-6
#> 22 s(spei_12m).8                        1.399887555e-4
#> 23 s(spei_12m).9                        1.286250038e-2
#> 24 te(gini_index,gdp_per_capita).1      1.456151876e-1
#> 25 te(gini_index,gdp_per_capita).2      1.393928745e-1
#> 26 te(gini_index,gdp_per_capita).3      1.125821585e-1
#> 27 te(gini_index,gdp_per_capita).4     -2.118405386e+0
#> 28 te(gini_index,gdp_per_capita).5      7.951360531e-2
#> 29 te(gini_index,gdp_per_capita).6     -6.355902841e-3
#> 30 te(gini_index,gdp_per_capita).7      1.025068859e-1
#> 31 te(gini_index,gdp_per_capita).8     -6.730910833e-2
#> 32 te(gini_index,gdp_per_capita).9     -8.554103836e-1
#> 33 te(gini_index,gdp_per_capita).10     7.650589212e-2
#> 34 te(gini_index,gdp_per_capita).11     2.933431916e-2
#> 35 te(gini_index,gdp_per_capita).12     5.927421214e-2
#> 36 te(gini_index,gdp_per_capita).13    -2.381489381e-2
#> 37 te(gini_index,gdp_per_capita).14    -4.938093450e-1
#> 38 te(gini_index,gdp_per_capita).15     4.499889915e-2
#> 39 te(gini_index,gdp_per_capita).16    -3.988791849e-2
#> 40 te(gini_index,gdp_per_capita).17     4.538930274e-2
#> 41 te(gini_index,gdp_per_capita).18    -1.115786204e-1
#> 42 te(gini_index,gdp_per_capita).19    -5.760021820e-2
#> 43 te(gini_index,gdp_per_capita).20    -3.118267883e-1
#> 44 te(gini_index,gdp_per_capita).21    -2.757039505e-1
#> 45 te(gini_index,gdp_per_capita).22    -2.484868324e-1
#> 46 te(gini_index,gdp_per_capita).23    -2.179460767e-1
#> 47 te(gini_index,gdp_per_capita).24     2.053977914e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9464494757  0.6150541202                  4.570217924e-1
#> 2 observed 0.9464494757  0.5723242671                  5.948799928e-2
#> 3 estimate 0.9464494757  0.4655127094                  9.695469040e-3
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 212: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mpepr_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(33.789) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value            Pr(>|z|)    
#> (Intercept) -3.68363570  0.03870327 -95.17636          < 2.22e-16 ***
#> year2009    -0.07833377  0.05468861  -1.43236          0.15204085    
#> year2011     0.25723128  0.04629774   5.55602 0.00000002759908410 ***
#> year2012     0.16752824  0.05039011   3.32463          0.00088537 ***
#> year2013     0.34641288  0.04758107   7.28048 0.00000000000033264 ***
#> year2014     0.21651009  0.05128515   4.22169 0.00002424753719187 ***
#> year2015     0.32973500  0.05523984   5.96915 0.00000000238489943 ***
#> year2016     0.36141104  0.05497985   6.57352 0.00000000004914027 ***
#> year2017     0.44665494  0.05309288   8.41271          < 2.22e-16 ***
#> year2018     0.42610847  0.04978301   8.55932          < 2.22e-16 ***
#> year2019     0.22466332  0.05789968   3.88022          0.00010436 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq     p-value    
#> s(spei_12m)                    5.401108  6.655752  32.65531 0.000018592 ***
#> te(gini_index,gdp_per_capita) 16.438386 18.143543 337.22959  < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0437   Deviance explained = 7.85%
#> -REML = -18040  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.283949464e+1
#> 2 logLik         1.811618275e+4
#> 3 AIC           -3.615876691e+4
#> 4 BIC           -3.590515908e+4
#> 5 deviance       7.659719968e+3
#> 6 df.residual    7.238160505e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -4.374959004e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -2.956937228e-1
#>  2 mean((Intercept))                   -3.683635701e+0
#>  3 year2009                            -7.833377360e-2
#>  4 year2011                             2.572312763e-1
#>  5 year2012                             1.675282420e-1
#>  6 year2013                             3.464128751e-1
#>  7 year2014                             2.165100930e-1
#>  8 year2015                             3.297350035e-1
#>  9 year2016                             3.614110418e-1
#> 10 year2017                             4.466549393e-1
#> 11 year2018                             4.261084716e-1
#> 12 year2019                             2.246633182e-1
#> 13 mean(s(spei_12m))                    2.615353326e-2
#> 14 mean(te(gini_index,gdp_per_capita)) -5.108413079e-1
#> 15 s(spei_12m).1                        2.012286707e-1
#> 16 s(spei_12m).2                        3.551967461e-2
#> 17 s(spei_12m).3                        3.739842943e-2
#> 18 s(spei_12m).4                        8.997288434e-4
#> 19 s(spei_12m).5                       -3.237038690e-2
#> 20 s(spei_12m).6                       -3.397356860e-2
#> 21 s(spei_12m).7                        1.354414552e-2
#> 22 s(spei_12m).8                       -1.502555280e-1
#> 23 s(spei_12m).9                        1.633906338e-1
#> 24 te(gini_index,gdp_per_capita).1     -8.601132846e-1
#> 25 te(gini_index,gdp_per_capita).2     -7.221140993e-1
#> 26 te(gini_index,gdp_per_capita).3     -2.786772157e-1
#> 27 te(gini_index,gdp_per_capita).4     -1.101479233e+1
#> 28 te(gini_index,gdp_per_capita).5      3.686595896e-1
#> 29 te(gini_index,gdp_per_capita).6      4.860296996e-1
#> 30 te(gini_index,gdp_per_capita).7     -5.941588393e-1
#> 31 te(gini_index,gdp_per_capita).8      5.601458132e-1
#> 32 te(gini_index,gdp_per_capita).9      5.739362772e-1
#> 33 te(gini_index,gdp_per_capita).10     2.899456401e-1
#> 34 te(gini_index,gdp_per_capita).11     2.014902995e-1
#> 35 te(gini_index,gdp_per_capita).12    -1.449848030e-1
#> 36 te(gini_index,gdp_per_capita).13     2.407479604e-1
#> 37 te(gini_index,gdp_per_capita).14     1.967749694e+0
#> 38 te(gini_index,gdp_per_capita).15     5.118470965e-1
#> 39 te(gini_index,gdp_per_capita).16     5.764491408e-1
#> 40 te(gini_index,gdp_per_capita).17    -8.734873058e-2
#> 41 te(gini_index,gdp_per_capita).18     4.382761421e-1
#> 42 te(gini_index,gdp_per_capita).19     1.723242276e+0
#> 43 te(gini_index,gdp_per_capita).20     1.258616673e-1
#> 44 te(gini_index,gdp_per_capita).21     1.976387600e-1
#> 45 te(gini_index,gdp_per_capita).22     1.842638592e-1
#> 46 te(gini_index,gdp_per_capita).23     1.645645229e-1
#> 47 te(gini_index,gdp_per_capita).24    -7.168850527e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9420895447  0.5836182392                   0.3501207456 
#> 2 observed 0.9420895447  0.4869808423                   0.1066714704 
#> 3 estimate 0.9420895447  0.4793905047                   0.01046755054
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(30.192) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value           Pr(>|z|)    
#> (Intercept) -4.04547130  0.01932128 -209.37908         < 2.22e-16 ***
#> year2009     0.16608502  0.02551935    6.50820 0.0000000000760568 ***
#> year2011     0.20908600  0.02515885    8.31063         < 2.22e-16 ***
#> year2012     0.07570469  0.02725847    2.77729          0.0054814 ** 
#> year2013     0.28014395  0.02653731   10.55661         < 2.22e-16 ***
#> year2014     0.19412894  0.02776673    6.99142 0.0000000000027211 ***
#> year2015     0.34839820  0.02637488   13.20947         < 2.22e-16 ***
#> year2016     0.40626880  0.02686454   15.12287         < 2.22e-16 ***
#> year2017     0.53599476  0.02691441   19.91479         < 2.22e-16 ***
#> year2018     0.33116971  0.02730553   12.12830         < 2.22e-16 ***
#> year2019     0.25481566  0.02829299    9.00632         < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                    edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)                    8.68701  8.97276  389.6116 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.41291 19.44782 2998.6572 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0117   Deviance explained = 12.7%
#> -REML = -85119  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.809992454e+1
#> 2 logLik         8.522523955e+4
#> 3 AIC           -1.703696379e+5
#> 4 BIC           -1.700350929e+5
#> 5 deviance       3.166261092e+4
#> 6 df.residual    2.900690008e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -1.170467906e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               5.130538481e-2
#>  2 mean((Intercept))                   -4.045471303e+0
#>  3 year2009                             1.660850212e-1
#>  4 year2011                             2.090859986e-1
#>  5 year2012                             7.570469050e-2
#>  6 year2013                             2.801439540e-1
#>  7 year2014                             1.941289404e-1
#>  8 year2015                             3.483981978e-1
#>  9 year2016                             4.062687981e-1
#> 10 year2017                             5.359947646e-1
#> 11 year2018                             3.311697137e-1
#> 12 year2019                             2.548156593e-1
#> 13 mean(s(spei_12m))                   -3.177134780e-2
#> 14 mean(te(gini_index,gdp_per_capita))  1.577939428e-1
#> 15 s(spei_12m).1                        3.027505622e-1
#> 16 s(spei_12m).2                       -4.472049658e-1
#> 17 s(spei_12m).3                        2.015043202e-1
#> 18 s(spei_12m).4                        4.306052678e-1
#> 19 s(spei_12m).5                       -1.362570964e-1
#> 20 s(spei_12m).6                        5.218817372e-1
#> 21 s(spei_12m).7                       -2.992021220e-1
#> 22 s(spei_12m).8                       -1.241019338e+0
#> 23 s(spei_12m).9                        3.809995050e-1
#> 24 te(gini_index,gdp_per_capita).1     -1.118296253e+0
#> 25 te(gini_index,gdp_per_capita).2     -9.708578486e-1
#> 26 te(gini_index,gdp_per_capita).3     -9.292023996e-1
#> 27 te(gini_index,gdp_per_capita).4     -2.239508979e+0
#> 28 te(gini_index,gdp_per_capita).5      3.549410073e-1
#> 29 te(gini_index,gdp_per_capita).6      2.398415668e-1
#> 30 te(gini_index,gdp_per_capita).7     -5.776487923e-1
#> 31 te(gini_index,gdp_per_capita).8      2.376113483e-1
#> 32 te(gini_index,gdp_per_capita).9     -1.593263850e-1
#> 33 te(gini_index,gdp_per_capita).10     8.158498397e-1
#> 34 te(gini_index,gdp_per_capita).11     3.132175833e-1
#> 35 te(gini_index,gdp_per_capita).12    -6.594576561e-2
#> 36 te(gini_index,gdp_per_capita).13     2.282032443e-1
#> 37 te(gini_index,gdp_per_capita).14     5.618358069e-1
#> 38 te(gini_index,gdp_per_capita).15     9.519793937e-1
#> 39 te(gini_index,gdp_per_capita).16     6.374356573e-1
#> 40 te(gini_index,gdp_per_capita).17    -3.274120004e-1
#> 41 te(gini_index,gdp_per_capita).18     8.347836027e-1
#> 42 te(gini_index,gdp_per_capita).19     1.285028293e+0
#> 43 te(gini_index,gdp_per_capita).20     6.019511562e-1
#> 44 te(gini_index,gdp_per_capita).21    -2.237780356e-1
#> 45 te(gini_index,gdp_per_capita).22    -1.009169884e+0
#> 46 te(gini_index,gdp_per_capita).23    -1.052880265e+0
#> 47 te(gini_index,gdp_per_capita).24     5.398402735e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9275958816  0.4992052948                  2.793717330e-1
#> 2 observed 0.9275958816  0.2963357967                  8.880375272e-2
#> 3 estimate 0.9275958816  0.3728479981                  3.827404525e-3
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(97.026) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -3.422298362  0.019286524 -177.44506         < 2.22e-16 ***
#> year2009     0.134600361  0.019161878    7.02438 0.0000000000021501 ***
#> year2011     0.282919426  0.021086169   13.41730         < 2.22e-16 ***
#> year2012     0.042325336  0.028205521    1.50060           0.133458    
#> year2013     0.099720844  0.021992157    4.53438 0.0000057772354855 ***
#> year2014     0.105627265  0.021526945    4.90675 0.0000009259953279 ***
#> year2015     0.044790860  0.029353340    1.52592           0.127030    
#> year2016     0.057083294  0.032150637    1.77549           0.075816 .  
#> year2017     0.053051320  0.027487146    1.93004           0.053602 .  
#> year2018     0.033627943  0.028276586    1.18925           0.234341    
#> year2019    -0.009719769  0.027633353   -0.35174           0.725033    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df   Chi.sq    p-value    
#> s(spei_12m)                    6.807326  7.957707 250.3984 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 16.141641 17.558059 901.0652 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0413   Deviance explained = 7.86%
#> -REML = -49898  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.133873228e-2 weak           cohen1988
#> 2 SE       2.733570348e-3 <NA>           <NA>     
#> 3 Lower CI 3.598103285e-2 weak           cohen1988
#> 4 Upper CI 4.669643172e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.394896629e+1
#> 2 logLik         4.998753016e+4
#> 3 AIC           -9.990040491e+4
#> 4 BIC           -9.960802857e+4
#> 5 deviance       1.849082357e+4
#> 6 df.residual    1.859905103e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  4.133873228e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -3.890018492e-2
#>  2 mean((Intercept))                   -3.422298362e+0
#>  3 year2009                             1.346003607e-1
#>  4 year2011                             2.829194259e-1
#>  5 year2012                             4.232533606e-2
#>  6 year2013                             9.972084358e-2
#>  7 year2014                             1.056272645e-1
#>  8 year2015                             4.479085979e-2
#>  9 year2016                             5.708329429e-2
#> 10 year2017                             5.305131974e-2
#> 11 year2018                             3.362794333e-2
#> 12 year2019                            -9.719769335e-3
#> 13 mean(s(spei_12m))                    4.226187529e-2
#> 14 mean(te(gini_index,gdp_per_capita))  2.026276955e-2
#> 15 s(spei_12m).1                       -2.678231957e-2
#> 16 s(spei_12m).2                        4.586388030e-2
#> 17 s(spei_12m).3                        6.606196257e-2
#> 18 s(spei_12m).4                        1.782962186e-2
#> 19 s(spei_12m).5                        3.964498149e-2
#> 20 s(spei_12m).6                        3.324264753e-2
#> 21 s(spei_12m).7                       -2.250571544e-3
#> 22 s(spei_12m).8                        1.582279150e-1
#> 23 s(spei_12m).9                        4.851875995e-2
#> 24 te(gini_index,gdp_per_capita).1     -5.675253699e-1
#> 25 te(gini_index,gdp_per_capita).2     -8.179040811e-1
#> 26 te(gini_index,gdp_per_capita).3     -9.359600071e-1
#> 27 te(gini_index,gdp_per_capita).4     -1.968585909e+0
#> 28 te(gini_index,gdp_per_capita).5      1.066590277e-1
#> 29 te(gini_index,gdp_per_capita).6     -4.939857355e-2
#> 30 te(gini_index,gdp_per_capita).7     -6.154408719e-2
#> 31 te(gini_index,gdp_per_capita).8     -1.748884453e-1
#> 32 te(gini_index,gdp_per_capita).9     -4.045659209e-1
#> 33 te(gini_index,gdp_per_capita).10     2.429839471e-1
#> 34 te(gini_index,gdp_per_capita).11     5.686344429e-2
#> 35 te(gini_index,gdp_per_capita).12    -1.289805559e-2
#> 36 te(gini_index,gdp_per_capita).13    -3.979172135e-2
#> 37 te(gini_index,gdp_per_capita).14     7.221996843e-2
#> 38 te(gini_index,gdp_per_capita).15     4.038085380e-1
#> 39 te(gini_index,gdp_per_capita).16     7.192738724e-2
#> 40 te(gini_index,gdp_per_capita).17     1.289116712e-1
#> 41 te(gini_index,gdp_per_capita).18    -8.029948847e-2
#> 42 te(gini_index,gdp_per_capita).19     5.895102213e-1
#> 43 te(gini_index,gdp_per_capita).20     1.015833386e-1
#> 44 te(gini_index,gdp_per_capita).21     1.047179456e-1
#> 45 te(gini_index,gdp_per_capita).22     1.362951267e-1
#> 46 te(gini_index,gdp_per_capita).23     1.049612386e-1
#> 47 te(gini_index,gdp_per_capita).24     3.479226274e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9613644170  0.8446129978                  5.458642390e-1
#> 2 observed 0.9613644170  0.6913057288                  1.480120264e-1
#> 3 estimate 0.9613644170  0.7107244449                  5.201532273e-3
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(123.39) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.36009851  0.03393578 -99.01344 < 2.22e-16 ***
#> year2009     0.06924372  0.04386381   1.57861  0.1144263    
#> year2011    -0.03729113  0.04450071  -0.83799  0.4020366    
#> year2012     0.06477849  0.04533624   1.42885  0.1530487    
#> year2013     0.11459449  0.04353517   2.63223  0.0084827 ** 
#> year2014     0.05524797  0.04466135   1.23704  0.2160715    
#> year2015     0.06949705  0.05614092   1.23790  0.2157518    
#> year2016     0.08910048  0.04895316   1.82012  0.0687412 .  
#> year2017     0.03231145  0.04913739   0.65757  0.5108121    
#> year2018    -0.04221208  0.04655426  -0.90673  0.3645504    
#> year2019    -0.04456896  0.04703997  -0.94747  0.3433994    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                    edf   Ref.df   Chi.sq p-value    
#> s(spei_12m)                   1.004254 1.008492  0.39930 0.53118    
#> te(gini_index,gdp_per_capita) 8.461772 9.572498 93.78618 < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0202   Deviance explained =  5.7%
#> -REML = -6989.1  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.020938084e-2 weak                   cohen1988
#> 2 SE       5.280563103e-3 <NA>                   <NA>     
#> 3 Lower CI 9.859667337e-3 very weak (negligible) cohen1988
#> 4 Upper CI 3.055909434e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.046602526e+1
#> 2 logLik         7.030160349e+3
#> 3 AIC           -1.401515872e+4
#> 4 BIC           -1.388330535e+4
#> 5 deviance       2.485099127e+3
#> 6 df.residual    2.517533975e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.020938084e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -7.598966416e-2
#>  2 mean((Intercept))                   -3.360098507e+0
#>  3 year2009                             6.924371538e-2
#>  4 year2011                            -3.729112953e-2
#>  5 year2012                             6.477848634e-2
#>  6 year2013                             1.145944941e-1
#>  7 year2014                             5.524796556e-2
#>  8 year2015                             6.949704530e-2
#>  9 year2016                             8.910048319e-2
#> 10 year2017                             3.231145462e-2
#> 11 year2018                            -4.221207557e-2
#> 12 year2019                            -4.456895617e-2
#> 13 mean(s(spei_12m))                    9.955548547e-4
#> 14 mean(te(gini_index,gdp_per_capita)) -1.512950803e-2
#> 15 s(spei_12m).1                       -6.524900103e-6
#> 16 s(spei_12m).2                        2.560035442e-5
#> 17 s(spei_12m).3                       -3.957402750e-6
#> 18 s(spei_12m).4                       -1.668167311e-5
#> 19 s(spei_12m).5                       -7.228718985e-7
#> 20 s(spei_12m).6                        1.457474746e-5
#> 21 s(spei_12m).7                        3.584404384e-6
#> 22 s(spei_12m).8                        9.077142207e-5
#> 23 s(spei_12m).9                        8.853349612e-3
#> 24 te(gini_index,gdp_per_capita).1      2.091885453e-1
#> 25 te(gini_index,gdp_per_capita).2      2.058242018e-1
#> 26 te(gini_index,gdp_per_capita).3      1.786318726e-1
#> 27 te(gini_index,gdp_per_capita).4     -1.219962489e+0
#> 28 te(gini_index,gdp_per_capita).5      4.011961612e-2
#> 29 te(gini_index,gdp_per_capita).6     -5.744476140e-2
#> 30 te(gini_index,gdp_per_capita).7      1.018616928e-1
#> 31 te(gini_index,gdp_per_capita).8     -1.120068444e-1
#> 32 te(gini_index,gdp_per_capita).9     -2.637107203e-1
#> 33 te(gini_index,gdp_per_capita).10     1.009786220e-1
#> 34 te(gini_index,gdp_per_capita).11     4.758705246e-2
#> 35 te(gini_index,gdp_per_capita).12     9.502368920e-2
#> 36 te(gini_index,gdp_per_capita).13    -5.599932568e-3
#> 37 te(gini_index,gdp_per_capita).14     9.385774811e-3
#> 38 te(gini_index,gdp_per_capita).15     8.531662249e-2
#> 39 te(gini_index,gdp_per_capita).16    -2.148209174e-2
#> 40 te(gini_index,gdp_per_capita).17     1.001652391e-1
#> 41 te(gini_index,gdp_per_capita).18    -1.065941223e-1
#> 42 te(gini_index,gdp_per_capita).19     3.521515657e-1
#> 43 te(gini_index,gdp_per_capita).20    -6.771631009e-1
#> 44 te(gini_index,gdp_per_capita).21    -6.209372775e-1
#> 45 te(gini_index,gdp_per_capita).22    -5.801770258e-1
#> 46 te(gini_index,gdp_per_capita).23    -5.323652188e-1
#> 47 te(gini_index,gdp_per_capita).24     2.308100898e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9464494757  0.6150541202                  4.570217924e-1
#> 2 observed 0.9464494757  0.5722274660                  2.264678891e-2
#> 3 estimate 0.9464494757  0.4655127094                  9.695469040e-3
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 213: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(maper_mpepr_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.394) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value         Pr(>|z|)    
#> (Intercept) -2.89749832  0.03499241 -82.80362       < 2.22e-16 ***
#> year2009    -0.07102863  0.04933216  -1.43980        0.1499229    
#> year2011     0.19197321  0.04180470   4.59214 0.00000438716272 ***
#> year2012     0.12808101  0.04536731   2.82320        0.0047547 ** 
#> year2013     0.27285638  0.04304131   6.33941 0.00000000023065 ***
#> year2014     0.19182264  0.04620027   4.15198 0.00003296099051 ***
#> year2015     0.14416902  0.05043252   2.85865        0.0042545 ** 
#> year2016     0.23154441  0.05010010   4.62164 0.00000380726421 ***
#> year2017     0.25296076  0.04849268   5.21647 0.00000018236181 ***
#> year2018     0.18496284  0.04578218   4.04006 0.00005343717255 ***
#> year2019     0.01308144  0.05299363   0.24685        0.8050249    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                    edf    Ref.df    Chi.sq    p-value    
#> s(spei_12m)                    5.27766  6.525358  46.58655 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.17567 19.917300 342.58982 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00551   Deviance explained = 7.43%
#> -REML = -13646  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.445333010e+1
#> 2 logLik         1.373198597e+4
#> 3 AIC           -2.738805917e+4
#> 4 BIC           -2.712647712e+4
#> 5 deviance       7.309843328e+3
#> 6 df.residual    7.236546670e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -5.506126148e-3
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -3.979273870e-1
#>  2 mean((Intercept))                   -2.897498318e+0
#>  3 year2009                            -7.102862903e-2
#>  4 year2011                             1.919732076e-1
#>  5 year2012                             1.280810076e-1
#>  6 year2013                             2.728563793e-1
#>  7 year2014                             1.918226365e-1
#>  8 year2015                             1.441690154e-1
#>  9 year2016                             2.315444085e-1
#> 10 year2017                             2.529607623e-1
#> 11 year2018                             1.849628398e-1
#> 12 year2019                             1.308143669e-2
#> 13 mean(s(spei_12m))                    3.727215358e-2
#> 14 mean(te(gini_index,gdp_per_capita)) -6.869657981e-1
#> 15 s(spei_12m).1                        2.270217647e-1
#> 16 s(spei_12m).2                        1.880935192e-2
#> 17 s(spei_12m).3                        3.789455724e-2
#> 18 s(spei_12m).4                        5.846880905e-4
#> 19 s(spei_12m).5                       -8.473067319e-3
#> 20 s(spei_12m).6                       -1.661662241e-2
#> 21 s(spei_12m).7                        1.563541091e-3
#> 22 s(spei_12m).8                       -6.474661319e-2
#> 23 s(spei_12m).9                        1.394117822e-1
#> 24 te(gini_index,gdp_per_capita).1     -8.162821927e-1
#> 25 te(gini_index,gdp_per_capita).2     -6.070783304e-1
#> 26 te(gini_index,gdp_per_capita).3     -4.724228060e-2
#> 27 te(gini_index,gdp_per_capita).4     -1.830759404e+1
#> 28 te(gini_index,gdp_per_capita).5      4.187865778e-1
#> 29 te(gini_index,gdp_per_capita).6      4.805699870e-1
#> 30 te(gini_index,gdp_per_capita).7     -5.520553404e-1
#> 31 te(gini_index,gdp_per_capita).8      6.066735003e-1
#> 32 te(gini_index,gdp_per_capita).9      1.992701245e+0
#> 33 te(gini_index,gdp_per_capita).10     3.714515191e-1
#> 34 te(gini_index,gdp_per_capita).11     2.099776641e-1
#> 35 te(gini_index,gdp_per_capita).12    -1.547028441e-1
#> 36 te(gini_index,gdp_per_capita).13     2.174941801e-1
#> 37 te(gini_index,gdp_per_capita).14     3.592576169e+0
#> 38 te(gini_index,gdp_per_capita).15     5.339810642e-1
#> 39 te(gini_index,gdp_per_capita).16     5.470099206e-1
#> 40 te(gini_index,gdp_per_capita).17    -9.098265648e-2
#> 41 te(gini_index,gdp_per_capita).18     4.228362467e-1
#> 42 te(gini_index,gdp_per_capita).19     3.150534223e+0
#> 43 te(gini_index,gdp_per_capita).20     2.901982232e-2
#> 44 te(gini_index,gdp_per_capita).21     1.700971926e-1
#> 45 te(gini_index,gdp_per_capita).22     2.069902651e-1
#> 46 te(gini_index,gdp_per_capita).23     2.256874277e-1
#> 47 te(gini_index,gdp_per_capita).24    -9.087628477e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9420895447  0.5836182392                   0.3501207456 
#> 2 observed 0.9420895447  0.4983619723                   0.1122767275 
#> 3 estimate 0.9420895447  0.4793905047                   0.01046755054
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(21.387) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -3.40957792  0.01846764 -184.62443 < 2.22e-16 ***
#> year2009     0.17436668  0.02420855    7.20269 5.9036e-13 ***
#> year2011     0.17182884  0.02406123    7.14132 9.2442e-13 ***
#> year2012     0.09241627  0.02604936    3.54774 0.00038856 ***
#> year2013     0.27378851  0.02529057   10.82571 < 2.22e-16 ***
#> year2014     0.21039289  0.02653915    7.92764 2.2334e-15 ***
#> year2015     0.32004273  0.02524818   12.67587 < 2.22e-16 ***
#> year2016     0.38817517  0.02571272   15.09662 < 2.22e-16 ***
#> year2017     0.50413796  0.02576020   19.57042 < 2.22e-16 ***
#> year2018     0.25808555  0.02625923    9.82837 < 2.22e-16 ***
#> year2019     0.19398696  0.02721805    7.12714 1.0247e-12 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq    p-value    
#> s(spei_12m)                    8.666385  8.969178  319.8837 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.601623 19.724664 3117.1584 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0113   Deviance explained = 12.9%
#> -REML = -65637  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.132586677e-2 very weak (negligible) cohen1988
#> 2 SE       1.181047932e-3 <NA>                   <NA>     
#> 3 Lower CI 9.011055363e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.364067818e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.826800801e+1
#> 2 logLik         6.574516920e+4
#> 3 AIC           -1.314089507e+5
#> 4 BIC           -1.310721440e+5
#> 5 deviance       3.083586714e+4
#> 6 df.residual    2.900673199e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  1.132586677e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               4.163194885e-2
#>  2 mean((Intercept))                   -3.409577916e+0
#>  3 year2009                             1.743666767e-1
#>  4 year2011                             1.718288369e-1
#>  5 year2012                             9.241627171e-2
#>  6 year2013                             2.737885076e-1
#>  7 year2014                             2.103928910e-1
#>  8 year2015                             3.200427327e-1
#>  9 year2016                             3.881751656e-1
#> 10 year2017                             5.041379580e-1
#> 11 year2018                             2.580855498e-1
#> 12 year2019                             1.939869607e-1
#> 13 mean(s(spei_12m))                   -6.718383870e-3
#> 14 mean(te(gini_index,gdp_per_capita))  1.131094821e-1
#> 15 s(spei_12m).1                        2.439117634e-1
#> 16 s(spei_12m).2                       -2.743999575e-1
#> 17 s(spei_12m).3                        1.439323122e-1
#> 18 s(spei_12m).4                        3.082619913e-1
#> 19 s(spei_12m).5                       -1.306936663e-1
#> 20 s(spei_12m).6                        4.157866068e-1
#> 21 s(spei_12m).7                       -2.540656031e-1
#> 22 s(spei_12m).8                       -8.709847471e-1
#> 23 s(spei_12m).9                        3.577858455e-1
#> 24 te(gini_index,gdp_per_capita).1     -1.121484631e+0
#> 25 te(gini_index,gdp_per_capita).2     -1.072474685e+0
#> 26 te(gini_index,gdp_per_capita).3     -1.081236428e+0
#> 27 te(gini_index,gdp_per_capita).4     -2.202818211e-2
#> 28 te(gini_index,gdp_per_capita).5      5.506929961e-1
#> 29 te(gini_index,gdp_per_capita).6      1.825342804e-1
#> 30 te(gini_index,gdp_per_capita).7     -4.850461930e-1
#> 31 te(gini_index,gdp_per_capita).8      1.531782923e-1
#> 32 te(gini_index,gdp_per_capita).9      4.571983770e-1
#> 33 te(gini_index,gdp_per_capita).10     8.157361536e-1
#> 34 te(gini_index,gdp_per_capita).11     2.915029087e-1
#> 35 te(gini_index,gdp_per_capita).12    -6.125327421e-2
#> 36 te(gini_index,gdp_per_capita).13     1.514532707e-1
#> 37 te(gini_index,gdp_per_capita).14     6.250683983e-1
#> 38 te(gini_index,gdp_per_capita).15     9.365891160e-1
#> 39 te(gini_index,gdp_per_capita).16     5.434986986e-1
#> 40 te(gini_index,gdp_per_capita).17    -2.575350676e-1
#> 41 te(gini_index,gdp_per_capita).18     6.469127647e-1
#> 42 te(gini_index,gdp_per_capita).19     7.975638290e-1
#> 43 te(gini_index,gdp_per_capita).20     8.414545692e-1
#> 44 te(gini_index,gdp_per_capita).21     1.532137619e-1
#> 45 te(gini_index,gdp_per_capita).22    -9.886800993e-1
#> 46 te(gini_index,gdp_per_capita).23    -1.195133072e+0
#> 47 te(gini_index,gdp_per_capita).24     1.852901784e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9275958816  0.4992052948                  2.793717330e-1
#> 2 observed 0.9275958816  0.2702154954                  1.114964053e-1
#> 3 estimate 0.9275958816  0.3728479981                  3.827404525e-3
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(51.467) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value       Pr(>|z|)    
#> (Intercept) -2.65456423  0.01907452 -139.16805     < 2.22e-16 ***
#> year2009     0.10270964  0.01887922    5.44035 0.000000053175 ***
#> year2011     0.20228113  0.02086572    9.69442     < 2.22e-16 ***
#> year2012    -0.02356093  0.02825686   -0.83381       0.404386    
#> year2013     0.05340707  0.02168716    2.46261       0.013793 *  
#> year2014     0.03365939  0.02123896    1.58479       0.113013    
#> year2015    -0.05152922  0.02943334   -1.75071       0.079996 .  
#> year2016    -0.02765319  0.03229708   -0.85621       0.391880    
#> year2017    -0.03173125  0.02745049   -1.15594       0.247704    
#> year2018    -0.12181352  0.02842033   -4.28614 0.000018180443 ***
#> year2019    -0.10925374  0.02760552   -3.95768 0.000075682063 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df   Chi.sq    p-value    
#> s(spei_12m)                    6.665316  7.839274 164.7348 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 14.972984 16.559095 674.8512 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.046   Deviance explained = 6.67%
#> -REML = -38021  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.602666215e-2 weak           cohen1988
#> 2 SE       2.870301211e-3 <NA>           <NA>     
#> 3 Lower CI 4.040097515e-2 weak           cohen1988
#> 4 Upper CI 5.165234914e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.263829964e+1
#> 2 logLik         3.810406849e+4
#> 3 AIC           -7.613535430e+4
#> 4 BIC           -7.585031224e+4
#> 5 deviance       1.823652258e+4
#> 6 df.residual    1.860036170e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  4.602666215e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                               2.526920715e-2
#>  2 mean((Intercept))                   -2.654564231e+0
#>  3 year2009                             1.027096388e-1
#>  4 year2011                             2.022811275e-1
#>  5 year2012                            -2.356093121e-2
#>  6 year2013                             5.340706705e-2
#>  7 year2014                             3.365938917e-2
#>  8 year2015                            -5.152922169e-2
#>  9 year2016                            -2.765319102e-2
#> 10 year2017                            -3.173124526e-2
#> 11 year2018                            -1.218135165e-1
#> 12 year2019                            -1.092537362e-1
#> 13 mean(s(spei_12m))                    6.382623701e-2
#> 14 mean(te(gini_index,gdp_per_capita))  1.318940764e-1
#> 15 s(spei_12m).1                        7.294458813e-3
#> 16 s(spei_12m).2                        1.099596638e-1
#> 17 s(spei_12m).3                        3.605723483e-2
#> 18 s(spei_12m).4                        4.409055291e-2
#> 19 s(spei_12m).5                        3.094679901e-2
#> 20 s(spei_12m).6                        6.990441373e-2
#> 21 s(spei_12m).7                       -3.005476028e-3
#> 22 s(spei_12m).8                        2.573174454e-1
#> 23 s(spei_12m).9                        2.187104059e-2
#> 24 te(gini_index,gdp_per_capita).1     -3.689060904e-1
#> 25 te(gini_index,gdp_per_capita).2     -5.480426988e-1
#> 26 te(gini_index,gdp_per_capita).3     -6.566423811e-1
#> 27 te(gini_index,gdp_per_capita).4     -4.607706272e+0
#> 28 te(gini_index,gdp_per_capita).5      1.388630445e-1
#> 29 te(gini_index,gdp_per_capita).6     -6.157907773e-2
#> 30 te(gini_index,gdp_per_capita).7     -6.649105234e-2
#> 31 te(gini_index,gdp_per_capita).8     -1.429622269e-1
#> 32 te(gini_index,gdp_per_capita).9     -9.572429641e-1
#> 33 te(gini_index,gdp_per_capita).10     2.262300123e-1
#> 34 te(gini_index,gdp_per_capita).11     2.871312452e-2
#> 35 te(gini_index,gdp_per_capita).12    -2.194057970e-2
#> 36 te(gini_index,gdp_per_capita).13    -3.707900933e-2
#> 37 te(gini_index,gdp_per_capita).14     1.268069420e-1
#> 38 te(gini_index,gdp_per_capita).15     3.479801473e-1
#> 39 te(gini_index,gdp_per_capita).16     7.292481407e-2
#> 40 te(gini_index,gdp_per_capita).17     1.073209282e-1
#> 41 te(gini_index,gdp_per_capita).18    -5.508358550e-2
#> 42 te(gini_index,gdp_per_capita).19     1.279919024e+0
#> 43 te(gini_index,gdp_per_capita).20     2.171336173e-1
#> 44 te(gini_index,gdp_per_capita).21     1.048959752e-1
#> 45 te(gini_index,gdp_per_capita).22     9.266138365e-2
#> 46 te(gini_index,gdp_per_capita).23     5.861462092e-2
#> 47 te(gini_index,gdp_per_capita).24     7.887070136e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9613644170  0.8446129978                  5.458642390e-1
#> 2 observed 0.9613644170  0.6788328002                  1.389565332e-1
#> 3 estimate 0.9613644170  0.7107244449                  5.201532273e-3
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(64.662) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.665555361  0.034439716 -77.39772 < 2.22e-16 ***
#> year2009     0.045561071  0.044697169   1.01933 0.30804733    
#> year2011    -0.081965330  0.045430434  -1.80419 0.07120085 .  
#> year2012     0.001645178  0.046505238   0.03538 0.97177977    
#> year2013     0.054746547  0.044603257   1.22741 0.21966800    
#> year2014    -0.014654005  0.045816959  -0.31984 0.74909114    
#> year2015    -0.007244639  0.057824918  -0.12529 0.90029732    
#> year2016     0.010768697  0.050348437   0.21388 0.83063795    
#> year2017    -0.036335547  0.050436295  -0.72042 0.47126361    
#> year2018    -0.164320806  0.048171993  -3.41113 0.00064695 ***
#> year2019    -0.157985827  0.048603755  -3.25049 0.00115208 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                    edf   Ref.df   Chi.sq p-value    
#> s(spei_12m)                   1.006843 1.013652  0.23082 0.63935    
#> te(gini_index,gdp_per_capita) 7.912374 9.083904 62.88617 < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0342   Deviance explained =  5.3%
#> -REML = -5451.1  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.415010714e-2 weak           cohen1988
#> 2 SE       6.766687604e-3 <NA>           <NA>     
#> 3 Lower CI 2.088764314e-2 weak           cohen1988
#> 4 Upper CI 4.741257113e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.991921751e+1
#> 2 logLik         5.490106552e+3
#> 3 AIC           -1.093601799e+4
#> 4 BIC           -1.080698746e+4
#> 5 deviance       2.475439629e+3
#> 6 df.residual    2.518080782e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  3.415010714e-2
#> 9 npar           4.4        e+1
#> 
#> # A tibble: 47 × 2
#>    name                                          value
#>    <chr>                                         <dbl>
#>  1 [Mean]                              -9.850288677e-2
#>  2 mean((Intercept))                   -2.665555361e+0
#>  3 year2009                             4.556107120e-2
#>  4 year2011                            -8.196532995e-2
#>  5 year2012                             1.645178386e-3
#>  6 year2013                             5.474654672e-2
#>  7 year2014                            -1.465400485e-2
#>  8 year2015                            -7.244639244e-3
#>  9 year2016                             1.076869728e-2
#> 10 year2017                            -3.633554720e-2
#> 11 year2018                            -1.643208065e-1
#> 12 year2019                            -1.579858273e-1
#> 13 mean(s(spei_12m))                    8.006461619e-4
#> 14 mean(te(gini_index,gdp_per_capita)) -5.524970044e-2
#> 15 s(spei_12m).1                       -7.799443364e-6
#> 16 s(spei_12m).2                        5.762975380e-5
#> 17 s(spei_12m).3                       -8.993421509e-6
#> 18 s(spei_12m).4                       -3.828849333e-5
#> 19 s(spei_12m).5                       -4.769858142e-6
#> 20 s(spei_12m).6                        3.533775161e-5
#> 21 s(spei_12m).7                        8.225586081e-6
#> 22 s(spei_12m).8                        2.225830691e-4
#> 23 s(spei_12m).9                        6.941890513e-3
#> 24 te(gini_index,gdp_per_capita).1      2.366252775e-1
#> 25 te(gini_index,gdp_per_capita).2      2.314305834e-1
#> 26 te(gini_index,gdp_per_capita).3      1.979789423e-1
#> 27 te(gini_index,gdp_per_capita).4     -1.577153559e+0
#> 28 te(gini_index,gdp_per_capita).5      4.062400796e-2
#> 29 te(gini_index,gdp_per_capita).6     -7.157518795e-2
#> 30 te(gini_index,gdp_per_capita).7      1.100713165e-1
#> 31 te(gini_index,gdp_per_capita).8     -1.365659479e-1
#> 32 te(gini_index,gdp_per_capita).9     -5.656099311e-1
#> 33 te(gini_index,gdp_per_capita).10     8.660683752e-2
#> 34 te(gini_index,gdp_per_capita).11     3.253262601e-2
#> 35 te(gini_index,gdp_per_capita).12     9.053782869e-2
#> 36 te(gini_index,gdp_per_capita).13    -1.818771818e-2
#> 37 te(gini_index,gdp_per_capita).14    -2.761938918e-1
#> 38 te(gini_index,gdp_per_capita).15     6.252628171e-2
#> 39 te(gini_index,gdp_per_capita).16    -4.832324169e-2
#> 40 te(gini_index,gdp_per_capita).17     9.637217047e-2
#> 41 te(gini_index,gdp_per_capita).18    -1.314412412e-1
#> 42 te(gini_index,gdp_per_capita).19     7.483450313e-2
#> 43 te(gini_index,gdp_per_capita).20    -4.516363396e-1
#> 44 te(gini_index,gdp_per_capita).21    -4.193896940e-1
#> 45 te(gini_index,gdp_per_capita).22    -3.895427681e-1
#> 46 te(gini_index,gdp_per_capita).23    -3.650081874e-1
#> 47 te(gini_index,gdp_per_capita).24     1.864494522e+0
#> 
#> # A tibble: 3 × 4
#>   names            para `s(spei_12m)` `te(gini_index,gdp_per_capita)`
#>   <chr>           <dbl>         <dbl>                           <dbl>
#> 1 worst    0.9464494757  0.6150541202                  4.570217924e-1
#> 2 observed 0.9464494757  0.5726379313                  3.690617847e-2
#> 3 estimate 0.9464494757  0.4655127094                  9.695469040e-3
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 214: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(year) (Continuous)

Code
mbepr_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mbepr ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mbepr_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.488) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.764025565  0.008889087 -310.9459 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 7.887682 8.682594 164.6248 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0196   Deviance explained = 2.27%
#> -REML = -14555  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             8.887681869e+0
#> 2 logLik         1.457885247e+4
#> 3 AIC           -2.913653050e+4
#> 4 BIC           -2.906264320e+4
#> 5 deviance       8.116224104e+3
#> 6 df.residual    7.925112318e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -1.962561973e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.377084428e-1
#>  2 mean((Intercept)) -2.764025565e+0
#>  3 mean(s(year))      4.299345969e-2
#>  4 s(year).1         -1.429173452e-1
#>  5 s(year).2         -8.170615458e-1
#>  6 s(year).3          2.261602880e-1
#>  7 s(year).4         -6.426766869e-1
#>  8 s(year).5         -2.417863858e-2
#>  9 s(year).6         -2.671706965e-1
#> 10 s(year).7          1.362024407e-1
#> 11 s(year).8          1.230056245e+0
#> 12 s(year).9          6.885270764e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    1.130576203e-24 1.124907020e-24
#> 2 observed 1.130576203e-24 6.025782360e-26
#> 3 estimate 1.130576203e-24 2.338537092e-27
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.503) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.067860265  0.004875082 -629.2941 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf  Ref.df   Chi.sq    p-value    
#> s(year) 7.979043 8.72876 232.1217 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00452   Deviance explained = 0.756%
#> -REML = -68054  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             8.979042735e+0
#> 2 logLik         6.807959833e+4
#> 3 AIC           -1.361377391e+5
#> 4 BIC           -1.360479915e+5
#> 5 deviance       3.347287221e+4
#> 6 df.residual    3.172502096e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -4.518969525e-3
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.931434504e-1
#>  2 mean((Intercept)) -3.067860265e+0
#>  3 mean(s(year))      1.515841785e-2
#>  4 s(year).1         -1.981827360e-2
#>  5 s(year).2         -6.136279302e-1
#>  6 s(year).3          7.152003750e-2
#>  7 s(year).4         -4.575179023e-1
#>  8 s(year).5         -1.950031080e-2
#>  9 s(year).6         -2.247249699e-1
#> 10 s(year).7          9.707933077e-2
#> 11 s(year).8          9.667873650e-1
#> 12 s(year).9          3.362284142e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    7.881445955e-24 7.879958186e-24
#> 2 observed 7.881445955e-24 2.819318734e-25
#> 3 estimate 7.881445955e-24 2.276708824e-26
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(38.438) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.601271212  0.004079439 -637.6542 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.128049 8.798209 356.0552 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0274   Deviance explained = 1.75%
#> -REML = -38672  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       2.742645089e-2 weak           cohen1988
#> 2 SE       2.259216614e-3 <NA>           <NA>     
#> 3 Lower CI 2.299846769e-2 weak           cohen1988
#> 4 Upper CI 3.185443408e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.128049307e+0
#> 2 logLik         3.869852716e+4
#> 3 AIC           -7.737554990e+4
#> 4 BIC           -7.729039715e+4
#> 5 deviance       1.976867118e+4
#> 6 df.residual    2.031487195e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.742645089e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.389874165e-1
#>  2 mean((Intercept)) -2.601271212e+0
#>  3 mean(s(year))      2.348856087e-2
#>  4 s(year).1         -8.112542014e-2
#>  5 s(year).2         -2.956065185e-2
#>  6 s(year).3          1.189912093e-1
#>  7 s(year).4         -1.094589559e-2
#>  8 s(year).5          4.413149703e-2
#>  9 s(year).6          1.735325953e-1
#> 10 s(year).7         -3.111892638e-2
#> 11 s(year).8         -1.173411099e-1
#> 12 s(year).9          1.448337501e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    4.805062457e-24 4.789869656e-24
#> 2 observed 4.805062457e-24 4.263678007e-26
#> 3 estimate 4.805062457e-24 4.765891442e-27
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(34.962) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.26870964  0.01027894 -220.7143 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 6.830195 7.938482 131.2971 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0447   Deviance explained = 4.75%
#> -REML = -4662.6  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.468165164e-2 weak           cohen1988
#> 2 SE       7.663975966e-3 <NA>           <NA>     
#> 3 Lower CI 2.966053477e-2 weak           cohen1988
#> 4 Upper CI 5.970276851e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             7.830194824e+0
#> 2 logLik         4.681903728e+3
#> 3 AIC           -9.343930493e+3
#> 4 BIC           -9.285029059e+3
#> 5 deviance       2.679398229e+3
#> 6 df.residual    2.762169805e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  4.468165164e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.287300141e-1
#>  2 mean((Intercept)) -2.268709644e+0
#>  3 mean(s(year))     -2.065610868e-3
#>  4 s(year).1         -3.533757149e-2
#>  5 s(year).2         -5.783416765e-2
#>  6 s(year).3          1.151710495e-1
#>  7 s(year).4         -2.098466775e-1
#>  8 s(year).5         -1.578159269e-2
#>  9 s(year).6          8.933809737e-2
#> 10 s(year).7         -1.505386576e-2
#> 11 s(year).8          4.838944005e-2
#> 12 s(year).9          6.236479031e-2
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    3.492632002e-25 3.488396698e-25
#> 2 observed 3.492632002e-25 5.309479396e-28
#> 3 estimate 3.492632002e-25 5.386978387e-28
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 215: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(beipr ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(beipr_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.114) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error  z value   Pr(>|z|)    
#> (Intercept) -2.652246484  0.007815092 -339.375 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 6.840362 7.947109 208.1875 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.028   Deviance explained = 2.66%
#> -REML = -14294  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             7.840362260e+0
#> 2 logLik         1.431385290e+4
#> 3 AIC           -2.860796999e+4
#> 4 BIC           -2.853910272e+4
#> 5 deviance       8.071653579e+3
#> 6 df.residual    7.926159638e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -2.802353414e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.698576417e-1
#>  2 mean((Intercept)) -2.652246484e+0
#>  3 mean(s(year))     -5.147770349e-3
#>  4 s(year).1          1.297706945e-1
#>  5 s(year).2         -2.409968568e-1
#>  6 s(year).3          7.478848080e-2
#>  7 s(year).4         -2.659585939e-1
#>  8 s(year).5         -1.207630214e-1
#>  9 s(year).6         -1.062463248e-1
#> 10 s(year).7          6.545738557e-2
#> 11 s(year).8          3.859308196e-1
#> 12 s(year).9          3.168748328e-2
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    1.130576203e-24 1.124907020e-24
#> 2 observed 1.130576203e-24 1.285690427e-27
#> 3 estimate 1.130576203e-24 2.338537092e-27
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.649) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.847564146  0.004210194 -676.3499 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.108529 8.789822 259.2185 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0153   Deviance explained = 0.869%
#> -REML = -61296  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.108528612e+0
#> 2 logLik         6.132240410e+4
#> 3 AIC           -1.226233722e+5
#> 4 BIC           -1.225337147e+5
#> 5 deviance       3.310345549e+4
#> 6 df.residual    3.172489147e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -1.533028485e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.832120355e-1
#>  2 mean((Intercept)) -2.847564146e+0
#>  3 mean(s(year))      1.715976815e-3
#>  4 s(year).1          4.421229608e-2
#>  5 s(year).2         -5.781380272e-1
#>  6 s(year).3          9.108379160e-2
#>  7 s(year).4         -3.997813939e-1
#>  8 s(year).5         -6.499837339e-2
#>  9 s(year).6         -1.984346113e-1
#> 10 s(year).7          1.211944141e-1
#> 11 s(year).8          7.962521498e-1
#> 12 s(year).9          2.040535455e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    7.881445955e-24 7.879958186e-24
#> 2 observed 7.881445955e-24 1.905821459e-25
#> 3 estimate 7.881445955e-24 2.276708824e-26
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(72.181) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.502699587  0.002991543 -836.5916 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 7.538153 8.473267 465.9022 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0356   Deviance explained = 2.24%
#> -REML = -42829  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.563220368e-2 weak           cohen1988
#> 2 SE       2.553375305e-3 <NA>           <NA>     
#> 3 Lower CI 3.062768004e-2 weak           cohen1988
#> 4 Upper CI 4.063672731e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             8.538153256e+0
#> 2 logLik         4.285311826e+4
#> 3 AIC           -8.568632581e+4
#> 4 BIC           -8.560748386e+4
#> 5 deviance       2.003209684e+4
#> 6 df.residual    2.031546185e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  3.563220368e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.791948984e-1
#>  2 mean((Intercept)) -2.502699587e+0
#>  3 mean(s(year))     -3.213882189e-2
#>  4 s(year).1          4.023903617e-2
#>  5 s(year).2         -2.387461072e-1
#>  6 s(year).3          1.881613126e-2
#>  7 s(year).4         -2.078315937e-1
#>  8 s(year).5         -6.174259536e-2
#>  9 s(year).6         -9.300175154e-2
#> 10 s(year).7          3.359126308e-2
#> 11 s(year).8          2.577655460e-1
#> 12 s(year).9         -3.833932568e-2
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    4.805062457e-24 4.789869656e-24
#> 2 observed 4.805062457e-24 6.773069385e-26
#> 3 estimate 4.805062457e-24 4.765891442e-27
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(52.175) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.926318771  0.007635733 -252.2769 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 4.985377 6.078625 72.70812 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0342   Deviance explained =  2.7%
#> -REML = -4700.7  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.424800961e-2 weak           cohen1988
#> 2 SE       6.783044810e-3 <NA>           <NA>     
#> 3 Lower CI 2.095348608e-2 weak           cohen1988
#> 4 Upper CI 4.754253314e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             5.985376796e+0
#> 2 logLik         4.715764580e+3
#> 3 AIC           -9.415371910e+3
#> 4 BIC           -9.367493110e+3
#> 5 deviance       2.719239612e+3
#> 6 df.residual    2.764014623e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  3.424800961e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.053964306e-1
#>  2 mean((Intercept)) -1.926318771e+0
#>  3 mean(s(year))     -1.418283728e-2
#>  4 s(year).1         -7.347249263e-2
#>  5 s(year).2         -1.500681413e-1
#>  6 s(year).3          2.235954107e-2
#>  7 s(year).4         -1.233671156e-1
#>  8 s(year).5         -1.640825213e-2
#>  9 s(year).6         -4.790441739e-2
#> 10 s(year).7          1.805726936e-2
#> 11 s(year).8          1.762250535e-1
#> 12 s(year).9          6.693301954e-2
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    3.492632002e-25 3.488396698e-25
#> 2 observed 3.492632002e-25 1.004698483e-27
#> 3 estimate 3.492632002e-25 5.386978387e-28
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 216: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mbepr_beipr ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mbepr_beipr_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(17.183) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.92643518  0.00732242 -263.0872 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 7.487202 8.440969 87.60946 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00999   Deviance explained = 1.24%
#> -REML = -9877.9  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             8.487202293e+0
#> 2 logLik         9.900141715e+3
#> 3 AIC           -1.978032556e+4
#> 4 BIC           -1.971068344e+4
#> 5 deviance       7.755904132e+3
#> 6 df.residual    7.925512798e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -9.992387590e-3
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.746701213e-1
#>  2 mean((Intercept)) -1.926435182e+0
#>  3 mean(s(year))      1.997044101e-2
#>  4 s(year).1         -3.557569804e-2
#>  5 s(year).2         -3.988542401e-1
#>  6 s(year).3          1.469349694e-1
#>  7 s(year).4         -4.220789080e-1
#>  8 s(year).5         -3.895361295e-2
#>  9 s(year).6         -1.486024733e-1
#> 10 s(year).7          6.079609169e-2
#> 11 s(year).8          6.653876476e-1
#> 12 s(year).9          3.506801926e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    1.130576203e-24 1.124907020e-24
#> 2 observed 1.130576203e-24 3.702229301e-26
#> 3 estimate 1.130576203e-24 2.338537092e-27
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.446) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.201625036  0.004007156 -549.4234 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.090503 8.781786 158.3798 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00203   Deviance explained = 0.545%
#> -REML = -44239  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.090502994e+0
#> 2 logLik         4.426560120e+4
#> 3 AIC           -8.851017443e+4
#> 4 BIC           -8.842222342e+4
#> 5 deviance       3.182801932e+4
#> 6 df.residual    3.172490950e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.025155691e-3
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.132274763e-1
#>  2 mean((Intercept)) -2.201625036e+0
#>  3 mean(s(year))      7.705585839e-3
#>  4 s(year).1         -2.223616984e-3
#>  5 s(year).2         -4.922639301e-1
#>  6 s(year).3          9.559160084e-2
#>  7 s(year).4         -3.963804965e-1
#>  8 s(year).5         -4.215910478e-2
#>  9 s(year).6         -1.786321565e-1
#> 10 s(year).7          8.554582454e-2
#> 11 s(year).8          7.549018881e-1
#> 12 s(year).9          2.449702639e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    7.881445955e-24 7.879958186e-24
#> 2 observed 7.881445955e-24 4.519211869e-25
#> 3 estimate 7.881445955e-24 2.276708824e-26
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(32.282) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.77538891  0.00334683 -530.4687 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 7.448459 8.413178 720.6691 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0428   Deviance explained = 3.42%
#> -REML = -28936  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.276223341e-2 weak           cohen1988
#> 2 SE       2.776518861e-3 <NA>           <NA>     
#> 3 Lower CI 3.732035644e-2 weak           cohen1988
#> 4 Upper CI 4.820411038e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             8.448458557e+0
#> 2 logLik         2.895922531e+4
#> 3 AIC           -5.789834457e+4
#> 4 BIC           -5.781872905e+4
#> 5 deviance       1.982184104e+4
#> 6 df.residual    2.031555154e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  4.276223341e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.905945030e-1
#>  2 mean((Intercept)) -1.775388911e+0
#>  3 mean(s(year))     -1.450623554e-2
#>  4 s(year).1         -2.427295493e-2
#>  5 s(year).2         -1.608454772e-1
#>  6 s(year).3          5.406956031e-2
#>  7 s(year).4         -1.161865611e-1
#>  8 s(year).5         -1.510251505e-2
#>  9 s(year).6          5.817204444e-3
#> 10 s(year).7         -2.461015523e-3
#> 11 s(year).8          9.608371394e-2
#> 12 s(year).9          3.234192524e-2
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    4.805062457e-24 4.789869656e-24
#> 2 observed 4.805062457e-24 8.719666929e-28
#> 3 estimate 4.805062457e-24 4.765891442e-27
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.301) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.259433674  0.008937905 -140.9093 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 5.628751 6.781089 149.8307 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0565   Deviance explained = 5.35%
#> -REML = -3049.2  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       5.650386597e-2 weak           cohen1988
#> 2 SE       8.511784358e-3 <NA>           <NA>     
#> 3 Lower CI 3.982107519e-2 weak           cohen1988
#> 4 Upper CI 7.318665676e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             6.628751260e+0
#> 2 logLik         3.065513233e+3
#> 3 AIC           -6.113464288e+3
#> 4 BIC           -6.061422264e+3
#> 5 deviance       2.689338651e+3
#> 6 df.residual    2.763371249e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  5.650386597e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.399896646e-1
#>  2 mean((Intercept)) -1.259433674e+0
#>  3 mean(s(year))     -1.560699685e-2
#>  4 s(year).1         -6.138642692e-2
#>  5 s(year).2         -9.406219996e-2
#>  6 s(year).3          4.854276711e-2
#>  7 s(year).4         -1.498717142e-1
#>  8 s(year).5         -1.064363831e-2
#>  9 s(year).6         -6.545168634e-3
#> 10 s(year).7          4.659019746e-3
#> 11 s(year).8          9.698507247e-2
#> 12 s(year).9          3.185931704e-2
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    3.492632002e-25 3.488396698e-25
#> 2 observed 3.492632002e-25 2.849683062e-28
#> 3 estimate 3.492632002e-25 5.386978387e-28
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 217: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(maper ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(maper_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.728) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.528361904  0.009798933 -360.0761 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>             edf   Ref.df   Chi.sq    p-value    
#> s(year) 6.71971 7.844291 67.31148 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0075   Deviance explained = 0.876%
#> -REML = -20724  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             7.719710001e+0
#> 2 logLik         2.074295858e+4
#> 3 AIC           -4.146622857e+4
#> 4 BIC           -4.139752613e+4
#> 5 deviance       8.431395374e+3
#> 6 df.residual    7.926280290e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -7.504047063e-3
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.396719578e-1
#>  2 mean((Intercept)) -3.528361904e+0
#>  3 mean(s(year))      1.462692509e-2
#>  4 s(year).1          9.314060902e-2
#>  5 s(year).2         -4.140425828e-1
#>  6 s(year).3          2.619540929e-2
#>  7 s(year).4         -2.011633800e-1
#>  8 s(year).5         -2.726669141e-2
#>  9 s(year).6         -1.722021440e-2
#> 10 s(year).7          3.863339506e-2
#> 11 s(year).8          5.493621311e-1
#> 12 s(year).9          8.400364983e-2
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    1.130576203e-24 1.124907020e-24
#> 2 observed 1.130576203e-24 8.823014874e-27
#> 3 estimate 1.130576203e-24 2.338537092e-27
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(22.999) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.947469608  0.005229374 -754.8647 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.024324 8.750592 174.1822 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00274   Deviance explained = 0.525%
#> -REML = -1.0447e+05  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.024323628e+0
#> 2 logLik         1.044963446e+5
#> 3 AIC           -2.089711881e+5
#> 4 BIC           -2.088812579e+5
#> 5 deviance       3.427273799e+4
#> 6 df.residual    3.172497568e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.739061946e-3
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.745725713e-1
#>  2 mean((Intercept)) -3.947469608e+0
#>  3 mean(s(year))      2.241598836e-2
#>  4 s(year).1          1.018381627e-1
#>  5 s(year).2         -4.076355111e-1
#>  6 s(year).3          1.945968310e-2
#>  7 s(year).4         -2.240524689e-1
#>  8 s(year).5          5.313890647e-2
#>  9 s(year).6         -1.154145111e-2
#> 10 s(year).7          2.138708047e-2
#> 11 s(year).8          5.041440280e-1
#> 12 s(year).9          1.450054656e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    7.881445955e-24 7.879958186e-24
#> 2 observed 7.881445955e-24 2.558459987e-26
#> 3 estimate 7.881445955e-24 2.276708824e-26
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(51.579) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.400230669  0.004764297 -713.6899 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.434371 8.911811 207.0213 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0114   Deviance explained = 1.09%
#> -REML = -50956  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.137519129e-2 very weak (negligible) cohen1988
#> 2 SE       1.478977177e-3 <NA>                   <NA>     
#> 3 Lower CI 8.476449290e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.427393329e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.434370799e+0
#> 2 logLik         5.098456076e+4
#> 3 AIC           -1.019472979e+5
#> 4 BIC           -1.018608812e+5
#> 5 deviance       2.004291470e+4
#> 6 df.residual    2.031456563e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  1.137519129e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.704610202e-1
#>  2 mean((Intercept)) -3.400230669e+0
#>  3 mean(s(year))      7.729116299e-2
#>  4 s(year).1         -9.524354801e-2
#>  5 s(year).2          2.499860212e-1
#>  6 s(year).3          1.528793254e-1
#>  7 s(year).4          1.989227716e-1
#>  8 s(year).5          1.275006717e-1
#>  9 s(year).6          3.872334722e-1
#> 10 s(year).7         -4.127270417e-2
#> 11 s(year).8         -4.354376440e-1
#> 12 s(year).9          1.510521010e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    4.805062457e-24 4.789869656e-24
#> 2 observed 4.805062457e-24 2.390662081e-25
#> 3 estimate 4.805062457e-24 4.765891442e-27
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(84.051) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.51494952  0.01117707 -314.4786 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf Ref.df   Chi.sq    p-value    
#> s(year) 3.812015 4.7125 46.05516 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0231   Deviance explained = 1.89%
#> -REML = -7553.9  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.307311496e-2 weak                   cohen1988
#> 2 SE       5.631921366e-3 <NA>                   <NA>     
#> 3 Lower CI 1.203475192e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.411147800e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             4.812015363e+0
#> 2 logLik         7.565617215e+3
#> 3 AIC           -1.511780943e+4
#> 4 BIC           -1.507802711e+4
#> 5 deviance       2.709463766e+3
#> 6 df.residual    2.765187985e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.307311496e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.506199485e-1
#>  2 mean((Intercept)) -3.514949521e+0
#>  3 mean(s(year))      9.722262979e-4
#>  4 s(year).1          1.377998421e-1
#>  5 s(year).2         -4.801240715e-2
#>  6 s(year).3          5.865185124e-3
#>  7 s(year).4         -4.799027195e-2
#>  8 s(year).5         -2.146899652e-4
#>  9 s(year).6         -3.004030017e-2
#> 10 s(year).7          1.312506153e-2
#> 11 s(year).8          1.341547694e-1
#> 12 s(year).9         -1.559371523e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    3.492632002e-25 3.488396698e-25
#> 2 observed 3.492632002e-25 1.234511627e-27
#> 3 estimate 3.492632002e-25 5.386978387e-28
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 218: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mpepr ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mpepr_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(31.016) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.415780792  0.008982098 -380.2876 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 5.876832 7.041259 144.7022 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0331   Deviance explained = 1.82%
#> -REML = -19446  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             6.876831913e+0
#> 2 logLik         1.946273819e+4
#> 3 AIC           -3.890744891e+4
#> 4 BIC           -3.884454287e+4
#> 5 deviance       8.410916411e+3
#> 6 df.residual    7.927123168e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -3.306336093e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.654426529e-1
#>  2 mean((Intercept)) -3.415780792e+0
#>  3 mean(s(year))     -2.651619306e-2
#>  4 s(year).1          2.174346401e-1
#>  5 s(year).2         -5.682768768e-1
#>  6 s(year).3         -9.547644109e-2
#>  7 s(year).4         -2.393959820e-1
#>  8 s(year).5         -9.423718940e-2
#>  9 s(year).6         -1.951732388e-1
#> 10 s(year).7          1.049420404e-1
#> 11 s(year).8          7.468545630e-1
#> 12 s(year).9         -1.153172529e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    1.130576203e-24 1.124907020e-24
#> 2 observed 1.130576203e-24 2.682534144e-28
#> 3 estimate 1.130576203e-24 2.338537092e-27
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.89) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.737458578  0.004989861 -749.0105 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.129835 8.799041 388.3712 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00817   Deviance explained = 1.12%
#> -REML = -90893  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.129834919e+0
#> 2 logLik         9.091881222e+4
#> 3 AIC           -1.818160264e+5
#> 4 BIC           -1.817256908e+5
#> 5 deviance       3.487152626e+4
#> 6 df.residual    3.172487017e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -8.168167937e-3
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.880494502e-1
#>  2 mean((Intercept)) -3.737458578e+0
#>  3 mean(s(year))     -1.589288047e-2
#>  4 s(year).1          1.086600525e-1
#>  5 s(year).2         -7.390758846e-1
#>  6 s(year).3         -6.532808219e-2
#>  7 s(year).4         -2.550157494e-1
#>  8 s(year).5          1.051294033e-2
#>  9 s(year).6         -1.084220724e-1
#> 10 s(year).7          3.372868372e-2
#> 11 s(year).8          7.242677987e-1
#> 12 s(year).9          1.476363892e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    7.881445955e-24 7.879958186e-24
#> 2 observed 7.881445955e-24 3.157624421e-26
#> 3 estimate 7.881445955e-24 2.276708824e-26
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(87.956) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.328906026  0.003775039 -881.8204 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>             edf  Ref.df   Chi.sq    p-value    
#> s(year) 5.87848 7.04167 125.3592 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00837   Deviance explained = 0.658%
#> -REML = -53490  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       8.368181294e-3 very weak (negligible) cohen1988
#> 2 SE       1.272379336e-3 <NA>                   <NA>     
#> 3 Lower CI 5.874363621e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.086199897e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             6.878479732e+0
#> 2 logLik         5.350847177e+4
#> 3 AIC           -1.069996254e+5
#> 4 BIC           -1.069310493e+5
#> 5 deviance       2.018204211e+4
#> 6 df.residual    2.031712152e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  8.368181294e-3
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.385856281e-1
#>  2 mean((Intercept)) -3.328906026e+0
#>  3 mean(s(year))     -6.327806138e-3
#>  4 s(year).1         -6.226542785e-3
#>  5 s(year).2         -1.622182835e-1
#>  6 s(year).3         -3.886640718e-2
#>  7 s(year).4         -2.850061078e-2
#>  8 s(year).5         -1.574562504e-2
#>  9 s(year).6         -6.517489180e-2
#> 10 s(year).7          3.211770561e-2
#> 11 s(year).8          2.458871229e-1
#> 12 s(year).9         -1.822272269e-2
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    4.805062457e-24 4.789869656e-24
#> 2 observed 4.805062457e-24 2.454022490e-26
#> 3 estimate 4.805062457e-24 4.765891442e-27
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(117.221) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.316663217  0.008995402 -368.7065 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 2.804893 3.488528 18.45051 0.00068947 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00962   Deviance explained = 0.78%
#> -REML = -7579.6  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       9.620417112e-3 very weak (negligible) cohen1988
#> 2 SE       3.686718987e-3 <NA>                   <NA>     
#> 3 Lower CI 2.394580677e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.684625355e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.804893450e+0
#> 2 logLik         7.589756430e+3
#> 3 AIC           -1.516853580e+4
#> 4 BIC           -1.513600748e+4
#> 5 deviance       2.724408547e+3
#> 6 df.residual    2.766195107e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  9.620417112e-3
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.298481889e-1
#>  2 mean((Intercept)) -3.316663217e+0
#>  3 mean(s(year))      2.020147517e-3
#>  4 s(year).1          3.567638263e-2
#>  5 s(year).2         -1.469841437e-2
#>  6 s(year).3         -3.295233180e-3
#>  7 s(year).4         -2.435865632e-2
#>  8 s(year).5         -2.914455896e-3
#>  9 s(year).6         -1.953474457e-2
#> 10 s(year).7          7.677889581e-3
#> 11 s(year).8          8.943374876e-2
#> 12 s(year).9         -4.980518897e-2
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    3.492632002e-25 3.488396698e-25
#> 2 observed 3.492632002e-25 5.094730619e-28
#> 3 estimate 3.492632002e-25 5.386978387e-28
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 219: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(maper_mpepr ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(maper_mpepr_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.501) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.738267001  0.008190896 -334.3062 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 5.355141 6.489999 77.43736 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00878   Deviance explained = 1.06%
#> -REML = -14650  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             6.355141079e+0
#> 2 logLik         1.466593064e+4
#> 3 AIC           -2.931488128e+4
#> 4 BIC           -2.925563031e+4
#> 5 deviance       8.013236128e+3
#> 6 df.residual    7.927644859e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -8.779179357e-3
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.785507367e-1
#>  2 mean((Intercept)) -2.738267001e+0
#>  3 mean(s(year))     -5.248929641e-3
#>  4 s(year).1          1.376384812e-1
#>  5 s(year).2         -2.991294984e-1
#>  6 s(year).3         -6.081744698e-2
#>  7 s(year).4         -1.284112825e-1
#>  8 s(year).5         -4.271084747e-2
#>  9 s(year).6         -8.827298471e-2
#> 10 s(year).7          5.343457893e-2
#> 11 s(year).8          4.733736401e-1
#> 12 s(year).9         -9.234500691e-2
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    1.130576203e-24 1.124907020e-24
#> 2 observed 1.130576203e-24 8.648638222e-29
#> 3 estimate 1.130576203e-24 2.338537092e-27
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.304) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.123772043  0.004812238 -649.1308 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.468487 8.921806 306.6465 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00354   Deviance explained = 0.906%
#> -REML = -69448  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.468486987e+0
#> 2 logLik         6.947625515e+4
#> 3 AIC           -1.389306667e+5
#> 4 BIC           -1.388393042e+5
#> 5 deviance       3.380077243e+4
#> 6 df.residual    3.172453151e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -3.543446137e-3
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.102520032e-1
#>  2 mean((Intercept)) -3.123772043e+0
#>  3 mean(s(year))      2.361334521e-3
#>  4 s(year).1          8.999927753e-2
#>  5 s(year).2         -7.066952812e-1
#>  6 s(year).3         -3.585840580e-2
#>  7 s(year).4         -2.861927701e-1
#>  8 s(year).5          6.586674224e-2
#>  9 s(year).6         -6.086044159e-2
#> 10 s(year).7          3.152779877e-3
#> 11 s(year).8          7.257320898e-1
#> 12 s(year).9          2.261080200e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    7.881445955e-24 7.879958186e-24
#> 2 observed 7.881445955e-24 1.228913459e-26
#> 3 estimate 7.881445955e-24 2.276708824e-26
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(47.018) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.63405992  0.00379428 -694.2186 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>             edf   Ref.df   Chi.sq    p-value    
#> s(year) 6.82548 7.933766 282.1114 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0205   Deviance explained = 1.46%
#> -REML = -40579  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.054835475e-2 weak                   cohen1988
#> 2 SE       1.969346524e-3 <NA>                   <NA>     
#> 3 Lower CI 1.668850649e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.440820301e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             7.825479515e+0
#> 2 logLik         4.060058114e+4
#> 3 AIC           -8.118129475e+4
#> 4 BIC           -8.110262372e+4
#> 5 deviance       1.989189348e+4
#> 6 df.residual    2.031617452e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.054835475e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.486774600e-1
#>  2 mean((Intercept)) -2.634059921e+0
#>  3 mean(s(year))      1.636503566e-2
#>  4 s(year).1         -4.267022781e-2
#>  5 s(year).2         -1.869584544e-2
#>  6 s(year).3          1.262334793e-2
#>  7 s(year).4          5.912111967e-2
#>  8 s(year).5          4.606888207e-2
#>  9 s(year).6          5.163118523e-2
#> 10 s(year).7         -8.711797799e-5
#> 11 s(year).8          1.346337316e-2
#> 12 s(year).9          2.583060413e-2
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    4.805062457e-24 4.789869656e-24
#> 2 observed 4.805062457e-24 1.803596251e-26
#> 3 estimate 4.805062457e-24 4.765891442e-27
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(60.892) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.684274755  0.009366149 -286.5932 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 3.118664 3.873412 48.69109 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0245   Deviance explained = 1.94%
#> -REML = -5884.9  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.445679373e-2 weak                   cohen1988
#> 2 SE       5.790121474e-3 <NA>                   <NA>     
#> 3 Lower CI 1.310836418e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.580522329e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             4.118664335e+0
#> 2 logLik         5.895557018e+3
#> 3 AIC           -1.177936721e+4
#> 4 BIC           -1.174455783e+4
#> 5 deviance       2.711925400e+3
#> 6 df.residual    2.765881336e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.445679373e-2
#> 9 npar           1          e+1
#> 
#> # A tibble: 12 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.695130778e-1
#>  2 mean((Intercept)) -2.684274755e+0
#>  3 mean(s(year))     -1.206224742e-3
#>  4 s(year).1          6.253181814e-2
#>  5 s(year).2         -2.372061657e-2
#>  6 s(year).3         -3.644653191e-3
#>  7 s(year).4         -2.967166715e-2
#>  8 s(year).5         -1.785778536e-3
#>  9 s(year).6         -2.283691052e-2
#> 10 s(year).7          9.199869921e-3
#> 11 s(year).8          1.006799660e-1
#> 12 s(year).9         -1.016080508e-1
#> 
#> # A tibble: 3 × 3
#>   names               para       `s(year)`
#>   <chr>              <dbl>           <dbl>
#> 1 worst    3.492632002e-25 3.488396698e-25
#> 2 observed 3.492632002e-25 5.994564297e-28
#> 3 estimate 3.492632002e-25 5.386978387e-28
Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 220: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By year (Ordered)

In this model, the year variable is treated as a ordered categorical variable.

.L, .Q, and .C are, respectively, the coefficients for the ordered factor coded with linear, quadratic, and cubic contrasts.

Code
mbepr_gam_5_by_misfs <-
  data |>
  gam_misfs(mbepr ~ year)
data |>
  summarise_gam_misfs(mbepr_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.537) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value            Pr(>|z|)    
#> (Intercept) -2.76707348  0.00889582 -311.05322          < 2.22e-16 ***
#> year.L       0.28304655  0.03121408    9.06791          < 2.22e-16 ***
#> year.Q      -0.11246535  0.03138404   -3.58352          0.00033899 ***
#> year.C       0.04686843  0.03131901    1.49648          0.13452735    
#> year^4      -0.13966641  0.03090395   -4.51937 0.00000620235717360 ***
#> year^5       0.22113383  0.03081657    7.17581 0.00000000000071881 ***
#> year^6      -0.10484629  0.03047211   -3.44073          0.00058015 ***
#> year^7      -0.05267022  0.03059111   -1.72175          0.08511499 .  
#> year^8       0.05572956  0.03054007    1.82480          0.06803102 .  
#> year^9      -0.05530103  0.03045136   -1.81604          0.06936350 .  
#> year^10     -0.11170879  0.03077141   -3.63028          0.00028312 ***
#> year^11     -0.05494166  0.03049266   -1.80180          0.07157702 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0203   Deviance explained = 2.47%
#> -REML = -14555  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.458696428e+4
#> 3 AIC           -2.914792856e+4
#> 4 BIC           -2.905720269e+4
#> 5 deviance       8.119205011e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -2.027317837e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.326579044e-1
#>  2 mean((Intercept)) -2.767073476e+0
#>  3 year.L             2.830465530e-1
#>  4 year.Q            -1.124653465e-1
#>  5 year.C             4.686842801e-2
#>  6 year^4            -1.396664095e-1
#>  7 year^5             2.211338304e-1
#>  8 year^6            -1.048462941e-1
#>  9 year^7            -5.267021586e-2
#> 10 year^8             5.572955459e-2
#> 11 year^9            -5.530103039e-2
#> 12 year^10           -1.117087910e-1
#> 13 year^11           -5.494165552e-2
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.507) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -3.068257280  0.004876622 -629.17683         < 2.22e-16 ***
#> year.L       0.117916909  0.016977423    6.94551 0.0000000000037709 ***
#> year.Q      -0.174826699  0.017095705  -10.22635         < 2.22e-16 ***
#> year.C      -0.003230379  0.016997114   -0.19005          0.8492664    
#> year^4      -0.092998354  0.016928528   -5.49359 0.0000000393849543 ***
#> year^5       0.113903431  0.016871638    6.75118 0.0000000000146649 ***
#> year^6      -0.053888234  0.016821582   -3.20352          0.0013576 ** 
#> year^7      -0.005140243  0.016788872   -0.30617          0.7594755    
#> year^8       0.051135768  0.016775518    3.04824          0.0023019 ** 
#> year^9      -0.024217553  0.016789792   -1.44240          0.1491903    
#> year^10     -0.030014231  0.016842341   -1.78207          0.0747378 .  
#> year^11     -0.007893006  0.016932609   -0.46614          0.6411136    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00456   Deviance explained = 0.764%
#> -REML = -68042  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.808076769e+4
#> 3 AIC           -1.361355354e+5
#> 4 BIC           -1.360267885e+5
#> 5 deviance       3.347652301e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -4.559784873e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.647924893e-1
#>  2 mean((Intercept)) -3.068257280e+0
#>  3 year.L             1.179169093e-1
#>  4 year.Q            -1.748266989e-1
#>  5 year.C            -3.230379410e-3
#>  6 year^4            -9.299835398e-2
#>  7 year^5             1.139034310e-1
#>  8 year^6            -5.388823428e-2
#>  9 year^7            -5.140243275e-3
#> 10 year^8             5.113576814e-2
#> 11 year^9            -2.421755327e-2
#> 12 year^10           -3.001423105e-2
#> 13 year^11           -7.893006275e-3
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(38.489) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value          Pr(>|z|)    
#> (Intercept) -2.601124170  0.004077341 -637.94616        < 2.22e-16 ***
#> year.L      -0.221239238  0.014086278  -15.70601        < 2.22e-16 ***
#> year.Q       0.078115440  0.014179186    5.50916 0.000000036054493 ***
#> year.C       0.005758650  0.014116639    0.40793        0.68332249    
#> year^4      -0.058430541  0.014093349   -4.14597 0.000033838461198 ***
#> year^5       0.068477692  0.014150746    4.83916 0.000001303904250 ***
#> year^6       0.002665934  0.014041834    0.18986        0.84942154    
#> year^7      -0.007964157  0.014126746   -0.56376        0.57291445    
#> year^8       0.046695378  0.014092086    3.31359        0.00092107 ***
#> year^9      -0.002246625  0.014028708   -0.16014        0.87276696    
#> year^10     -0.094569778  0.014214460   -6.65307 0.000000000028704 ***
#> year^11     -0.023171492  0.014235985   -1.62767        0.10359478    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0285   Deviance explained = 1.87%
#> -REML = -38670  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       2.851689999e-2 weak           cohen1988
#> 2 SE       2.301108092e-3 <NA>           <NA>     
#> 3 Lower CI 2.400681100e-2 weak           cohen1988
#> 4 Upper CI 3.302698897e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         3.871102690e+4
#> 3 AIC           -7.739605379e+4
#> 4 BIC           -7.729309954e+4
#> 5 deviance       1.976947966e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.851689999e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.339194089e-1
#>  2 mean((Intercept)) -2.601124170e+0
#>  3 year.L            -2.212392381e-1
#>  4 year.Q             7.811544047e-2
#>  5 year.C             5.758650085e-3
#>  6 year^4            -5.843054068e-2
#>  7 year^5             6.847769196e-2
#>  8 year^6             2.665934221e-3
#>  9 year^7            -7.964157318e-3
#> 10 year^8             4.669537841e-2
#> 11 year^9            -2.246625497e-3
#> 12 year^10           -9.456977790e-2
#> 13 year^11           -2.317149246e-2
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(35.093) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value    Pr(>|z|)    
#> (Intercept) -2.268126583  0.010262308 -221.01525  < 2.22e-16 ***
#> year.L      -0.349342664  0.035482444   -9.84551  < 2.22e-16 ***
#> year.Q       0.118855625  0.035612748    3.33745  0.00084552 ***
#> year.C      -0.007878134  0.035733439   -0.22047  0.82550551    
#> year^4      -0.019372846  0.035323568   -0.54844  0.58339004    
#> year^5       0.087681548  0.035681486    2.45734  0.01399701 *  
#> year^6      -0.083700324  0.035219866   -2.37651  0.01747734 *  
#> year^7      -0.025897709  0.035565035   -0.72818  0.46650407    
#> year^8       0.100549311  0.035482342    2.83378  0.00460003 ** 
#> year^9       0.039742476  0.035343749    1.12446  0.26081979    
#> year^10     -0.141721586  0.036103188   -3.92546 0.000086564 ***
#> year^11     -0.005692148  0.035490482   -0.16039  0.87257765    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0455   Deviance explained = 5.16%
#> -REML = -4657.5  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.545270470e-2 weak           cohen1988
#> 2 SE       7.723581311e-3 <NA>           <NA>     
#> 3 Lower CI 3.031476350e-2 weak           cohen1988
#> 4 Upper CI 6.059064590e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.687741024e+3
#> 3 AIC           -9.349482048e+3
#> 4 BIC           -9.272436214e+3
#> 5 deviance       2.677966059e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  4.545270470e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.129085861e-1
#>  2 mean((Intercept)) -2.268126583e+0
#>  3 year.L            -3.493426642e-1
#>  4 year.Q             1.188556253e-1
#>  5 year.C            -7.878133913e-3
#>  6 year^4            -1.937284601e-2
#>  7 year^5             8.768154802e-2
#>  8 year^6            -8.370032358e-2
#>  9 year^7            -2.589770892e-2
#> 10 year^8             1.005493105e-1
#> 11 year^9             3.974247609e-2
#> 12 year^10           -1.417215861e-1
#> 13 year^11           -5.692147857e-3
Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 221: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_5_by_misfs <-
  data |>
  gam_misfs(beipr ~ year)
data |>
  summarise_gam_misfs(beipr_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.127) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.653683063  0.007822268 -339.24725 < 2.22e-16 ***
#> year.L       0.363126602  0.027254975   13.32331 < 2.22e-16 ***
#> year.Q       0.006592482  0.027315449    0.24135  0.8092867    
#> year.C      -0.067126106  0.027355416   -2.45385  0.0141336 *  
#> year^4      -0.026716047  0.027091455   -0.98614  0.3240630    
#> year^5       0.072639093  0.027086258    2.68177  0.0073234 ** 
#> year^6      -0.067121673  0.026968738   -2.48887  0.0128150 *  
#> year^7      -0.106999017  0.026960591   -3.96872 0.00007226 ***
#> year^8       0.049467750  0.026962598    1.83468  0.0665531 .  
#> year^9       0.016125260  0.027014572    0.59691  0.5505677    
#> year^10     -0.019663087  0.027145861   -0.72435  0.4688513    
#> year^11      0.027474518  0.026908162    1.02105  0.3072318    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0299   Deviance explained = 2.71%
#> -REML = -14282  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.431571354e+4
#> 3 AIC           -2.860542709e+4
#> 4 BIC           -2.851470122e+4
#> 5 deviance       8.071957558e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -2.986476328e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.004902740e-1
#>  2 mean((Intercept)) -2.653683063e+0
#>  3 year.L             3.631266025e-1
#>  4 year.Q             6.592482359e-3
#>  5 year.C            -6.712610602e-2
#>  6 year^4            -2.671604750e-2
#>  7 year^5             7.263909259e-2
#>  8 year^6            -6.712167258e-2
#>  9 year^7            -1.069990172e-1
#> 10 year^8             4.946775019e-2
#> 11 year^9             1.612525957e-2
#> 12 year^10           -1.966308709e-2
#> 13 year^11            2.747451788e-2
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.666) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.848403801  0.004212082 -676.24608 < 2.22e-16 ***
#> year.L       0.164472875  0.014594109   11.26981 < 2.22e-16 ***
#> year.Q      -0.042234319  0.014759944   -2.86141  0.0042176 ** 
#> year.C      -0.026048138  0.014657237   -1.77715  0.0755432 .  
#> year^4      -0.102261347  0.014581803   -7.01294 2.3336e-12 ***
#> year^5       0.113377180  0.014552940    7.79067 6.6654e-15 ***
#> year^6      -0.033556378  0.014535455   -2.30859  0.0209665 *  
#> year^7      -0.042350207  0.014462416   -2.92829  0.0034083 ** 
#> year^8       0.061968334  0.014463510    4.28446 1.8318e-05 ***
#> year^9      -0.008431711  0.014541208   -0.57985  0.5620162    
#> year^10      0.012862093  0.014613024    0.88018  0.3787618    
#> year^11      0.062101003  0.014736983    4.21396 2.5094e-05 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0159   Deviance explained = 0.926%
#> -REML = -61291  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.133176478e+4
#> 3 AIC           -1.226375296e+5
#> 4 BIC           -1.225287827e+5
#> 5 deviance       3.310622465e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -1.591864228e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.240420346e-1
#>  2 mean((Intercept)) -2.848403801e+0
#>  3 year.L             1.644728747e-1
#>  4 year.Q            -4.223431950e-2
#>  5 year.C            -2.604813772e-2
#>  6 year^4            -1.022613469e-1
#>  7 year^5             1.133771804e-1
#>  8 year^6            -3.355637823e-2
#>  9 year^7            -4.235020665e-2
#> 10 year^8             6.196833446e-2
#> 11 year^9            -8.431711219e-3
#> 12 year^10            1.286209285e-2
#> 13 year^11            6.210100337e-2
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(72.251) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value     Pr(>|z|)    
#> (Intercept) -2.502196791  0.002989478 -837.00117   < 2.22e-16 ***
#> year.L      -0.148795186  0.010256389  -14.50756   < 2.22e-16 ***
#> year.Q       0.140467010  0.010344901   13.57838   < 2.22e-16 ***
#> year.C      -0.015295539  0.010349307   -1.47793   0.13942683    
#> year^4      -0.045210704  0.010310435   -4.38495 0.0000116015 ***
#> year^5       0.031196138  0.010306005    3.02699   0.00247005 ** 
#> year^6      -0.048162565  0.010293102   -4.67911 0.0000028812 ***
#> year^7      -0.027614694  0.010329294   -2.67343   0.00750789 ** 
#> year^8       0.015704477  0.010361007    1.51573   0.12958795    
#> year^9       0.024284210  0.010396450    2.33582   0.01950075 *  
#> year^10     -0.026072357  0.010468922   -2.49045   0.01275804 *  
#> year^11      0.035524684  0.010496031    3.38458   0.00071287 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.036   Deviance explained = 2.34%
#> -REML = -42819  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.600156273e-2 weak           cohen1988
#> 2 SE       2.565592159e-3 <NA>           <NA>     
#> 3 Lower CI 3.097309450e-2 weak           cohen1988
#> 4 Upper CI 4.103003096e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.286366655e+4
#> 3 AIC           -8.570133310e+4
#> 4 BIC           -8.559837885e+4
#> 5 deviance       2.003054550e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  3.600156273e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.138476097e-1
#>  2 mean((Intercept)) -2.502196791e+0
#>  3 year.L            -1.487951861e-1
#>  4 year.Q             1.404670099e-1
#>  5 year.C            -1.529553927e-2
#>  6 year^4            -4.521070365e-2
#>  7 year^5             3.119613812e-2
#>  8 year^6            -4.816256519e-2
#>  9 year^7            -2.761469368e-2
#> 10 year^8             1.570447713e-2
#> 11 year^9             2.428421035e-2
#> 12 year^10           -2.607235722e-2
#> 13 year^11            3.552468419e-2
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(52.212) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value             Pr(>|z|)    
#> (Intercept) -1.925855145  0.007633206 -252.29966           < 2.22e-16 ***
#> year.L      -0.197665440  0.026515721   -7.45465 0.000000000000090106 ***
#> year.Q       0.061061663  0.026628696    2.29308             0.021844 *  
#> year.C       0.056733481  0.026641358    2.12953             0.033211 *  
#> year^4      -0.048045087  0.026391217   -1.82050             0.068684 .  
#> year^5       0.037930444  0.026437739    1.43471             0.151370    
#> year^6      -0.065299046  0.026322574   -2.48072             0.013112 *  
#> year^7      -0.006545489  0.026302884   -0.24885             0.803476    
#> year^8       0.048114722  0.026298952    1.82953             0.067320 .  
#> year^9       0.010639848  0.026374879    0.40341             0.686648    
#> year^10     -0.022898650  0.026567896   -0.86189             0.388747    
#> year^11      0.009279899  0.026379237    0.35179             0.724997    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0327   Deviance explained = 2.94%
#> -REML = -4685.3  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       3.271189059e-2 weak                   cohen1988
#> 2 SE       6.639724773e-3 <NA>                   <NA>     
#> 3 Lower CI 1.969826917e-2 very weak (negligible) cohen1988
#> 4 Upper CI 4.572551202e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.719121470e+3
#> 3 AIC           -9.412242941e+3
#> 4 BIC           -9.335197107e+3
#> 5 deviance       2.714505806e+3
#> 6 df.residual    2.758000000e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  3.271189059e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.702124000e-1
#>  2 mean((Intercept)) -1.925855145e+0
#>  3 year.L            -1.976654395e-1
#>  4 year.Q             6.106166326e-2
#>  5 year.C             5.673348110e-2
#>  6 year^4            -4.804508736e-2
#>  7 year^5             3.793044361e-2
#>  8 year^6            -6.529904630e-2
#>  9 year^7            -6.545489025e-3
#> 10 year^8             4.811472178e-2
#> 11 year^9             1.063984833e-2
#> 12 year^10           -2.289864971e-2
#> 13 year^11            9.279899115e-3
Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 222: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_5_by_misfs <-
  data |>
  gam_misfs(mbepr_beipr ~ year)
data |>
  summarise_gam_misfs(mbepr_beipr_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(17.202) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value        Pr(>|z|)    
#> (Intercept) -1.927800978  0.007327002 -263.10912      < 2.22e-16 ***
#> year.L       0.155049954  0.025596459    6.05748 0.0000000013827 ***
#> year.Q      -0.034396274  0.025664489   -1.34023       0.1801711    
#> year.C      -0.006036878  0.025713990   -0.23477       0.8143871    
#> year^4      -0.048352778  0.025401956   -1.90351       0.0569745 .  
#> year^5       0.144445424  0.025364494    5.69479 0.0000000123525 ***
#> year^6      -0.104062168  0.025157411   -4.13644 0.0000352732685 ***
#> year^7      -0.040925467  0.025253863   -1.62056       0.1051115    
#> year^8       0.048076497  0.025252105    1.90386       0.0569283 .  
#> year^9      -0.005973620  0.025227551   -0.23679       0.8128201    
#> year^10     -0.074641489  0.025428484   -2.93535       0.0033317 ** 
#> year^11     -0.024117334  0.025127362   -0.95980       0.3371540    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.011   Deviance explained = 1.35%
#> -REML = -9870.1  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         9.904385109e+3
#> 3 AIC           -1.978277022e+4
#> 4 BIC           -1.969204436e+4
#> 5 deviance       7.756093795e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -1.096589072e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.598945925e-1
#>  2 mean((Intercept)) -1.927800978e+0
#>  3 year.L             1.550499540e-1
#>  4 year.Q            -3.439627366e-2
#>  5 year.C            -6.036878490e-3
#>  6 year^4            -4.835277765e-2
#>  7 year^5             1.444454242e-1
#>  8 year^6            -1.040621684e-1
#>  9 year^7            -4.092546705e-2
#> 10 year^8             4.807649683e-2
#> 11 year^9            -5.973619732e-3
#> 12 year^10           -7.464148930e-2
#> 13 year^11           -2.411733376e-2
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.45) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.201794018  0.004008320 -549.30597 < 2.22e-16 ***
#> year.L       0.040093785  0.013924671    2.87933 0.00398515 ** 
#> year.Q      -0.083392401  0.014042704   -5.93849 2.8767e-09 ***
#> year.C      -0.011116822  0.013971517   -0.79568 0.42621951    
#> year^4      -0.072295526  0.013891383   -5.20434 1.9468e-07 ***
#> year^5       0.112196244  0.013857588    8.09638 5.6621e-16 ***
#> year^6      -0.053673556  0.013822192   -3.88314 0.00010311 ***
#> year^7      -0.026248013  0.013783413   -1.90432 0.05686867 .  
#> year^8       0.054572752  0.013781906    3.95974 7.5032e-05 ***
#> year^9      -0.002179925  0.013824727   -0.15768 0.87470654    
#> year^10     -0.010776896  0.013886529   -0.77607 0.43770862    
#> year^11      0.029660260  0.013948448    2.12642 0.03346829 *  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00237   Deviance explained = 0.56%
#> -REML = -44226  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.426792248e+4
#> 3 AIC           -8.850984496e+4
#> 4 BIC           -8.840109809e+4
#> 5 deviance       3.182959169e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.365279760e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.854128428e-1
#>  2 mean((Intercept)) -2.201794018e+0
#>  3 year.L             4.009378510e-2
#>  4 year.Q            -8.339240135e-2
#>  5 year.C            -1.111682189e-2
#>  6 year^4            -7.229552586e-2
#>  7 year^5             1.121962443e-1
#>  8 year^6            -5.367355552e-2
#>  9 year^7            -2.624801252e-2
#> 10 year^8             5.457275223e-2
#> 11 year^9            -2.179925447e-3
#> 12 year^10           -1.077689582e-2
#> 13 year^11            2.966026049e-2
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(32.314) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                  Estimate    Std. Error    z value      Pr(>|z|)    
#> (Intercept) -1.7748564177  0.0033447160 -530.64488    < 2.22e-16 ***
#> year.L      -0.2594420089  0.0115120249  -22.53661    < 2.22e-16 ***
#> year.Q       0.1363862197  0.0115958679   11.76162    < 2.22e-16 ***
#> year.C       0.0012775965  0.0115719081    0.11041    0.91208819    
#> year^4      -0.0548553810  0.0115527519   -4.74825 0.00000205182 ***
#> year^5       0.0443979132  0.0115655057    3.83882    0.00012363 ***
#> year^6      -0.0231459262  0.0115222410   -2.00880    0.04455790 *  
#> year^7      -0.0104135840  0.0115768225   -0.89952    0.36837572    
#> year^8       0.0237630550  0.0115831063    2.05153    0.04021565 *  
#> year^9       0.0199901948  0.0115759610    1.72687    0.08419078 .  
#> year^10     -0.0617533698  0.0116776235   -5.28818 0.00000012354 ***
#> year^11      0.0007588868  0.0117154010    0.06478    0.94835167    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0434   Deviance explained = 3.53%
#> -REML = -28926  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.335752981e-2 weak           cohen1988
#> 2 SE       2.794039468e-3 <NA>           <NA>     
#> 3 Lower CI 3.788131308e-2 weak           cohen1988
#> 4 Upper CI 4.883374654e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         2.897004590e+4
#> 3 AIC           -5.791409181e+4
#> 4 BIC           -5.781113756e+4
#> 5 deviance       1.982049212e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  4.335752981e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.631577351e-1
#>  2 mean((Intercept)) -1.774856418e+0
#>  3 year.L            -2.594420089e-1
#>  4 year.Q             1.363862197e-1
#>  5 year.C             1.277596535e-3
#>  6 year^4            -5.485538104e-2
#>  7 year^5             4.439791322e-2
#>  8 year^6            -2.314592619e-2
#>  9 year^7            -1.041358398e-2
#> 10 year^8             2.376305505e-2
#> 11 year^9             1.999019478e-2
#> 12 year^10           -6.175336983e-2
#> 13 year^11            7.588868352e-4
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.343) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -1.258354871  0.008929517 -140.92082 < 2.22e-16 ***
#> year.L      -0.345509238  0.030979054  -11.15300 < 2.22e-16 ***
#> year.Q       0.111788551  0.031051612    3.60009 0.00031811 ***
#> year.C       0.034028105  0.031098416    1.09421 0.27386419    
#> year^4      -0.025903944  0.030851767   -0.83963 0.40111816    
#> year^5       0.051005021  0.030976997    1.64655 0.09965160 .  
#> year^6      -0.079249591  0.030792775   -2.57364 0.01006342 *  
#> year^7      -0.005113017  0.030865679   -0.16565 0.86842941    
#> year^8       0.071840113  0.030835764    2.32977 0.01981853 *  
#> year^9       0.027230290  0.030836002    0.88307 0.37719947    
#> year^10     -0.073558247  0.031130417   -2.36291 0.01813227 *  
#> year^11     -0.006569161  0.030839502   -0.21301 0.83131819    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0573   Deviance explained = 5.65%
#> -REML = -3037.9  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       5.729349284e-2 weak           cohen1988
#> 2 SE       8.563879749e-3 <NA>           <NA>     
#> 3 Lower CI 4.050859696e-2 weak           cohen1988
#> 4 Upper CI 7.407838871e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         3.069860234e+3
#> 3 AIC           -6.113720467e+3
#> 4 BIC           -6.036674633e+3
#> 5 deviance       2.685543298e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  5.729349284e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.248638324e-1
#>  2 mean((Intercept)) -1.258354871e+0
#>  3 year.L            -3.455092381e-1
#>  4 year.Q             1.117885509e-1
#>  5 year.C             3.402810537e-2
#>  6 year^4            -2.590394381e-2
#>  7 year^5             5.100502078e-2
#>  8 year^6            -7.924959098e-2
#>  9 year^7            -5.113016893e-3
#> 10 year^8             7.184011345e-2
#> 11 year^9             2.723029014e-2
#> 12 year^10           -7.355824724e-2
#> 13 year^11           -6.569160708e-3
Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 223: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_5_by_misfs <-
  data |>
  gam_misfs(maper ~ year)
data |>
  summarise_gam_misfs(maper_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.761) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value      Pr(>|z|)    
#> (Intercept) -3.530069222  0.009802718 -360.11128    < 2.22e-16 ***
#> year.L       0.104598923  0.034445367    3.03666    0.00239214 ** 
#> year.Q      -0.194940662  0.034505042   -5.64963 0.00000001608 ***
#> year.C      -0.069618293  0.034281636   -2.03078    0.04227781 *  
#> year^4      -0.112521422  0.034064505   -3.30319    0.00095593 ***
#> year^5       0.075751354  0.034155401    2.21784    0.02656547 *  
#> year^6       0.049211214  0.033939964    1.44995    0.14707276    
#> year^7       0.002841143  0.033756387    0.08417    0.93292437    
#> year^8       0.134923449  0.033567360    4.01948 0.00005832586 ***
#> year^9       0.004377093  0.033514215    0.13060    0.89608852    
#> year^10     -0.033243415  0.033703404   -0.98635    0.32396049    
#> year^11     -0.019870002  0.033581458   -0.59170    0.55405443    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0079   Deviance explained = 0.957%
#> -REML = -20716  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         2.074635089e+4
#> 3 AIC           -4.146670177e+4
#> 4 BIC           -4.137597591e+4
#> 5 deviance       8.433850322e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -7.903895660e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.990466532e-1
#>  2 mean((Intercept)) -3.530069222e+0
#>  3 year.L             1.045989226e-1
#>  4 year.Q            -1.949406618e-1
#>  5 year.C            -6.961829296e-2
#>  6 year^4            -1.125214220e-1
#>  7 year^5             7.575135391e-2
#>  8 year^6             4.921121425e-2
#>  9 year^7             2.841143292e-3
#> 10 year^8             1.349234490e-1
#> 11 year^9             4.377093057e-3
#> 12 year^10           -3.324341471e-2
#> 13 year^11           -1.987000168e-2
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.009) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value         Pr(>|z|)    
#> (Intercept) -3.947715665  0.005230480 -754.75214       < 2.22e-16 ***
#> year.L       0.087036958  0.018122175    4.80279 0.00000156471910 ***
#> year.Q      -0.113028621  0.018263601   -6.18874 0.00000000060648 ***
#> year.C      -0.105741910  0.018137515   -5.83001 0.00000000554237 ***
#> year^4      -0.107411419  0.018126852   -5.92554 0.00000000311270 ***
#> year^5       0.079974056  0.018101738    4.41803 0.00000996036822 ***
#> year^6       0.018644792  0.018088259    1.03077        0.3026498    
#> year^7       0.047323466  0.018029506    2.62478        0.0086705 ** 
#> year^8       0.092256007  0.018013711    5.12143 0.00000030322303 ***
#> year^9      -0.005596113  0.018048568   -0.31006        0.7565164    
#> year^10     -0.003568097  0.018101221   -0.19712        0.8437343    
#> year^11      0.009635605  0.018272946    0.52732        0.5979746    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00248   Deviance explained = 0.544%
#> -REML = -1.0446e+05  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.044996352e+5
#> 3 AIC           -2.089732704e+5
#> 4 BIC           -2.088645236e+5
#> 5 deviance       3.427644493e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.481012795e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.290159117e-1
#>  2 mean((Intercept)) -3.947715665e+0
#>  3 year.L             8.703695810e-2
#>  4 year.Q            -1.130286207e-1
#>  5 year.C            -1.057419100e-1
#>  6 year^4            -1.074114192e-1
#>  7 year^5             7.997405596e-2
#>  8 year^6             1.864479189e-2
#>  9 year^7             4.732346563e-2
#> 10 year^8             9.225600677e-2
#> 11 year^9            -5.596112765e-3
#> 12 year^10           -3.568097065e-3
#> 13 year^11            9.635605145e-3
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(51.613) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value             Pr(>|z|)    
#> (Intercept) -3.400622395  0.004764848 -713.68955           < 2.22e-16 ***
#> year.L      -0.156051988  0.016747421   -9.31797           < 2.22e-16 ***
#> year.Q      -0.128726095  0.016714329   -7.70154 0.000000000000013443 ***
#> year.C      -0.005769232  0.016587436   -0.34781            0.7279849    
#> year^4      -0.024311829  0.016575313   -1.46675            0.1424443    
#> year^5       0.072274727  0.016663513    4.33730 0.000014424083339625 ***
#> year^6       0.049416716  0.016514786    2.99227            0.0027691 ** 
#> year^7       0.010033851  0.016506714    0.60786            0.5432771    
#> year^8       0.074491098  0.016371442    4.55006 0.000005362977646052 ***
#> year^9      -0.014569827  0.016226118   -0.89792            0.3692259    
#> year^10     -0.086108370  0.016350984   -5.26625 0.000000139238658588 ***
#> year^11      0.035871456  0.016297906    2.20099            0.0277370 *  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0109   Deviance explained = 1.15%
#> -REML = -50950  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.094496673e-2 very weak (negligible) cohen1988
#> 2 SE       1.451370507e-3 <NA>                   <NA>     
#> 3 Lower CI 8.100332809e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.378960065e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.098980161e+4
#> 3 AIC           -1.019536032e+5
#> 4 BIC           -1.018506490e+5
#> 5 deviance       2.004505690e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  1.094496673e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.978393239e-1
#>  2 mean((Intercept)) -3.400622395e+0
#>  3 year.L            -1.560519880e-1
#>  4 year.Q            -1.287260955e-1
#>  5 year.C            -5.769231516e-3
#>  6 year^4            -2.431182856e-2
#>  7 year^5             7.227472733e-2
#>  8 year^6             4.941671618e-2
#>  9 year^7             1.003385092e-2
#> 10 year^8             7.449109809e-2
#> 11 year^9            -1.456982668e-2
#> 12 year^10           -8.610837016e-2
#> 13 year^11            3.587145623e-2
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(84.23) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value       Pr(>|z|)    
#> (Intercept) -3.515374052  0.011174422 -314.59113     < 2.22e-16 ***
#> year.L      -0.230141752  0.039373090   -5.84515 0.000000005061 ***
#> year.Q      -0.094313845  0.039229772   -2.40414       0.016211 *  
#> year.C      -0.114018442  0.039109754   -2.91535       0.003553 ** 
#> year^4      -0.003614870  0.038856951   -0.09303       0.925880    
#> year^5       0.094367111  0.039007013    2.41923       0.015553 *  
#> year^6      -0.009984777  0.038729265   -0.25781       0.796554    
#> year^7       0.057408694  0.038592128    1.48758       0.136863    
#> year^8       0.057557812  0.038355782    1.50063       0.133451    
#> year^9      -0.029429933  0.038200427   -0.77041       0.441058    
#> year^10     -0.036098574  0.038367993   -0.94085       0.346781    
#> year^11      0.039762754  0.037953787    1.04766       0.294794    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0202   Deviance explained = 2.23%
#> -REML =  -7541  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.021475971e-2 weak                   cohen1988
#> 2 SE       5.286966888e-3 <NA>                   <NA>     
#> 3 Lower CI 9.852495026e-3 very weak (negligible) cohen1988
#> 4 Upper CI 3.057702440e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         7.570286498e+3
#> 3 AIC           -1.511457300e+4
#> 4 BIC           -1.503752716e+4
#> 5 deviance       2.705752165e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.021475971e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.153233228e-1
#>  2 mean((Intercept)) -3.515374052e+0
#>  3 year.L            -2.301417517e-1
#>  4 year.Q            -9.431384514e-2
#>  5 year.C            -1.140184421e-1
#>  6 year^4            -3.614870049e-3
#>  7 year^5             9.436711105e-2
#>  8 year^6            -9.984777060e-3
#>  9 year^7             5.740869375e-2
#> 10 year^8             5.755781222e-2
#> 11 year^9            -2.942993275e-2
#> 12 year^10           -3.609857360e-2
#> 13 year^11            3.976275366e-2
Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 224: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_5_by_misfs <-
  data |>
  gam_misfs(mpepr ~ year)
data |>
  summarise_gam_misfs(mpepr_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(31.103) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value      Pr(>|z|)    
#> (Intercept) -3.418001960  0.008985228 -380.40237    < 2.22e-16 ***
#> year.L       0.303094333  0.031609890    9.58859    < 2.22e-16 ***
#> year.Q      -0.158190676  0.031750384   -4.98232 0.00000062825 ***
#> year.C      -0.097470279  0.031462320   -3.09800    0.00194831 ** 
#> year^4      -0.138041366  0.031282628   -4.41272 0.00001020817 ***
#> year^5      -0.009086991  0.031237449   -0.29090    0.77112738    
#> year^6       0.049991213  0.031092736    1.60781    0.10787678    
#> year^7      -0.038833115  0.030857266   -1.25848    0.20821983    
#> year^8       0.059640021  0.030709881    1.94205    0.05213146 .  
#> year^9      -0.024743805  0.030708151   -0.80577    0.42037363    
#> year^10      0.016476066  0.030781723    0.53525    0.59247365    
#> year^11      0.119592933  0.030868570    3.87426    0.00010695 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0362   Deviance explained = 2.05%
#> -REML = -19440  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.947212870e+4
#> 3 AIC           -3.891825739e+4
#> 4 BIC           -3.882753153e+4
#> 5 deviance       8.411778743e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -3.620918501e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.779644688e-1
#>  2 mean((Intercept)) -3.418001960e+0
#>  3 year.L             3.030943327e-1
#>  4 year.Q            -1.581906756e-1
#>  5 year.C            -9.747027879e-2
#>  6 year^4            -1.380413663e-1
#>  7 year^5            -9.086991047e-3
#>  8 year^6             4.999121349e-2
#>  9 year^7            -3.883311475e-2
#> 10 year^8             5.964002057e-2
#> 11 year^9            -2.474380508e-2
#> 12 year^10            1.647606597e-2
#> 13 year^11            1.195929332e-1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.906) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value    Pr(>|z|)    
#> (Intercept) -3.738960964  0.004992705 -748.88475  < 2.22e-16 ***
#> year.L       0.221077589  0.017235399   12.82695  < 2.22e-16 ***
#> year.Q       0.012081960  0.017484799    0.69100  0.48956685    
#> year.C      -0.082749263  0.017281986   -4.78818 0.000001683 ***
#> year^4      -0.215515173  0.017280621  -12.47149  < 2.22e-16 ***
#> year^5       0.039394268  0.017260073    2.28239  0.02246616 *  
#> year^6       0.069864307  0.017249593    4.05020 0.000051174 ***
#> year^7       0.059107063  0.017159763    3.44452  0.00057208 ***
#> year^8       0.075172297  0.017141556    4.38538 0.000011578 ***
#> year^9       0.007909703  0.017212102    0.45954  0.64584421    
#> year^10      0.017543664  0.017317823    1.01304  0.31104060    
#> year^11      0.008739832  0.017618222    0.49607  0.61984660    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00743   Deviance explained = 1.15%
#> -REML = -90886  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         9.092481949e+4
#> 3 AIC           -1.818236390e+5
#> 4 BIC           -1.817148921e+5
#> 5 deviance       3.487532075e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -7.427616944e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.938612265e-1
#>  2 mean((Intercept)) -3.738960964e+0
#>  3 year.L             2.210775893e-1
#>  4 year.Q             1.208195970e-2
#>  5 year.C            -8.274926344e-2
#>  6 year^4            -2.155151734e-1
#>  7 year^5             3.939426779e-2
#>  8 year^6             6.986430678e-2
#>  9 year^7             5.910706343e-2
#> 10 year^8             7.517229733e-2
#> 11 year^9             7.909702610e-3
#> 12 year^10            1.754366441e-2
#> 13 year^11            8.739831703e-3
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(87.973) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value      Pr(>|z|)    
#> (Intercept) -3.329260365  0.003776245 -881.63259    < 2.22e-16 ***
#> year.L      -0.066944070  0.013287304   -5.03820 0.00000046994 ***
#> year.Q      -0.119293498  0.013280073   -8.98289    < 2.22e-16 ***
#> year.C       0.021973098  0.013169676    1.66846     0.0952241 .  
#> year^4      -0.038821997  0.013191626   -2.94293     0.0032512 ** 
#> year^5      -0.020191074  0.013118969   -1.53907     0.1237860    
#> year^6       0.036234449  0.013094189    2.76722     0.0056537 ** 
#> year^7      -0.002668151  0.013035156   -0.20469     0.8378152    
#> year^8      -0.016756343  0.012982576   -1.29068     0.1968149    
#> year^9      -0.033482543  0.012924629   -2.59060     0.0095809 ** 
#> year^10      0.004664769  0.012853677    0.36291     0.7166697    
#> year^11      0.006941334  0.012948368    0.53608     0.5919047    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00809   Deviance explained = 0.688%
#> -REML = -53469  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       8.093105311e-3 very weak (negligible) cohen1988
#> 2 SE       1.251639090e-3 <NA>                   <NA>     
#> 3 Lower CI 5.639937773e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.054627285e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.351150485e+4
#> 3 AIC           -1.069970097e+5
#> 4 BIC           -1.068940554e+5
#> 5 deviance       2.017974368e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  8.093105311e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.964670326e-1
#>  2 mean((Intercept)) -3.329260365e+0
#>  3 year.L            -6.694406960e-2
#>  4 year.Q            -1.192934981e-1
#>  5 year.C             2.197309827e-2
#>  6 year^4            -3.882199701e-2
#>  7 year^5            -2.019107405e-2
#>  8 year^6             3.623444919e-2
#>  9 year^7            -2.668151440e-3
#> 10 year^8            -1.675634330e-2
#> 11 year^9            -3.348254256e-2
#> 12 year^10            4.664769297e-3
#> 13 year^11            6.941333709e-3
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(117.623) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -3.317347903  0.008989679 -369.01738 < 2.22e-16 ***
#> year.L      -0.100166486  0.031690452   -3.16078  0.0015735 ** 
#> year.Q      -0.093514337  0.031543235   -2.96464  0.0030304 ** 
#> year.C      -0.035982148  0.031531742   -1.14114  0.2538115    
#> year^4       0.006963582  0.031279783    0.22262  0.8238294    
#> year^5       0.058011246  0.031279652    1.85460  0.0636534 .  
#> year^6      -0.035862589  0.031206635   -1.14920  0.2504745    
#> year^7       0.048180826  0.030966098    1.55592  0.1197267    
#> year^8       0.036398244  0.030863216    1.17934  0.2382626    
#> year^9      -0.083403748  0.030898803   -2.69926  0.0069495 ** 
#> year^10      0.018230570  0.030806937    0.59177  0.5540057    
#> year^11      0.002568151  0.030463825    0.08430  0.9328166    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00546   Deviance explained = 1.33%
#> -REML = -7565.5  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name               value interpretation         rule     
#>   <chr>              <dbl> <chr>                  <chr>    
#> 1 R2        5.458795517e-3 very weak (negligible) cohen1988
#> 2 SE        2.788769371e-3 <NA>                   <NA>     
#> 3 Lower CI -7.092011279e-6 no effect              cohen1988
#> 4 Upper CI  1.092468305e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         7.597365316e+3
#> 3 AIC           -1.516873063e+4
#> 4 BIC           -1.509168480e+4
#> 5 deviance       2.718494668e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  5.458795517e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.913270493e-1
#>  2 mean((Intercept)) -3.317347903e+0
#>  3 year.L            -1.001664860e-1
#>  4 year.Q            -9.351433711e-2
#>  5 year.C            -3.598214764e-2
#>  6 year^4             6.963582014e-3
#>  7 year^5             5.801124577e-2
#>  8 year^6            -3.586258854e-2
#>  9 year^7             4.818082615e-2
#> 10 year^8             3.639824436e-2
#> 11 year^9            -8.340374788e-2
#> 12 year^10            1.823057012e-2
#> 13 year^11            2.568150652e-3
Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 225: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_5_by_misfs <-
  data |>
  gam_misfs(maper_mpepr ~ year)
data |>
  summarise_gam_misfs(maper_mpepr_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.539) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value             Pr(>|z|)    
#> (Intercept) -2.739534862  0.008193872 -334.33946           < 2.22e-16 ***
#> year.L       0.082363380  0.028987838    2.84131            0.0044929 ** 
#> year.Q      -0.220214939  0.028964569   -7.60291 0.000000000000028955 ***
#> year.C      -0.071155219  0.028714511   -2.47802            0.0132113 *  
#> year^4      -0.067622213  0.028554304   -2.36820            0.0178750 *  
#> year^5      -0.004810695  0.028628284   -0.16804            0.8665519    
#> year^6       0.061860888  0.028446118    2.17467            0.0296549 *  
#> year^7      -0.005878489  0.028196928   -0.20848            0.8348544    
#> year^8       0.094310981  0.027973611    3.37143            0.0007478 ***
#> year^9      -0.025048934  0.027892481   -0.89805            0.3691571    
#> year^10     -0.003939729  0.027970941   -0.14085            0.8879878    
#> year^11      0.038761967  0.027867424    1.39094            0.1642431    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0105   Deviance explained = 1.21%
#> -REML = -14639  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.467225123e+4
#> 3 AIC           -2.931850246e+4
#> 4 BIC           -2.922777659e+4
#> 5 deviance       8.012581771e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -1.046017779e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.384089887e-1
#>  2 mean((Intercept)) -2.739534862e+0
#>  3 year.L             8.236338037e-2
#>  4 year.Q            -2.202149387e-1
#>  5 year.C            -7.115521932e-2
#>  6 year^4            -6.762221310e-2
#>  7 year^5            -4.810694715e-3
#>  8 year^6             6.186088808e-2
#>  9 year^7            -5.878489484e-3
#> 10 year^8             9.431098100e-2
#> 11 year^9            -2.504893401e-2
#> 12 year^10           -3.939728953e-3
#> 13 year^11            3.876196677e-2
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.318) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value         Pr(>|z|)    
#> (Intercept) -3.124703269  0.004814081 -649.07572       < 2.22e-16 ***
#> year.L       0.100863495  0.016648945    6.05825 0.00000000137609 ***
#> year.Q      -0.028135499  0.016892394   -1.66557         0.095799 .  
#> year.C      -0.105013255  0.016687318   -6.29300 0.00000000031139 ***
#> year^4      -0.203844570  0.016660694  -12.23506       < 2.22e-16 ***
#> year^5       0.065707778  0.016659323    3.94420 0.00008006532378 ***
#> year^6       0.055786070  0.016640398    3.35245         0.000801 ***
#> year^7       0.079608090  0.016524969    4.81744 0.00000145409931 ***
#> year^8       0.099892126  0.016494522    6.05608 0.00000000139480 ***
#> year^9       0.003558448  0.016575211    0.21468         0.830013    
#> year^10      0.022954355  0.016691884    1.37518         0.169075    
#> year^11     -0.004565760  0.016959601   -0.26921         0.787765    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00293   Deviance explained = 0.958%
#> -REML = -69446  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.948485640e+4
#> 3 AIC           -1.389437128e+5
#> 4 BIC           -1.388349659e+5
#> 5 deviance       3.380460192e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.933590148e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.531576660e-1
#>  2 mean((Intercept)) -3.124703269e+0
#>  3 year.L             1.008634953e-1
#>  4 year.Q            -2.813549877e-2
#>  5 year.C            -1.050132546e-1
#>  6 year^4            -2.038445702e-1
#>  7 year^5             6.570777771e-2
#>  8 year^6             5.578607016e-2
#>  9 year^7             7.960808955e-2
#> 10 year^8             9.989212561e-2
#> 11 year^9             3.558447647e-3
#> 12 year^10            2.295435488e-2
#> 13 year^11           -4.565760076e-3
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(47.029) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value            Pr(>|z|)    
#> (Intercept) -2.63424132  0.00379491 -694.15115          < 2.22e-16 ***
#> year.L      -0.19388264  0.01331919  -14.55664          < 2.22e-16 ***
#> year.Q      -0.09853273  0.01329936   -7.40883 0.00000000000012742 ***
#> year.C       0.01465584  0.01319804    1.11046          0.26680250    
#> year^4      -0.02233616  0.01322368   -1.68910          0.09119974 .  
#> year^5       0.01495000  0.01321981    1.13088          0.25810634    
#> year^6       0.04709845  0.01317008    3.57617          0.00034866 ***
#> year^7       0.02894606  0.01313051    2.20449          0.02748996 *  
#> year^8       0.01641733  0.01305828    1.25724          0.20866850    
#> year^9      -0.02147188  0.01298240   -1.65392          0.09814339 .  
#> year^10     -0.02379351  0.01297583   -1.83368          0.06670170 .  
#> year^11      0.01030478  0.01302273    0.79129          0.42877386    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0206   Deviance explained = 1.49%
#> -REML = -40561  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.062532839e-2 weak                   cohen1988
#> 2 SE       1.972876581e-3 <NA>                   <NA>     
#> 3 Lower CI 1.675856135e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.449209544e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.060348116e+4
#> 3 AIC           -8.118096232e+4
#> 4 BIC           -8.107800807e+4
#> 5 deviance       1.989046593e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.062532839e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.384904811e-1
#>  2 mean((Intercept)) -2.634241318e+0
#>  3 year.L            -1.938826392e-1
#>  4 year.Q            -9.853273519e-2
#>  5 year.C             1.465584287e-2
#>  6 year^4            -2.233615566e-2
#>  7 year^5             1.494999766e-2
#>  8 year^6             4.709844919e-2
#>  9 year^7             2.894606344e-2
#> 10 year^8             1.641733306e-2
#> 11 year^9            -2.147187923e-2
#> 12 year^10           -2.379350694e-2
#> 13 year^11            1.030477466e-2
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(61.083) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value         Pr(>|z|)    
#> (Intercept) -2.684646160  0.009359123 -286.84803       < 2.22e-16 ***
#> year.L      -0.210167823  0.032975651   -6.37342 0.00000000018485 ***
#> year.Q      -0.092082220  0.032836320   -2.80428        0.0050429 ** 
#> year.C      -0.059427053  0.032764265   -1.81378        0.0697121 .  
#> year^4       0.003131789  0.032551557    0.09621        0.9233537    
#> year^5       0.064703168  0.032619275    1.98359        0.0473019 *  
#> year^6      -0.016697182  0.032525210   -0.51336        0.6076987    
#> year^7       0.064299439  0.032259521    1.99319        0.0462404 *  
#> year^8       0.050280508  0.032108191    1.56597        0.1173553    
#> year^9      -0.069140052  0.032116659   -2.15278        0.0313361 *  
#> year^10      0.014253882  0.032077071    0.44436        0.6567797    
#> year^11      0.011076706  0.031774920    0.34860        0.7273904    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0212   Deviance explained = 2.44%
#> -REML = -5871.2  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.117818155e-2 weak                   cohen1988
#> 2 SE       5.406166049e-3 <NA>                   <NA>     
#> 3 Lower CI 1.058229080e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.177407230e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.902573955e+3
#> 3 AIC           -1.177914791e+4
#> 4 BIC           -1.170210208e+4
#> 5 deviance       2.706397613e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.117818155e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.437012497e-1
#>  2 mean((Intercept)) -2.684646160e+0
#>  3 year.L            -2.101678227e-1
#>  4 year.Q            -9.208221998e-2
#>  5 year.C            -5.942705337e-2
#>  6 year^4             3.131789435e-3
#>  7 year^5             6.470316849e-2
#>  8 year^6            -1.669718212e-2
#>  9 year^7             6.429943875e-2
#> 10 year^8             5.028050845e-2
#> 11 year^9            -6.914005203e-2
#> 12 year^10            1.425388242e-2
#> 13 year^11            1.107670629e-2
Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 226: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By year (Unordered)

In this model, the year variable is treated as a unordered categorical variable.

Code
mbepr_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mbepr ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mbepr_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.537) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value             Pr(>|z|)    
#> (Intercept) -3.09424687  0.03427877 -90.26715           < 2.22e-16 ***
#> year2009     0.35266775  0.04594284   7.67623 0.000000000000016384 ***
#> year2010     0.37775186  0.04580514   8.24693           < 2.22e-16 ***
#> year2011     0.23380479  0.04645506   5.03292 0.000000483054025019 ***
#> year2012     0.17344883  0.04675819   3.70949           0.00020768 ***
#> year2013     0.32506147  0.04600019   7.06653 0.000000000001588614 ***
#> year2014     0.45806746  0.04531048  10.10953           < 2.22e-16 ***
#> year2015     0.34842813  0.04585668   7.59820 0.000000000000030028 ***
#> year2016     0.48081092  0.04530151  10.61357           < 2.22e-16 ***
#> year2017     0.35239697  0.04594416   7.67011 0.000000000000017184 ***
#> year2018     0.41602966  0.04561816   9.11983           < 2.22e-16 ***
#> year2019     0.40761286  0.04556986   8.94479           < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0203   Deviance explained = 2.47%
#> -REML = -14556  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.458696428e+4
#> 3 AIC           -2.914792856e+4
#> 4 BIC           -2.905720269e+4
#> 5 deviance       8.119205011e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -2.027317837e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]             6.931948588e-2
#>  2 mean((Intercept)) -3.094246867e+0
#>  3 year2009           3.526677517e-1
#>  4 year2010           3.777518618e-1
#>  5 year2011           2.338047861e-1
#>  6 year2012           1.734488271e-1
#>  7 year2013           3.250614706e-1
#>  8 year2014           4.580674583e-1
#>  9 year2015           3.484281296e-1
#> 10 year2016           4.808109223e-1
#> 11 year2017           3.523969699e-1
#> 12 year2018           4.160296607e-1
#> 13 year2019           4.076128594e-1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.507) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value          Pr(>|z|)    
#> (Intercept) -3.27874915  0.01784467 -183.73827        < 2.22e-16 ***
#> year2009     0.21482871  0.02452461    8.75972        < 2.22e-16 ***
#> year2010     0.24718735  0.02439970   10.13075        < 2.22e-16 ***
#> year2011     0.16598082  0.02461120    6.74412 0.000000000015396 ***
#> year2012     0.16136986  0.02463144    6.55138 0.000000000057009 ***
#> year2013     0.25333422  0.02467987   10.26481        < 2.22e-16 ***
#> year2014     0.29507924  0.02457929   12.00520        < 2.22e-16 ***
#> year2015     0.26164151  0.02452007   10.67050        < 2.22e-16 ***
#> year2016     0.29456981  0.02435031   12.09717        < 2.22e-16 ***
#> year2017     0.25769537  0.02443079   10.54797        < 2.22e-16 ***
#> year2018     0.21090578  0.02443018    8.63300        < 2.22e-16 ***
#> year2019     0.16330978  0.02446471    6.67532 0.000000000024669 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00456   Deviance explained = 0.764%
#> -REML = -68043  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.808076769e+4
#> 3 AIC           -1.361355354e+5
#> 4 BIC           -1.360267885e+5
#> 5 deviance       3.347652301e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -4.559784873e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -6.273722487e-2
#>  2 mean((Intercept)) -3.278749151e+0
#>  3 year2009           2.148287090e-1
#>  4 year2010           2.471873542e-1
#>  5 year2011           1.659808185e-1
#>  6 year2012           1.613698600e-1
#>  7 year2013           2.533342166e-1
#>  8 year2014           2.950792367e-1
#>  9 year2015           2.616415114e-1
#> 10 year2016           2.945698147e-1
#> 11 year2017           2.576953696e-1
#> 12 year2018           2.109057842e-1
#> 13 year2019           1.633097776e-1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(38.489) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.499558480  0.013918118 -179.59026 < 2.22e-16 ***
#> year2009     0.037046879  0.019339542    1.91560   0.055416 .  
#> year2010     0.008275972  0.019465924    0.42515   0.670726    
#> year2011    -0.049400274  0.019628098   -2.51681   0.011842 *  
#> year2012    -0.177700784  0.019984739   -8.89182 < 2.22e-16 ***
#> year2013    -0.126004996  0.019933730   -6.32119 2.5955e-10 ***
#> year2014    -0.096231615  0.019786308   -4.86355 1.1530e-06 ***
#> year2015    -0.202062015  0.020140317  -10.03271 < 2.22e-16 ***
#> year2016    -0.105372594  0.019764896   -5.33130 9.7512e-08 ***
#> year2017    -0.158609478  0.019990019   -7.93443 2.1146e-15 ***
#> year2018    -0.184771030  0.020194355   -9.14964 < 2.22e-16 ***
#> year2019    -0.163958341  0.020023947   -8.18811 2.6535e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0285   Deviance explained = 1.87%
#> -REML = -38671  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       2.851689999e-2 weak           cohen1988
#> 2 SE       2.301108092e-3 <NA>           <NA>     
#> 3 Lower CI 2.400681100e-2 weak           cohen1988
#> 4 Upper CI 3.302698897e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         3.871102690e+4
#> 3 AIC           -7.739605379e+4
#> 4 BIC           -7.729309954e+4
#> 5 deviance       1.976947966e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.851689999e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.098622298e-1
#>  2 mean((Intercept)) -2.499558480e+0
#>  3 year2009           3.704687858e-2
#>  4 year2010           8.275972023e-3
#>  5 year2011          -4.940027410e-2
#>  6 year2012          -1.777007842e-1
#>  7 year2013          -1.260049959e-1
#>  8 year2014          -9.623161496e-2
#>  9 year2015          -2.020620149e-1
#> 10 year2016          -1.053725942e-1
#> 11 year2017          -1.586094778e-1
#> 12 year2018          -1.847710302e-1
#> 13 year2019          -1.639583411e-1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(35.093) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value         Pr(>|z|)    
#> (Intercept) -2.08278548  0.03440989 -60.52869       < 2.22e-16 ***
#> year2009     0.03529121  0.04785209   0.73751       0.46081461    
#> year2010    -0.05957442  0.04833477  -1.23254       0.21774829    
#> year2011    -0.12840640  0.04889270  -2.62629       0.00863212 ** 
#> year2012    -0.32476414  0.05060426  -6.41772 0.00000000013833 ***
#> year2013    -0.16655027  0.04905061  -3.39548       0.00068509 ***
#> year2014    -0.12211249  0.04873553  -2.50562       0.01222385 *  
#> year2015    -0.32146788  0.05034339  -6.38550 0.00000000017083 ***
#> year2016    -0.27119000  0.05000667  -5.42308 0.00000005858187 ***
#> year2017    -0.28255052  0.05016444  -5.63249 0.00000001776299 ***
#> year2018    -0.29671761  0.05046571  -5.87959 0.00000000411288 ***
#> year2019    -0.28605072  0.05048667  -5.66587 0.00000001462836 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0455   Deviance explained = 5.16%
#> -REML = -4658.7  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.545270470e-2 weak           cohen1988
#> 2 SE       7.723581311e-3 <NA>           <NA>     
#> 3 Lower CI 3.031476350e-2 weak           cohen1988
#> 4 Upper CI 6.059064590e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.687741024e+3
#> 3 AIC           -9.349482048e+3
#> 4 BIC           -9.272436214e+3
#> 5 deviance       2.677966059e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  4.545270470e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.589065592e-1
#>  2 mean((Intercept)) -2.082785480e+0
#>  3 year2009           3.529121217e-2
#>  4 year2010          -5.957442142e-2
#>  5 year2011          -1.284064023e-1
#>  6 year2012          -3.247641446e-1
#>  7 year2013          -1.665502666e-1
#>  8 year2014          -1.221124850e-1
#>  9 year2015          -3.214678849e-1
#> 10 year2016          -2.711899981e-1
#> 11 year2017          -2.825505162e-1
#> 12 year2018          -2.967176079e-1
#> 13 year2019          -2.860507157e-1
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 227: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(beipr ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(beipr_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.127) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value             Pr(>|z|)    
#> (Intercept) -2.814996853  0.029385414 -95.79572           < 2.22e-16 ***
#> year2009     0.047204010  0.040554582   1.16396           0.24443923    
#> year2010     0.102321228  0.040240677   2.54273           0.01099898 *  
#> year2011     0.046227261  0.040502004   1.14136           0.25372123    
#> year2012    -0.009950727  0.040823058  -0.24375           0.80742243    
#> year2013     0.140876019  0.039977469   3.52389           0.00042527 ***
#> year2014     0.237032038  0.039429416   6.01155 0.000000001837540166 ***
#> year2015     0.265927609  0.039292365   6.76792 0.000000000013064633 ***
#> year2016     0.222930104  0.039596063   5.63011 0.000000018009694788 ***
#> year2017     0.256683443  0.039432108   6.50950 0.000000000075399663 ***
#> year2018     0.334969482  0.039014454   8.58578           < 2.22e-16 ***
#> year2019     0.291545019  0.039160268   7.44492 0.000000000000097004 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0299   Deviance explained = 2.71%
#> -REML = -14283  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.431571354e+4
#> 3 AIC           -2.860542709e+4
#> 4 BIC           -2.851470122e+4
#> 5 deviance       8.071957558e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -2.986476328e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -7.326928064e-2
#>  2 mean((Intercept)) -2.814996853e+0
#>  3 year2009           4.720401030e-2
#>  4 year2010           1.023212283e-1
#>  5 year2011           4.622726125e-2
#>  6 year2012          -9.950726588e-3
#>  7 year2013           1.408760186e-1
#>  8 year2014           2.370320376e-1
#>  9 year2015           2.659276085e-1
#> 10 year2016           2.229301040e-1
#> 11 year2017           2.566834431e-1
#> 12 year2018           3.349694817e-1
#> 13 year2019           2.915450188e-1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.666) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value            Pr(>|z|)    
#> (Intercept) -2.99950260  0.01547685 -193.80571          < 2.22e-16 ***
#> year2009     0.14475768  0.02124917    6.81239 0.00000000000959884 ***
#> year2010     0.19377589  0.02106989    9.19681          < 2.22e-16 ***
#> year2011     0.08340476  0.02140071    3.89729 0.00009727491473461 ***
#> year2012     0.03057329  0.02155042    1.41869             0.15599    
#> year2013     0.15642915  0.02142306    7.30191 0.00000000000028372 ***
#> year2014     0.15686446  0.02141386    7.32537 0.00000000000023824 ***
#> year2015     0.23925807  0.02107722   11.35150          < 2.22e-16 ***
#> year2016     0.19448747  0.02111164    9.21233          < 2.22e-16 ***
#> year2017     0.23472074  0.02100701   11.17345          < 2.22e-16 ***
#> year2018     0.20006704  0.02101582    9.51983          < 2.22e-16 ***
#> year2019     0.17884706  0.02101990    8.50846          < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0159   Deviance explained = 0.926%
#> -REML = -61292  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.133176478e+4
#> 3 AIC           -1.226375296e+5
#> 4 BIC           -1.225287827e+5
#> 5 deviance       3.310622465e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -1.591864228e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -9.885974847e-2
#>  2 mean((Intercept)) -2.999502603e+0
#>  3 year2009           1.447576844e-1
#>  4 year2010           1.937758873e-1
#>  5 year2011           8.340476459e-2
#>  6 year2012           3.057329042e-2
#>  7 year2013           1.564291540e-1
#>  8 year2014           1.568644566e-1
#>  9 year2015           2.392580691e-1
#> 10 year2016           1.944874677e-1
#> 11 year2017           2.347207432e-1
#> 12 year2018           2.000670429e-1
#> 13 year2019           1.788470608e-1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(72.251) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.38640477  0.01011229 -235.99050 < 2.22e-16 ***
#> year2009     0.01240122  0.01410606    0.87914    0.37932    
#> year2010    -0.05868963  0.01431967   -4.09853 4.1578e-05 ***
#> year2011    -0.10144465  0.01441618   -7.03686 1.9662e-12 ***
#> year2012    -0.20262047  0.01464463  -13.83582 < 2.22e-16 ***
#> year2013    -0.14515340  0.01457319   -9.96031 < 2.22e-16 ***
#> year2014    -0.15512159  0.01456849  -10.64775 < 2.22e-16 ***
#> year2015    -0.15588298  0.01455961  -10.70654 < 2.22e-16 ***
#> year2016    -0.18318271  0.01460994  -12.53822 < 2.22e-16 ***
#> year2017    -0.14812384  0.01453951  -10.18768 < 2.22e-16 ***
#> year2018    -0.11299046  0.01451904   -7.78223 7.1258e-15 ***
#> year2019    -0.13869570  0.01452353   -9.54972 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.036   Deviance explained = 2.34%
#> -REML = -42820  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.600156273e-2 weak           cohen1988
#> 2 SE       2.565592159e-3 <NA>           <NA>     
#> 3 Lower CI 3.097309450e-2 weak           cohen1988
#> 4 Upper CI 4.103003096e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.286366655e+4
#> 3 AIC           -8.570133310e+4
#> 4 BIC           -8.559837885e+4
#> 5 deviance       2.003054550e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  3.600156273e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.146590824e-1
#>  2 mean((Intercept)) -2.386404773e+0
#>  3 year2009           1.240121737e-2
#>  4 year2010          -5.868963325e-2
#>  5 year2011          -1.014446494e-1
#>  6 year2012          -2.026204683e-1
#>  7 year2013          -1.451534035e-1
#>  8 year2014          -1.551215863e-1
#>  9 year2015          -1.558829841e-1
#> 10 year2016          -1.831827111e-1
#> 11 year2017          -1.481238355e-1
#> 12 year2018          -1.129904588e-1
#> 13 year2019          -1.386957024e-1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(52.212) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value    Pr(>|z|)    
#> (Intercept) -1.86640997  0.02671057 -69.87533  < 2.22e-16 ***
#> year2009     0.08173551  0.03687128   2.21678  0.02663815 *  
#> year2010     0.04524564  0.03689117   1.22646  0.22002464    
#> year2011    -0.02904872  0.03733563  -0.77804  0.43654365    
#> year2012    -0.09208464  0.03773260  -2.44045  0.01466885 *  
#> year2013    -0.04816000  0.03733637  -1.28990  0.19708708    
#> year2014    -0.06393338  0.03747366  -1.70609  0.08799159 .  
#> year2015    -0.13017766  0.03781844  -3.44217  0.00057706 ***
#> year2016    -0.14931515  0.03802615  -3.92664 0.000086139 ***
#> year2017    -0.11293230  0.03782711  -2.98549  0.00283128 ** 
#> year2018    -0.10408259  0.03789251  -2.74679  0.00601826 ** 
#> year2019    -0.11058879  0.03801898  -2.90878  0.00362844 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0327   Deviance explained = 2.94%
#> -REML = -4686.6  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       3.271189059e-2 weak                   cohen1988
#> 2 SE       6.639724773e-3 <NA>                   <NA>     
#> 3 Lower CI 1.969826917e-2 very weak (negligible) cohen1988
#> 4 Upper CI 4.572551202e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.719121470e+3
#> 3 AIC           -9.412242941e+3
#> 4 BIC           -9.335197107e+3
#> 5 deviance       2.714505806e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  3.271189059e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.149793375e-1
#>  2 mean((Intercept)) -1.866409972e+0
#>  3 year2009           8.173551014e-2
#>  4 year2010           4.524564205e-2
#>  5 year2011          -2.904872441e-2
#>  6 year2012          -9.208463604e-2
#>  7 year2013          -4.816000369e-2
#>  8 year2014          -6.393338338e-2
#>  9 year2015          -1.301776573e-1
#> 10 year2016          -1.493151452e-1
#> 11 year2017          -1.129323015e-1
#> 12 year2018          -1.040825865e-1
#> 13 year2019          -1.105887918e-1
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 228: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mbepr_beipr ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mbepr_beipr_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(17.202) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value           Pr(>|z|)    
#> (Intercept) -2.08080565  0.02740893 -75.91707         < 2.22e-16 ***
#> year2009     0.19055073  0.03715369   5.12872 0.0000002917242204 ***
#> year2010     0.15908459  0.03728661   4.26653 0.0000198532878715 ***
#> year2011     0.07512878  0.03764546   1.99569           0.045967 *  
#> year2012     0.02408713  0.03790746   0.63542           0.525155    
#> year2013     0.15950743  0.03723322   4.28401 0.0000183555587381 ***
#> year2014     0.26091254  0.03673717   7.10214 0.0000000000012284 ***
#> year2015     0.17356083  0.03714285   4.67279 0.0000029713107767 ***
#> year2016     0.21454511  0.03703127   5.79362 0.0000000068885232 ***
#> year2017     0.16408621  0.03727622   4.40190 0.0000107306762664 ***
#> year2018     0.20961319  0.03705370   5.65701 0.0000000154032438 ***
#> year2019     0.20497947  0.03699936   5.54008 0.0000000302331853 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.011   Deviance explained = 1.35%
#> -REML = -9871.3  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         9.904385109e+3
#> 3 AIC           -1.978277022e+4
#> 4 BIC           -1.969204436e+4
#> 5 deviance       7.756093795e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -1.096589072e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.039580172e-2
#>  2 mean((Intercept)) -2.080805646e+0
#>  3 year2009           1.905507318e-1
#>  4 year2010           1.590845870e-1
#>  5 year2011           7.512878333e-2
#>  6 year2012           2.408713083e-2
#>  7 year2013           1.595074335e-1
#>  8 year2014           2.609125365e-1
#>  9 year2015           1.735608334e-1
#> 10 year2016           2.145451149e-1
#> 11 year2017           1.640862149e-1
#> 12 year2018           2.096131895e-1
#> 13 year2019           2.049794702e-1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.45) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.31712574  0.01459629 -158.74759 < 2.22e-16 ***
#> year2009     0.15600119  0.02000904    7.79654 6.3629e-15 ***
#> year2010     0.16915137  0.01992975    8.48738 < 2.22e-16 ***
#> year2011     0.07958637  0.02018918    3.94203 8.0795e-05 ***
#> year2012     0.03616871  0.02030823    1.78099   0.074914 .  
#> year2013     0.14323144  0.02023487    7.07845 1.4578e-12 ***
#> year2014     0.16235850  0.02017847    8.04612 8.5458e-16 ***
#> year2015     0.17061424  0.02004920    8.50978 < 2.22e-16 ***
#> year2016     0.13893044  0.02004608    6.93056 4.1919e-12 ***
#> year2017     0.14243165  0.02003915    7.10767 1.1802e-12 ***
#> year2018     0.10490315  0.02005155    5.23167 1.6798e-07 ***
#> year2019     0.08060366  0.02006139    4.01785 5.8731e-05 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00237   Deviance explained = 0.56%
#> -REML = -44228  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.426792248e+4
#> 3 AIC           -8.850984496e+4
#> 4 BIC           -8.840109809e+4
#> 5 deviance       3.182959169e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.365279760e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -7.776208614e-2
#>  2 mean((Intercept)) -2.317125744e+0
#>  3 year2009           1.560011856e-1
#>  4 year2010           1.691513728e-1
#>  5 year2011           7.958636876e-2
#>  6 year2012           3.616870712e-2
#>  7 year2013           1.432314421e-1
#>  8 year2014           1.623584957e-1
#>  9 year2015           1.706142407e-1
#> 10 year2016           1.389304403e-1
#> 11 year2017           1.424316464e-1
#> 12 year2018           1.049031496e-1
#> 13 year2019           8.060366089e-2
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(32.314) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value         Pr(>|z|)    
#> (Intercept) -1.62203590  0.01128229 -143.76834       < 2.22e-16 ***
#> year2009     0.01927930  0.01573038    1.22561       0.22034559    
#> year2010    -0.05501702  0.01593038   -3.45359       0.00055317 ***
#> year2011    -0.09989673  0.01601573   -6.23741 0.00000000044487 ***
#> year2012    -0.22444470  0.01626701  -13.79754       < 2.22e-16 ***
#> year2013    -0.19058010  0.01628383  -11.70364       < 2.22e-16 ***
#> year2014    -0.18134686  0.01622227  -11.17889       < 2.22e-16 ***
#> year2015    -0.24526825  0.01638007  -14.97358       < 2.22e-16 ***
#> year2016    -0.21094895  0.01625574  -12.97689       < 2.22e-16 ***
#> year2017    -0.21671607  0.01630568  -13.29084       < 2.22e-16 ***
#> year2018    -0.21346543  0.01638834  -13.02545       < 2.22e-16 ***
#> year2019    -0.21544144  0.01631477  -13.20530       < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0434   Deviance explained = 3.53%
#> -REML = -28928  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.335752981e-2 weak           cohen1988
#> 2 SE       2.794039468e-3 <NA>           <NA>     
#> 3 Lower CI 3.788131308e-2 weak           cohen1988
#> 4 Upper CI 4.883374654e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         2.897004590e+4
#> 3 AIC           -5.791409181e+4
#> 4 BIC           -5.781113756e+4
#> 5 deviance       1.982049212e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  4.335752981e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.879901788e-1
#>  2 mean((Intercept)) -1.622035897e+0
#>  3 year2009           1.927930472e-2
#>  4 year2010          -5.501702082e-2
#>  5 year2011          -9.989672552e-2
#>  6 year2012          -2.244446969e-1
#>  7 year2013          -1.905801023e-1
#>  8 year2014          -1.813468627e-1
#>  9 year2015          -2.452682543e-1
#> 10 year2016          -2.109489477e-1
#> 11 year2017          -2.167160681e-1
#> 12 year2018          -2.134654302e-1
#> 13 year2019          -2.154414446e-1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.343) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value          Pr(>|z|)    
#> (Intercept) -1.09220914  0.03064617 -35.63934        < 2.22e-16 ***
#> year2009     0.04616821  0.04265173   1.08245        0.27905426    
#> year2010    -0.03670936  0.04280411  -0.85761        0.39110617    
#> year2011    -0.11280096  0.04317714  -2.61252        0.00898785 ** 
#> year2012    -0.22979138  0.04380484  -5.24580 0.000000155606953 ***
#> year2013    -0.15380095  0.04325058  -3.55604        0.00037648 ***
#> year2014    -0.14568177  0.04325413  -3.36804        0.00075704 ***
#> year2015    -0.29194788  0.04397095  -6.63956 0.000000000031461 ***
#> year2016    -0.28216332  0.04400982  -6.41137 0.000000000144216 ***
#> year2017    -0.26159951  0.04393841  -5.95378 0.000000002620232 ***
#> year2018    -0.26558406  0.04410863  -6.02114 0.000000001731977 ***
#> year2019    -0.25983777  0.04417477  -5.88204 0.000000004052398 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0573   Deviance explained = 5.65%
#> -REML = -3039.2  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       5.729349284e-2 weak           cohen1988
#> 2 SE       8.563879749e-3 <NA>           <NA>     
#> 3 Lower CI 4.050859696e-2 weak           cohen1988
#> 4 Upper CI 7.407838871e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         3.069860234e+3
#> 3 AIC           -6.113720467e+3
#> 4 BIC           -6.036674633e+3
#> 5 deviance       2.685543298e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  5.729349284e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.571631576e-1
#>  2 mean((Intercept)) -1.092209142e+0
#>  3 year2009           4.616820983e-2
#>  4 year2010          -3.670936303e-2
#>  5 year2011          -1.128009579e-1
#>  6 year2012          -2.297913759e-1
#>  7 year2013          -1.538009465e-1
#>  8 year2014          -1.456817711e-1
#>  9 year2015          -2.919478833e-1
#> 10 year2016          -2.821633165e-1
#> 11 year2017          -2.615995078e-1
#> 12 year2018          -2.655840638e-1
#> 13 year2019          -2.598377727e-1
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 229: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(maper ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(maper_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.761) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value        Pr(>|z|)    
#> (Intercept) -3.69189376  0.03615554 -102.11142      < 2.22e-16 ***
#> year2009     0.09122742  0.04986873    1.82935      0.06734703 .  
#> year2010     0.22634146  0.04929874    4.59122 0.0000044065745 ***
#> year2011     0.14027588  0.04960297    2.82797      0.00468437 ** 
#> year2012     0.09591483  0.04979698    1.92612      0.05408972 .  
#> year2013     0.18389314  0.04940769    3.72195      0.00019769 ***
#> year2014     0.25367268  0.04906371    5.17027 0.0000002337548 ***
#> year2015     0.19574918  0.04932437    3.96861 0.0000722931747 ***
#> year2016     0.27178813  0.04910363    5.53499 0.0000000311244 ***
#> year2017     0.30595451  0.04897093    6.24768 0.0000000004166 ***
#> year2018     0.10464789  0.04979804    2.10145      0.03560184 *  
#> year2019     0.07242936  0.04981757    1.45389      0.14597627    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0079   Deviance explained = 0.957%
#> -REML = -20717  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         2.074635089e+4
#> 3 AIC           -4.146670177e+4
#> 4 BIC           -4.137597591e+4
#> 5 deviance       8.433850322e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -7.903895660e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.458332730e-1
#>  2 mean((Intercept)) -3.691893762e+0
#>  3 year2009           9.122742359e-2
#>  4 year2010           2.263414641e-1
#>  5 year2011           1.402758760e-1
#>  6 year2012           9.591483318e-2
#>  7 year2013           1.838931362e-1
#>  8 year2014           2.536726770e-1
#>  9 year2015           1.957491799e-1
#> 10 year2016           2.717881343e-1
#> 11 year2017           3.059545102e-1
#> 12 year2018           1.046478886e-1
#> 13 year2019           7.242936354e-2
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.009) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -4.05354613  0.01869655 -216.80719 < 2.22e-16 ***
#> year2009     0.09788021  0.02600527    3.76386 0.00016731 ***
#> year2010     0.12848812  0.02589950    4.96103 7.0122e-07 ***
#> year2011     0.04325298  0.02606435    1.65947 0.09702129 .  
#> year2012     0.04013462  0.02608028    1.53889 0.12383179    
#> year2013     0.12026109  0.02623224    4.58448 4.5512e-06 ***
#> year2014     0.13745562  0.02619691    5.24702 1.5458e-07 ***
#> year2015     0.14778681  0.02603662    5.67611 1.3779e-08 ***
#> year2016     0.20454883  0.02584291    7.91508 2.4709e-15 ***
#> year2017     0.25107458  0.02577241    9.74199 < 2.22e-16 ***
#> year2018     0.06605114  0.02593643    2.54666 0.01087608 *  
#> year2019     0.03303157  0.02591281    1.27472 0.20240838    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00248   Deviance explained = 0.544%
#> -REML = -1.0446e+05  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.044996352e+5
#> 3 AIC           -2.089732704e+5
#> 4 BIC           -2.088645236e+5
#> 5 deviance       3.427644493e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.481012795e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.319650464e-1
#>  2 mean((Intercept)) -4.053546129e+0
#>  3 year2009           9.788020571e-2
#>  4 year2010           1.284881180e-1
#>  5 year2011           4.325298314e-2
#>  6 year2012           4.013461922e-2
#>  7 year2013           1.202610933e-1
#>  8 year2014           1.374556199e-1
#>  9 year2015           1.477868125e-1
#> 10 year2016           2.045488276e-1
#> 11 year2017           2.510745771e-1
#> 12 year2018           6.605114196e-2
#> 13 year2019           3.303157362e-2
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(51.613) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value        Pr(>|z|)    
#> (Intercept) -3.408513575  0.016886593 -201.84732      < 2.22e-16 ***
#> year2009     0.042954427  0.023451102    1.83166      0.06700221 .  
#> year2010     0.096767078  0.023293388    4.15427 0.0000326324264 ***
#> year2011     0.078873109  0.023326080    3.38133      0.00072137 ***
#> year2012    -0.037792157  0.023661468   -1.59720      0.11022057    
#> year2013     0.088124473  0.023341460    3.77545      0.00015972 ***
#> year2014     0.045458354  0.023448534    1.93864      0.05254473 .  
#> year2015    -0.006662832  0.023624112   -0.28204      0.77791649    
#> year2016     0.053338508  0.023360606    2.28327      0.02241462 *  
#> year2017    -0.012634456  0.023649633   -0.53423      0.59317911    
#> year2018    -0.144093365  0.024273710   -5.93619 0.0000000029172 ***
#> year2019    -0.109638973  0.024029463   -4.56269 0.0000050502521 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0109   Deviance explained = 1.15%
#> -REML = -50952  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.094496673e-2 very weak (negligible) cohen1988
#> 2 SE       1.451370507e-3 <NA>                   <NA>     
#> 3 Lower CI 8.100332809e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.378960065e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.098980161e+4
#> 3 AIC           -1.019536032e+5
#> 4 BIC           -1.018506490e+5
#> 5 deviance       2.004505690e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  1.094496673e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.761516176e-1
#>  2 mean((Intercept)) -3.408513575e+0
#>  3 year2009           4.295442670e-2
#>  4 year2010           9.676707770e-2
#>  5 year2011           7.887310923e-2
#>  6 year2012          -3.779215735e-2
#>  7 year2013           8.812447254e-2
#>  8 year2014           4.545835361e-2
#>  9 year2015          -6.662831938e-3
#> 10 year2016           5.333850814e-2
#> 11 year2017          -1.263445648e-2
#> 12 year2018          -1.440933654e-1
#> 13 year2019          -1.096389733e-1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(84.23) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value    Pr(>|z|)    
#> (Intercept) -3.434525093  0.038704222 -88.73774  < 2.22e-16 ***
#> year2009     0.033982608  0.053795474   0.63170    0.527583    
#> year2010    -0.028244284  0.054120830  -0.52187    0.601758    
#> year2011    -0.096589965  0.054803074  -1.76249    0.077986 .  
#> year2012    -0.117281161  0.055012953  -2.13188    0.033016 *  
#> year2013     0.003471375  0.053644187   0.06471    0.948404    
#> year2014    -0.053131949  0.054252554  -0.97934    0.327410    
#> year2015    -0.065479155  0.054261095  -1.20674    0.227531    
#> year2016    -0.042010091  0.054142851  -0.77591    0.437801    
#> year2017    -0.095929383  0.054737443  -1.75254    0.079682 .  
#> year2018    -0.251238746  0.056535565  -4.44391 0.000008834 ***
#> year2019    -0.257736758  0.056737006  -4.54266 0.000005555 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0202   Deviance explained = 2.23%
#> -REML = -7542.3  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.021475971e-2 weak                   cohen1988
#> 2 SE       5.286966888e-3 <NA>                   <NA>     
#> 3 Lower CI 9.852495026e-3 very weak (negligible) cohen1988
#> 4 Upper CI 3.057702440e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         7.570286498e+3
#> 3 AIC           -1.511457300e+4
#> 4 BIC           -1.503752716e+4
#> 5 deviance       2.705752165e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.021475971e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -3.670593835e-1
#>  2 mean((Intercept)) -3.434525093e+0
#>  3 year2009           3.398260776e-2
#>  4 year2010          -2.824428363e-2
#>  5 year2011          -9.658996493e-2
#>  6 year2012          -1.172811614e-1
#>  7 year2013           3.471375496e-3
#>  8 year2014          -5.313194948e-2
#>  9 year2015          -6.547915534e-2
#> 10 year2016          -4.201009064e-2
#> 11 year2017          -9.592938260e-2
#> 12 year2018          -2.512387463e-1
#> 13 year2019          -2.577367577e-1
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 230: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mpepr ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mpepr_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(31.103) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value             Pr(>|z|)    
#> (Intercept) -3.62582314  0.03381049 -107.23960           < 2.22e-16 ***
#> year2009     0.03709332  0.04678136    0.79291           0.42783140    
#> year2010     0.19467109  0.04598557    4.23331 0.000023027810392995 ***
#> year2011     0.17097103  0.04605697    3.71216           0.00020549 ***
#> year2012     0.10822804  0.04638477    2.33327           0.01963416 *  
#> year2013     0.25702475  0.04560643    5.63571 0.000000017433585354 ***
#> year2014     0.16856564  0.04600552    3.66403           0.00024828 ***
#> year2015     0.34169192  0.04514264    7.56916 0.000000000000037564 ***
#> year2016     0.32731720  0.04530662    7.22449 0.000000000000502985 ***
#> year2017     0.39819008  0.04495368    8.85779           < 2.22e-16 ***
#> year2018     0.31330313  0.04537902    6.90414 0.000000000005050802 ***
#> year2019     0.17679795  0.04598024    3.84509           0.00012051 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0362   Deviance explained = 2.05%
#> -REML = -19442  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.947212870e+4
#> 3 AIC           -3.891825739e+4
#> 4 BIC           -3.882753153e+4
#> 5 deviance       8.411778743e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -3.620918501e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -9.433074914e-2
#>  2 mean((Intercept)) -3.625823139e+0
#>  3 year2009           3.709331543e-2
#>  4 year2010           1.946710948e-1
#>  5 year2011           1.709710272e-1
#>  6 year2012           1.082280369e-1
#>  7 year2013           2.570247511e-1
#>  8 year2014           1.685656423e-1
#>  9 year2015           3.416919159e-1
#> 10 year2016           3.273172011e-1
#> 11 year2017           3.981900819e-1
#> 12 year2018           3.133031313e-1
#> 13 year2019           1.767979519e-1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.906) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -3.87698948  0.01801987 -215.15081 < 2.22e-16 ***
#> year2009     0.10877974  0.02499283    4.35244 1.3463e-05 ***
#> year2010     0.15731129  0.02484095    6.33274 2.4084e-10 ***
#> year2011     0.08050945  0.02503152    3.21632  0.0012984 ** 
#> year2012     0.04868841  0.02510033    1.93975  0.0524099 .  
#> year2013     0.05472442  0.02534252    2.15939  0.0308198 *  
#> year2014     0.07020751  0.02530395    2.77457  0.0055275 ** 
#> year2015     0.14517931  0.02502139    5.80221 6.5447e-09 ***
#> year2016     0.25393209  0.02470121   10.28015 < 2.22e-16 ***
#> year2017     0.37762169  0.02444039   15.45073 < 2.22e-16 ***
#> year2018     0.20054394  0.02471163    8.11537 4.8433e-16 ***
#> year2019     0.15884431  0.02473039    6.42304 1.3358e-10 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00743   Deviance explained = 1.15%
#> -REML = -90887  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         9.092481949e+4
#> 3 AIC           -1.818236390e+5
#> 4 BIC           -1.817148921e+5
#> 5 deviance       3.487532075e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -7.427616944e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.850539438e-1
#>  2 mean((Intercept)) -3.876989476e+0
#>  3 year2009           1.087797385e-1
#>  4 year2010           1.573112884e-1
#>  5 year2011           8.050945306e-2
#>  6 year2012           4.868841168e-2
#>  7 year2013           5.472441806e-2
#>  8 year2014           7.020750818e-2
#>  9 year2015           1.451793123e-1
#> 10 year2016           2.539320903e-1
#> 11 year2017           3.776216889e-1
#> 12 year2018           2.005439360e-1
#> 13 year2019           1.588443050e-1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(87.973) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value       Pr(>|z|)    
#> (Intercept) -3.371412963  0.013565837 -248.52229     < 2.22e-16 ***
#> year2009     0.025612204  0.018876649    1.35682     0.17483858    
#> year2010     0.089615821  0.018687209    4.79557 0.000001622127 ***
#> year2011     0.094320584  0.018645222    5.05870 0.000000422124 ***
#> year2012     0.100801844  0.018552323    5.43338 0.000000055296 ***
#> year2013     0.073971800  0.018754045    3.94431 0.000080029524 ***
#> year2014     0.029271255  0.018869216    1.55127     0.12083690    
#> year2015     0.054841548  0.018767180    2.92221     0.00347563 ** 
#> year2016     0.070027834  0.018681384    3.74854     0.00017787 ***
#> year2017     0.019208516  0.018893706    1.01666     0.30931416    
#> year2018     0.001710287  0.019054804    0.08976     0.92848093    
#> year2019    -0.053550519  0.019166898   -2.79391     0.00520755 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00809   Deviance explained = 0.688%
#> -REML = -53470  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       8.093105311e-3 very weak (negligible) cohen1988
#> 2 SE       1.251639090e-3 <NA>                   <NA>     
#> 3 Lower CI 5.639937773e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.054627285e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.351150485e+4
#> 3 AIC           -1.069970097e+5
#> 4 BIC           -1.068940554e+5
#> 5 deviance       2.017974368e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  8.093105311e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.387984823e-1
#>  2 mean((Intercept)) -3.371412963e+0
#>  3 year2009           2.561220416e-2
#>  4 year2010           8.961582137e-2
#>  5 year2011           9.432058384e-2
#>  6 year2012           1.008018444e-1
#>  7 year2013           7.397179963e-2
#>  8 year2014           2.927125538e-2
#>  9 year2015           5.484154797e-2
#> 10 year2016           7.002783387e-2
#> 11 year2017           1.920851598e-2
#> 12 year2018           1.710287479e-3
#> 13 year2019          -5.355051889e-2
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(117.623) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value Pr(>|z|)    
#> (Intercept) -3.32141304  0.03214613 -103.32232  < 2e-16 ***
#> year2009     0.05759784  0.04445372    1.29568 0.195085    
#> year2010     0.05320486  0.04426187    1.20205 0.229345    
#> year2011    -0.06310094  0.04528226   -1.39350 0.163468    
#> year2012     0.03727906  0.04439777    0.83966 0.401099    
#> year2013     0.08400974  0.04387130    1.91491 0.055504 .  
#> year2014     0.02121784  0.04444479    0.47740 0.633079    
#> year2015     0.01473267  0.04441036    0.33174 0.740086    
#> year2016     0.03800192  0.04430125    0.85781 0.390999    
#> year2017    -0.02280729  0.04487438   -0.50825 0.611280    
#> year2018    -0.08232164  0.04555579   -1.80705 0.070754 .  
#> year2019    -0.08903243  0.04571826   -1.94742 0.051485 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00546   Deviance explained = 1.33%
#> -REML = -7566.8  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name               value interpretation         rule     
#>   <chr>              <dbl> <chr>                  <chr>    
#> 1 R2        5.458795517e-3 very weak (negligible) cohen1988
#> 2 SE        2.788769371e-3 <NA>                   <NA>     
#> 3 Lower CI -7.092011279e-6 no effect              cohen1988
#> 4 Upper CI  1.092468305e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         7.597365316e+3
#> 3 AIC           -1.516873063e+4
#> 4 BIC           -1.509168480e+4
#> 5 deviance       2.718494668e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  5.458795517e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.727192850e-1
#>  2 mean((Intercept)) -3.321413038e+0
#>  3 year2009           5.759784332e-2
#>  4 year2010           5.320485569e-2
#>  5 year2011          -6.310094150e-2
#>  6 year2012           3.727906148e-2
#>  7 year2013           8.400973673e-2
#>  8 year2014           2.121783840e-2
#>  9 year2015           1.473267072e-2
#> 10 year2016           3.800192006e-2
#> 11 year2017          -2.280729233e-2
#> 12 year2018          -8.232164491e-2
#> 13 year2019          -8.903242933e-2
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 231: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(maper_mpepr ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(maper_mpepr_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.539) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value        Pr(>|z|)    
#> (Intercept) -2.863762847  0.030416313 -94.15220      < 2.22e-16 ***
#> year2009     0.002530356  0.042231157   0.05992       0.9522219    
#> year2010     0.163563687  0.041353669   3.95524 0.0000764578584 ***
#> year2011     0.124535353  0.041518057   2.99955       0.0027038 ** 
#> year2012     0.107157267  0.041625158   2.57434       0.0100432 *  
#> year2013     0.200257644  0.041103161   4.87207 0.0000011043276 ***
#> year2014     0.163105950  0.041256803   3.95343 0.0000770382914 ***
#> year2015     0.188558211  0.041136809   4.58369 0.0000045685023 ***
#> year2016     0.213264848  0.041090556   5.19012 0.0000002101605 ***
#> year2017     0.237457486  0.040977146   5.79488 0.0000000068372 ***
#> year2018     0.084345817  0.041776517   2.01898       0.0434896 *  
#> year2019     0.005959200  0.042106384   0.14153       0.8874534    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0105   Deviance explained = 1.21%
#> -REML = -14641  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.467225123e+4
#> 3 AIC           -2.931850246e+4
#> 4 BIC           -2.922777659e+4
#> 5 deviance       8.012581771e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -1.046017779e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.144189191e-1
#>  2 mean((Intercept)) -2.863762847e+0
#>  3 year2009           2.530355910e-3
#>  4 year2010           1.635636871e-1
#>  5 year2011           1.245353533e-1
#>  6 year2012           1.071572667e-1
#>  7 year2013           2.002576435e-1
#>  8 year2014           1.631059500e-1
#>  9 year2015           1.885582114e-1
#> 10 year2016           2.132648477e-1
#> 11 year2017           2.374574859e-1
#> 12 year2018           8.434581664e-2
#> 13 year2019           5.959200495e-3
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.318) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value         Pr(>|z|)    
#> (Intercept) -3.22294516  0.01732431 -186.03595       < 2.22e-16 ***
#> year2009     0.11971504  0.02395965    4.99653 0.00000058372166 ***
#> year2010     0.15009620  0.02383549    6.29717 0.00000000030312 ***
#> year2011     0.03535440  0.02412842    1.46526         0.142850    
#> year2012     0.02856854  0.02415370    1.18278         0.236896    
#> year2013     0.03868681  0.02437592    1.58709         0.112492    
#> year2014     0.05914037  0.02432167    2.43159         0.015033 *  
#> year2015     0.09944464  0.02409824    4.12663 0.00003681107791 ***
#> year2016     0.20107932  0.02377157    8.45882       < 2.22e-16 ***
#> year2017     0.31640490  0.02350747   13.45976       < 2.22e-16 ***
#> year2018     0.08533299  0.02393219    3.56562         0.000363 ***
#> year2019     0.04507955  0.02395628    1.88174         0.059871 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00293   Deviance explained = 0.958%
#> -REML = -69447  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.948485640e+4
#> 3 AIC           -1.389437128e+5
#> 4 BIC           -1.388349659e+5
#> 5 deviance       3.380460192e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.933590148e-3
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -1.703368677e-1
#>  2 mean((Intercept)) -3.222945165e+0
#>  3 year2009           1.197150374e-1
#>  4 year2010           1.500961951e-1
#>  5 year2011           3.535439902e-2
#>  6 year2012           2.856854377e-2
#>  7 year2013           3.868681223e-2
#>  8 year2014           5.914036959e-2
#>  9 year2015           9.944464361e-2
#> 10 year2016           2.010793199e-1
#> 11 year2017           3.164048959e-1
#> 12 year2018           8.533298721e-2
#> 13 year2019           4.507954885e-2
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(47.029) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.60735423  0.01328347 -196.28559 < 2.22e-16 ***
#> year2009     0.02135162  0.01850311    1.15395 0.24852164    
#> year2010     0.04981589  0.01844381    2.70095 0.00691407 ** 
#> year2011     0.04486920  0.01843335    2.43413 0.01492754 *  
#> year2012     0.01463898  0.01845685    0.79315 0.42769265    
#> year2013     0.02003883  0.01855254    1.08011 0.28009207    
#> year2014    -0.03307472  0.01868558   -1.77007 0.07671606 .  
#> year2015    -0.04951833  0.01872640   -2.64431 0.00818587 ** 
#> year2016    -0.01531973  0.01857922   -0.82456 0.40962004    
#> year2017    -0.06723362  0.01878823   -3.57850 0.00034558 ***
#> year2018    -0.15569399  0.01919680   -8.11041 5.0449e-16 ***
#> year2019    -0.15251919  0.01909421   -7.98772 1.3746e-15 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0206   Deviance explained = 1.49%
#> -REML = -40563  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.062532839e-2 weak                   cohen1988
#> 2 SE       1.972876581e-3 <NA>                   <NA>     
#> 3 Lower CI 1.675856135e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.449209544e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.060348116e+4
#> 3 AIC           -8.118096232e+4
#> 4 BIC           -8.107800807e+4
#> 5 deviance       1.989046593e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.062532839e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.441666065e-1
#>  2 mean((Intercept)) -2.607354231e+0
#>  3 year2009           2.135162391e-2
#>  4 year2010           4.981589248e-2
#>  5 year2011           4.486920362e-2
#>  6 year2012           1.463898342e-2
#>  7 year2013           2.003882704e-2
#>  8 year2014          -3.307472484e-2
#>  9 year2015          -4.951833157e-2
#> 10 year2016          -1.531972766e-2
#> 11 year2017          -6.723361692e-2
#> 12 year2018          -1.556939854e-1
#> 13 year2019          -1.525191913e-1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(61.083) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value    Pr(>|z|)    
#> (Intercept) -2.62777080  0.03269868 -80.36322  < 2.22e-16 ***
#> year2009     0.03742959  0.04542070   0.82406    0.409903    
#> year2010     0.01671577  0.04535227   0.36858    0.712444    
#> year2011    -0.09893826  0.04632765  -2.13562    0.032710 *  
#> year2012    -0.02434035  0.04569124  -0.53271    0.594232    
#> year2013     0.02536456  0.04514336   0.56187    0.574207    
#> year2014    -0.04734035  0.04578803  -1.03390    0.301182    
#> year2015    -0.05697712  0.04577360  -1.24476    0.213220    
#> year2016    -0.03688130  0.04570034  -0.80702    0.419652    
#> year2017    -0.08763337  0.04617991  -1.89765    0.057742 .  
#> year2018    -0.20504775  0.04738514  -4.32726 0.000015098 ***
#> year2019    -0.20485571  0.04749209  -4.31347 0.000016071 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0212   Deviance explained = 2.44%
#> -REML = -5872.4  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.117818155e-2 weak                   cohen1988
#> 2 SE       5.406166049e-3 <NA>                   <NA>     
#> 3 Lower CI 1.058229080e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.177407230e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.902573955e+3
#> 3 AIC           -1.177914791e+4
#> 4 BIC           -1.170210208e+4
#> 5 deviance       2.706397613e+3
#> 6 df.residual    2.758000000e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.117818155e-2
#> 9 npar           1.2        e+1
#> 
#> # A tibble: 13 × 2
#>    name                        value
#>    <chr>                       <dbl>
#>  1 [Mean]            -2.758562571e-1
#>  2 mean((Intercept)) -2.627770803e+0
#>  3 year2009           3.742958826e-2
#>  4 year2010           1.671576674e-2
#>  5 year2011          -9.893825793e-2
#>  6 year2012          -2.434034555e-2
#>  7 year2013           2.536456418e-2
#>  8 year2014          -4.734034611e-2
#>  9 year2015          -5.697712363e-2
#> 10 year2016          -3.688129754e-2
#> 11 year2017          -8.763337466e-2
#> 12 year2018          -2.050477495e-1
#> 13 year2019          -2.048557068e-1
Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 232: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Testing the Hypothesis

The rationale behind the test can be found in the Methods section.

The hypothesis test was designed as follows:

\[ \begin{cases} \text{H}_{0}: \Delta \ \text{Adjusted} \ \text{R}^{2} \leq \text{MES} \quad \text{or} \quad \text{F-test is not significant} \ (\alpha \geq 0.05) \\ \text{H}_{a}: \Delta \ \text{Adjusted} \ \text{R}^{2} > \text{MES} \quad \text{and} \quad \text{F-test is significant} \ (\alpha < 0.05) \end{cases} \]

The restricted model is identical to the first model presented in this document, except for the exclusion of the SPEI variable: ~ te(gini_index, gdp_per_capita) + s(year) (Continuous year).

MBEPR & BEIPR – Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)

Code
mbepr_beipr_restricted <- mgcv::gam(
  mbepr_beipr ~ te(gini_index, gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_restricted |> summary()
#> 
#> Family: Beta regression(21.137) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.008473080  0.002583373 -777.4616 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> te(gini_index,gdp_per_capita) 19.151555 19.984101 14818.0796 < 2.22e-16 ***
#> s(year)                        8.604492  8.954247   644.6073 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.163   Deviance explained = 21.9%
#> -REML = -79093  Scale est. = 1         n = 57487
Code
adj_r_squared_restricted <-
  mbepr_beipr_restricted |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  )

adj_r_squared_restricted|> md_named_tibble()
Value Interpretation Rule
R2 0.1629686593 moderate cohen1988
SE 0.0026973501 NA NA
Lower CI 0.1576819503 moderate cohen1988
Upper CI 0.1682553683 moderate cohen1988
Code
mbepr_beipr_full <- mgcv::gam(
  mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_full |> summary()
#> 
#> Family: Beta regression(21.15) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.008487621  0.002582764 -777.6504 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df      Chi.sq     p-value
#> s(spei_12m)                    7.128848  8.202065    34.50121 0.000032104
#> te(gini_index,gdp_per_capita) 19.170675 19.998225 13833.01156  < 2.22e-16
#> s(year)                        8.629334  8.958357   543.76224  < 2.22e-16
#>                                  
#> s(spei_12m)                   ***
#> te(gini_index,gdp_per_capita) ***
#> s(year)                       ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.163   Deviance explained =   22%
#> -REML = -79097  Scale est. = 1         n = 57487
Code
adj_r_squared_full <-
  mbepr_beipr_full |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  )

adj_r_squared_full|> md_named_tibble()
Value Interpretation Rule
R2 0.1626124024 moderate cohen1988
SE 0.0026955040 NA NA
Lower CI 0.1573293116 moderate cohen1988
Upper CI 0.1678954933 moderate cohen1988
stats::anova(mbepr_beipr_restricted, mbepr_beipr_full, test = "F")
Code
effect_size <- cohens_f_squared_summary(
  adj_r_squared_restricted, 
  adj_r_squared_full
  )

effect_size |> list_as_tibble()

MAPER & MPEPR – Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)

Code
maper_mpepr_restricted <- mgcv::gam(
  maper_mpepr ~ te(gini_index, gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_restricted |> summary()
#> 
#> Family: Beta regression(27.019) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ te(gini_index, gdp_per_capita) + s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.945847077  0.003083574 -955.3353 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df    Chi.sq    p-value    
#> te(gini_index,gdp_per_capita) 18.626006 19.439367 14570.926 < 2.22e-16 ***
#> s(year)                        8.570873  8.946917  1232.193 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0568   Deviance explained = 22.7%
#> -REML = -1.19e+05  Scale est. = 1         n = 57487
Code
adj_r_squared_restricted <-
  maper_mpepr_restricted |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  )

adj_r_squared_restricted|> md_named_tibble()
Value Interpretation Rule
R2 0.0567917340 weak cohen1988
SE 0.0017942944 NA NA
Lower CI 0.0532749815 weak cohen1988
Upper CI 0.0603084865 weak cohen1988
Code
maper_mpepr_full <- mgcv::gam(
  maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_full |> summary()
#> 
#> Family: Beta regression(27.286) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + te(gini_index, gdp_per_capita) + 
#>     s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.947655546  0.003075965 -958.2864 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                                     edf    Ref.df     Chi.sq    p-value    
#> s(spei_12m)                    8.538532  8.941460   524.1370 < 2.22e-16 ***
#> te(gini_index,gdp_per_capita) 18.824892 19.596732 12360.7378 < 2.22e-16 ***
#> s(year)                        8.805392  8.988451   658.9538 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.059   Deviance explained = 23.5%
#> -REML = -1.1924e+05  Scale est. = 1         n = 57487
Code
adj_r_squared_full <-
  maper_mpepr_full |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  )

adj_r_squared_full|> md_named_tibble()
Value Interpretation Rule
R2 0.0589991868 weak cohen1988
SE 0.0018245243 NA NA
Lower CI 0.0554231850 weak cohen1988
Upper CI 0.0625751886 weak cohen1988
stats::anova(maper_mpepr_restricted, maper_mpepr_full, test = "F")
Code
effect_size <- cohens_f_squared_summary(
  adj_r_squared_restricted, 
  adj_r_squared_full
  )

effect_size |> list_as_tibble()

Conclusion

Does the Standardized Precipitation Evapotranspiration Index (SPEI) significantly improve the prediction of childhood undernutrition in Brazilian municipalities?

Our analysis show that the SPEI does not significantly improve the prediction of childhood undernutrition in Brazilian municipalities. The adjusted R-squared values indicate that the inclusion of the SPEI in the models does not significantly improve the prediction of the nutritional status of children under five years old in the municipalities.

Acknowledgments

This analysis is part of the Sustentarea Research and Extension Group’s project: Global syndemic: the impact of anthropogenic climate change on the health and nutrition of children under five years old attended by Brazil’s public health system (SUS).

This research was supported by the Conselho Nacional de Desenvolvimento Científico e Tecnológico - Brazil (CNPq).

How to Cite

To cite this work, please use the following format:

Magalhães, A. R., Vartanian, D, & Carvalho, A. M. (2025). Global syndemic project data analysis: Report 3: Exploring potential associations between childhood undernutrition and the Standardized Precipitation Evapotranspiration Index (SPEI) in Brazilian municipalities (2008–2019). Sustentarea Research and Extension Group at the University of São Paulo. https://sustentarea.github.io/gs-data-analysis-report-3

A BibTeX entry for LaTeX users is

@techreport{magalhaes2025,
  title = {Global syndemic project data analysis: Report 3: Exploring potential associations between childhood undernutrition and the Standardized Precipitation Evapotranspiration Index (SPEI) in Brazilian municipalities (2008–2019)},
  author = {{Arthur Ramalho Magalhães} and {Daniel Vartanian} and {Aline Martins de Carvalho}},
  year = {2025},
  address = {São Paulo},
  institution = {Sustentarea Research and Extension Group at the University of São Paulo},
  langid = {en},
  url = {https://sustentarea.github.io/gs-data-analysis-report-3}
}

References

Carvalho, A. M. de, Verly Jr, E., Marchioni, D. M., & Jones, A. D. (2021). Measuring sustainable food systems in Brazil: A framework and multidimensional index to evaluate socioeconomic, nutritional, and environmental aspects. World Development, 143, 105470. https://doi.org/10.1016/j.worlddev.2021.105470
Casella, G., & Berger, R. L. (2002). Statistical inference (2nd ed.). Duxbury.
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.
Ehrl, P. (2017). Minimum comparable areas for the period 1872-2010: An aggregation of Brazilian municipalities. Estudos Econômicos (São Paulo), 47, 215–229. https://doi.org/10.1590/0101-416147182phe
Fick, S. E., & Hijmans, R. J. (2017). WorldClim 2: New 1-km spatial resolution climate surfaces for global land areas. International Journal of Climatology, 37(12), 4302–4315. https://doi.org/10.1002/joc.5086
Food and Agriculture Organization of the United Nations, International Fund for Agricultural Development, Pan American Health Organization, United Nations Children’s Fund, & World Food Programme. (2025). Latin america and the Caribbean regional overview of food security and nutrition 2024 – Building resilience to climate variability and extremes for food security and nutrition (p. 250) [Regional Overview]. FAO; IFAD; PAHO; UNICEF; WFP; https://doi.org/10.4060/cd3877en
Harris, I., Osborn, T. J., Jones, P., & Lister, D. (2020). Version 4 of the CRU TS monthly high-resolution gridded multivariate climate dataset. Scientific Data, 7(1), 109. https://doi.org/10.1038/s41597-020-0453-3
Instituto Brasileiro de Geografia e Estatística. (n.d.-a). Tabela 155: Índice de Gini da renda das pessoas responsáveis pelos domicílios [Table]. SIDRA. Retrieved November 16, 2023, from https://sidra.ibge.gov.br/tabela/155
Instituto Brasileiro de Geografia e Estatística. (n.d.-b). Tabela 5938: Produto interno bruto a preços correntes, impostos, líquidos de subsídios, sobre produtos a preços correntes e valor adicionado bruto a preços correntes total e por atividade econômica, e respectivas participações - Referência 2010 [Table]. SIDRA. Retrieved November 16, 2023, from https://sidra.ibge.gov.br/tabela/5938
Instituto Brasileiro de Geografia e Estatística. (n.d.-c). Tabela 6579: População residente estimada [Table]. SIDRA. Retrieved November 16, 2023, from https://sidra.ibge.gov.br/Tabela/3939
Instituto Brasileiro de Geografia e Estatística, Instituto de Pesquisas Econômicas e Aplicadas, & Ministério da Saúde. (n.d.). Índice de Gini da renda domiciliar per capita segundo município – período: 1991, 2000 e 2010 [Table]. DATASUS - Tabnet. Retrieved November 16, 2023, from https://opendatasus.saude.gov.br/dataset/sisvan-estado-nutricional
Mehr, A. D., Sorman, A. U., Kahya, E., & Afshar, M. H. (2020). Climate change impacts on meteorological drought using SPI and SPEI: Case study of Ankara, Turkey. Hydrological Sciences Journal, 65(2). https://doi.org/10.1080/02626667.2019.1691218
Neyman, J., & Pearson, E. S. (1928a). On the use and interpretation of certain test criteria for purposes of statistical inference: Part I. Biometrika, 20A(1/2), 175–240. https://doi.org/10.2307/2331945
Neyman, J., & Pearson, E. S. (1928b). On the use and interpretation of certain test criteria for purposes of statistical inference: Part II. Biometrika, 20A(3/4), 263–294. https://doi.org/10.2307/2332112
Norde, M. M., Porciuncula, L., Garrido, G., Nunes-Galbes, N. M., Sarti, F. M., Marchioni, D. M. L., & de Carvalho, A. M. (2023). Measuring food systems sustainability in heterogenous countries: The Brazilian multidimensional index updated version applicability. Sustainable Development, 31(1), 91–107. https://doi.org/10.1002/sd.2376
Perezgonzalez, J. D. (2015). Fisher, Neyman-Pearson or NHST? A tutorial for teaching data testing. Frontiers in Psychology, 6. https://doi.org/10.3389/fpsyg.2015.00223
Popper, K. R. (1979). Objective knowledge: An evolutionary approach. Oxford University Press.
Posit Team. (n.d.). RStudio: Integrated development environment for R [Computer software]. Posit Software. http://www.posit.co
R Core Team. (n.d.). R: A language and environment for statistical computing [Computer software]. R Foundation for Statistical Computing. https://www.R-project.org
Sistema de Vigilância Alimentar e Nutricional. (n.d.). Estado nutricional [Table]. openDataSUS. Retrieved November 16, 2023, from https://opendatasus.saude.gov.br/dataset/sisvan-estado-nutricional
Vicente-Serrano, S. M., Beguería, S., & López-Moreno, J. I. (2010). A multiscalar drought index sensitive to global warming: The standardized precipitation evapotranspiration index. https://doi.org/10.1175/2009JCLI2909.1
Wickham, H., Çetinkaya-Rundel, M., & Grolemund, G. (2023). R for data science: Import, tidy, transform, visualize, and model data (2nd ed.). O’Reilly Media. https://r4ds.hadley.nz
Wilkinson, M. D., Dumontier, M., Aalbersberg, Ij. J., Appleton, G., Axton, M., Baak, A., Blomberg, N., Boiten, J.-W., Da Silva Santos, L. B., Bourne, P. E., Bouwman, J., Brookes, A. J., Clark, T., Crosas, M., Dillo, I., Dumon, O., Edmunds, S., Evelo, C. T., Finkers, R., … Mons, B. (2016). The FAIR guiding principles for scientific data management and stewardship. Scientific Data, 3(1), 160018. https://doi.org/10.1038/sdata.2016.18
Wood, S. (n.d.). Mgcv: Mixed GAM Computation Vehicle with Automatic Smoothness Estimation [Computer software]. https://doi.org/10.32614/CRAN.package.mgcv