Analysis of the Health Expenditure in Brazilian Municipalities

Citation Author(s):
Marcos
DAngelo
UNIMONTES
Submitted by:
Marcos DAngelo
Last updated:
Sat, 03/09/2024 - 06:24
DOI:
10.21227/zkp4-qj63
Data Format:
License:
168 Views
Categories:
Keywords:
0
0 ratings - Please login to submit your rating.

Abstract 

This study analyzes the spending of Brazilian municipalities on health using an approach based on computational intelligence. The study was characterized by a quantitative and documentary database, and 117 municipalities with an average population between 2004 and 2019 of more than 100,000 inhabitants were analyzed. The data was obtained from the Brazilian Finance database (Finbra) (National Treasury Secretariat) and processed and adjusted for inflation. The main technique used was cluster analysis via R software, version 3.3.3. When comparing general health expenditures with hospital care and expenditure by government function, it was evident that there is a correlation between these variables, while none was found between primary care and general expenditures and expenses by government function. Spending by government function and hospital care allows us to infer that there is a moderate influence of these on the former, but that there is none on primary care, despite the outliers. However, the cluster analysis provides different results, which might indicate disparities in expenditure when considering economic particularities of each municipality. It is concluded that computational intelligencein health management can be combined with control and transparency in the distribution ofresources in Brazilian municipalities. It is noteworthy that the management of health resources in Brazil is always analyzed in isolation for each municipality, while in the present work the grouping technique was used in order to support public managers in the decision-making process aimed at better development of public policies in the health area. 

Instructions: 

 

# *****************************************************************

#   Instructions for Usage and Initial Configuration

#

# Choose which columns you want to use for grouping using the 'vector' 'quais' below... 

# it is currently configured to group using variables 1 and 3. Change these values as an 

example by setting the values quais = c(1, 2, 3), it will use variables 1, 2, and 3.

#

# Modify the following file to change the output file name:

#

# nomeArquivoSaida = "Cluster_Result.txt"

#

# Ensure that the data file is in CSV format and named 'Data.csv'. To execute the 

# entire code, press the keys CTRL + A and then click '-> Run'.

# ****************************************************************

 

 

 

 

# import the libraries

library(tidyverse)  # data manipulation

library(cluster)    # clustering algorithms

library(factoextra) # clustering algorithms & visualization

library(purrr)

 

#import the data and rename the columns and rows

Otil <- read.csv("Dados.csv")

Dados = Otil[,2:5];

rownames(Dados) <- t(Otil$Municipio);

 

#normalize the data

Dados = scale(Dados)

 

 

#*****************************************************************

# Important functions:

# Estimate the number of clusters using Silhouette

# Function to compute the average silhouette for k clusters

avg_sil <- function(k) {

  km.res <- kmeans(Dados[, quais], centers = k, nstart = 25)

  ss <- silhouette(km.res$cluster, dist(Dados[,quais]))

  mean(ss[, 3])

}

#Define the function that performs silhouette analysis.

rodarSilhueete <- function(){

  #SETs  -  # Escolhe os valores de k (centros que se quer testar ...)

  k.values <- 2:10

  

  # extract avg silhouette for 2-15 clusters

  avg_sil_values <- map(k.values, avg_sil)

  

  plot(k.values, avg_sil_values,

       type = "b", pch = 19, frame = FALSE, 

       xlab = "Number of clusters K",

       ylab = "Average Silhouettes")

  

  x = avg_sil_values

  a = as.matrix(x)

  return(which.max(x))

  

}

 

# kmeans **************************************************

  rodarKmeans <- function(quantosGrupos, arquivoSaida){

  katual <- kmeans(Dados[,quais], centers = quantosGrupos, nstart = 25)

  Gatual = as.data.frame(katual$cluster)

  write.table(Gatual, file= arquivoSaida, row.names = TRUE)

  #descomente a linha abaixo se precisar ver os clusters

  #fviz_cluster(katual, data = Dados[,quais])

  return (katual)

}

 

# Main code

# Execute the silhouette function

qtGrupo = rodarSilhueete()

 

## SETs - Run the kmeans

# The first parameter is k = the best number of clusters found by silhouette (see the adjacent graph)

# Then choose the name of the .txt file where you want to save the clustering data

grupos <- rodarKmeans(qtGrupo+1, nomeArquivoSaida)

 

Comments

Data set

Submitted by Marcos DAngelo on Sat, 03/09/2024 - 06:25