+
+
+
+
+
+
Overview
+
+
This vignette shows an overview of the pipster
package
+functions for micro data. Microdata consist of detailed records of
+individual welfare measures, such as consumption, expenditure, or
+income, where each observation corresponds to a unique individual, and
+is accompanied by a sample weight that represents the individual’s
+proportion in the overall population. pipster
provides a
+series of functions to estimate poverty and inequality measures using
+microdata:
+
+
It also provides a series of functions to calculate distributional
+measures and to select and validate the best Lorenz curve for subsequent
+estimation:
+
+
+
+
Micro Data Sample
+
+
In this vignette, we will explore several typical scenarios in which
+the pipster package can be effectively utilized. In each of these
+scenario, we will use a sample dataset with 1000 observations,
+pip_md
, available with this package. The variables are the
+following:
+
+-
+welfare: welfare (income or consumption)
+-
+weight: population weights.
+
+
+
+
Case 1: Simple Welfare Analysis and Lorenz Curve
+
+
+
1.1 Welfare share at a given population share
+
+
+# Calculate the welfare share at a given population share
+selected_popshare <- 0.5
+welfare_share_50 <- pipmd_welfare_share_at(welfare = pip_md$welfare,
+ weight = pip_md$weight,
+ n = 1,
+ popshare = selected_popshare)
+#> Warning: replacing previous import 'collapse::fdroplevels' by
+#> 'data.table::fdroplevels' when loading 'wbpip'
+
When complete = FALSE
, the output is a list. The results
+can be accessed like so:
+
+# Format the string with the given values
+formatted_message <- sprintf("%.0f%% of the population owns %.0f%% of welfare.",
+ selected_popshare * 100,
+ welfare_share_50$dist_stats$welfare_share_at[[1]] * 100)
+
+print(formatted_message)
+#> character(0)
+
+
+