Installation | Syntax | Citation guidelines | Examples | Feedback
17/09/2024
ftarifa is a Stata package developed by the National Superintendence of Sanitation Services (SUNASS) from Peru for tariff calculation in the water and sanitation sector. The package includes subcommands that allow for tariff calculation based on different user categories and consumption levels, facilitating tariff determination for both regulators and service providers more efficiently and in compliance with regulatory frameworks. ftarifa offers significant advantages to academics, analysts, and professionals in the sector, such as reducing time spent on data management and programming while ensuring a more detailed and transparent tariff analysis.
ftarifa is installed via GitHub, so any Stata user can make use of this package. The code below details the commands to run in Stata to obtain the latest version of ftarifa.
net install ftarifa, from("https://raw.github.com/SUNASS/ftarifa/main/installation/") replace
The syntax for the latest version is as follows:
ftarifa varname1 [, tarifa1(numlist) quiebre1(numlist) ... tarifa10(numlist) quiebre10(numlist) generate(varname2) categoria(varname3)]
Software packages take countless hours of programming, testing, and bug fixing. If you use this package, then a citation would be highly appreciated. Suggested citations:
in BibTeX
@software{ftarifa,
author = {SUNASS},
title = {Stata package ``ftarifa''},
url = {https://github.com/SUNASS/ftarifa},
version = {0.1},
date = {2024-09-11}
}
or simple text
SUNAS (2024). Stata package "ftarifa" version 0.1. Release date 11 September 2024. https://github.com/SUNASS/ftarifa.
To provide a general example of aplication of ftarifa, here we first create a ficticious database of consumption of drinking water. This dataset contains 10,000 obervations of consumption divided in six categories, "Social", "Subsidized domestic", "Non-subsidized domestic", "Comercial", "Industrial" and "State". Each of these categories has specific tariff which applie. These are presented in the following table:
clear
set obs 10000
gen volfac = round(rgamma(1, 100), .01)
sort volfac
gen random_norm = normal(invnorm(runiform()))
egen temp = xtile(random_norm), nq(6)
gen codcat = 100 + temp
drop random_norm temp
gen nomcat = ""
replace nomcat = "SOCIAL" if codcat == 101
replace nomcat = "DOMÉSTICO BENEFICIARIO" if codcat == 102
replace nomcat = "DOMÉSTICO NO BENEFICIARIO" if codcat == 103
replace nomcat = "COMERCIAL Y OTROS" if codcat == 104
replace nomcat = "INDUSTRIAL" if codcat == 105
replace nomcat = "ESTATAL" if codcat == 106
tostring codcat, replace
gen categoria = .
replace categoria = 1 if nomcat == "SOCIAL"
replace categoria = 2 if nomcat == "DOMÉSTICO BENEFICIARIO"
replace categoria = 3 if nomcat == "DOMÉSTICO NO BENEFICIARIO"
replace categoria = 4 if nomcat == "COMERCIAL Y OTROS"
replace categoria = 5 if nomcat == "INDUSTRIAL"
replace categoria = 6 if nomcat == "ESTATAL"
//Teniendo las variables 'volfac' y 'categoria' definidas
//APLICAMOS LA FORMULA PARA CALCULAR TARIFAS PARA SEDAPAR
ftarifa volfac, tarifa1(1.7) quiebre1() tarifa2(1.7 1.9 2.9 7.3) quiebre2(10 20 50) tarifa3(2 2.9 7.3) quiebre3(20 50) tarifa4(1000) quiebre4(7.3 7.9) tarifa5(7.9) quiebre5() tarifa6(7.9) quiebre6()generate(imagua) categoria(categoria)
save tarifa_sedapal, replace
Please open an issue to report errors, feature enhancements, and/or other requests.