p2distance: Welfare's synthetic indicator (P2 distance)

p2distanceR Documentation

Welfare's synthetic indicator (P2 distance)

Description

Calculates the P_2 distance synthetic indicator for a set of variables. This is the main function of the package.

Usage

p2distance(
  matriz,
  reference_vector = NULL,
  reference_vector_function = min,
  iterations = 20,
  umbral = 1e-04
)

Arguments

matriz

A matrix with spatial entities in rows and variables in columns.

reference_vector

Optional. A reference vector defined for each partial indicator, used to compare different spatial entities.

reference_vector_function

Optional. Function used to build the reference vector when reference_vector is not supplied. min is the default; other common choices are max, mean, median, etc. See makeReferenceVector() for details.

iterations

Maximum number of iterations for the computational process until convergence is reached.

umbral

The algorithm stops when the difference between two consecutive iterations is lower than this threshold.

Details

The P_2 distance, also called DP2, is used to measure welfare in quality-of-life applications, to build environmental quality indexes, and more generally to aggregate multiple partial indicators (variables) into a single measure that allows spatial entities to be compared. For a spatial entity r, the P_2 distance is defined as:

DP_{2}=\sum^{n}_{i=1}\left\lbrace\left(\frac{d_{i}}{\sigma_{i}}\right)\left(1-R^{2}_{i,i-1,i-2,\ldots,1}\right)\right\rbrace

with R^{2}_{1}=0, where d_{i}=|x_{ri}-x_{*i}|, with the reference base X_{*}=(x_{*1},x_{*2},\ldots,x_{*n}), and:

  • n is the number of variables

  • x_{ri} is the value of variable i for spatial entity r

  • \sigma_{i} is the standard deviation of variable i

  • R^{2}_{i,i-1,\ldots,1} is the coefficient of determination of the regression of X_i on X_{i-1}, X_{i-2}, \ldots, X_1 already included

The numerical value of the DP2 index has no meaning by itself, but it is useful for comparing the state of different spatial entities in terms of welfare, environmental conditions, etc.

Value

A list with the following elements:

  • discrimination.coefficient: Vector of discrimination coefficients (DC) for each variable (Ivanovic, 1974). DC ranges between 0 and 2: a variable with the same value for every spatial entity has DC = 0 (no discriminant power), while a variable with a single non-zero value has DC = 2 (full discriminant power). See Zarzosa (1996) and Zarzosa & Somarriba (2012).

  • p2distance: Vector with the final P_2 distance value for each spatial entity.

  • p2distances: Matrix with the P_2 distance values resulting from each iteration.

  • diff_p2distances: Matrix with the differences between two consecutive P_2 distances.

  • iteration: Number of iterations performed.

  • umbral: Threshold used to stop the iterations.

  • variables_sort: Variable names ordered by entrance order in the last iteration.

  • correction_factors: Correction factor for each variable.

  • cor.coeff: Correlation coefficient of each variable with the calculated P_2 distance.

  • partial.Indicators: For each spatial entity, the difference between the reference vector and the value of each variable, divided by the standard deviation. The sum of all partial indicators for a spatial entity is the Frechet Distance (DF), the maximum value the P_2 distance can reach.

References

Ivanovic, B. (1974). Comment établir une liste des indicateurs de developpment. Revue de Statistique Appliquée, 22(2), 37-50.

Montero, J. M., Chasco, C., & Larraz, B. (2010). Building an environmental quality index for a big city: a spatial interpolation approach combined with a distance indicator. Journal of Geographical Systems, 12, 435-459.

Peña, J. B. (1977). Problemas de la medición del bienestar y conceptos afines (una aplicación al caso Español). Madrid: INE.

Peña, J. B. (2009). La medición del bienestar social: una revisión crítica. Estudios de Economía Aplicada, 27(2), 299-324.

Zarzosa, P. (1996). Aproximación a la medición del Bienestar social. Valladolid: Universidad de Valladolid.

Zarzosa, P., & Somarriba, N. (2012). An assessment of social welfare in Spain: Territorial analysis using a synthetic welfare indicator. Social Indicators Research. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11205-012-0005-0")}

See Also

makeReferenceVector(), loadCSVtoP2distance()

Examples

## Calculate a welfare indicator for 27 European countries
data(welfare)
welfare <- as.matrix(welfare)

ind <- p2distance(welfare, reference_vector_function = min, iterations = 20)

## Examine the results
ind$p2distance
ind$iteration
ind$variables_sort
ind$correction_factors
ind$cor.coeff
ind$discrimination.coefficient

## Plot of the P2 distance indicator for European countries
barplot(ind$p2distance, beside = TRUE, col = "white", space = .3,
  ylab = "P2 distance", ylim = c(0, 20),
  names.arg = rownames(ind$p2distance), las = 3, cex.names = 0.8)


p2distance documentation built on Sept. 15, 2026, 5:07 p.m.