sd2 (x, is.sample = TRUE, weighting = NULL, wmean = FALSE, na.rm = FALSE)
numeric
vector
is.sample = TRUE
, so the denominator of variance is \(n-1\))
numeric
vector containing weighting data to compute the weighted standard deviation (instead of the non-weighted sd)
weighting
is specified, the function returns a weighted standard deviation (optionally using a weighted arithmetic mean if wmean = TRUE
).sd
function, the sd2
function allows to choose if the data is treated as sample (denominator of variance is \(n-1\))) or not (denominator of variance is \(n\))) From a regional economic perspective, the sd is closely linked to the concept of sigma convergence (\(\sigma\)) which means a harmonization of regional economic output or income over time, while the other type of convergence, beta convergence (\(\beta\)), means a decline of dispersion because poor regions have a stronger growth than rich regions (Capello/Nijkamp 2009). The sd allows to summarize regional disparities (e.g. disparities in regional GDP per capita) in one indicator. The coefficient of variation (see the function cv
) is more frequently used for this purpose (e.g. Lessmann 2005, Huang/Leung 2009, Siljak 2015). But the sd can also be used for any other types of disparities or dispersion, such as disparities in supply (e.g. density of physicians or grocery stores). The standard deviation can be weighted by using a second weighting vector. As there is more than one way to weight measures of statistical dispersion, this function uses the formula for the weighted sd (\(\sigma_w\)) from Sheret (1984). The vector x
is automatically treated as a sample (such as in the base sd
function), so the denominator of variance is \(n-1\), if it is not, set is.sample = FALSE
.gini
, herf
, hoover
, rca
# Regional disparities / sigma convergence in Germany
data(gdppc)
# GDP per capita for German counties (Landkreise)
sd_gdppc <- apply (gdppc[3:17], MARGIN = 2, FUN = sd)
# Calculating standard deviation for the years 2000-2014
years <- 2000:2014
# vector of years (2000-2014)
plot(years, sd_gdppc, "l", ylim = c(0,15000), xlab = "Year",
ylab = "SD of GDP per capita")
# Plot sd over time
Run the code above in your browser using DataLab