Description Usage Arguments Value Examples
zscores
calculates standardized scores or z-scores, with a mean close to zero and standard deviation (sd)
close to one, for the variable given in variable
.
The standardization uses a population weighted mean and standard deviation, which are calculated based on the
population distribution given by population
.
1 | zscore(population, variable)
|
population |
Population counts. |
variable |
Continuous deprivation measure, such as a percentage, to calculate the z-scores for. |
A list including the following:
z.score |
standardized score using weighted mean and sd |
w.mean |
weighted mean |
w.sd |
weighted standard deviation |
weight |
population weight |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | data <- dep_data
# store all results in object z_oc
z_oc <- zscore(data$total_pop, data$pcnt_overcrowding)
# extract z-score
data$z_overcrowd <- z_oc$z.score
mean(data$z_overcrowd) # mean of z-score
sd(data$z_overcrowd) # sd z-score
# extract weighted mean and sd, compare weighted values to unweighted values
mean(data$pcnt_overcrowding)
z_oc$w.mean
sd(data$pcnt_overcrowding)
z_oc$w.sd
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.