[R-sig-Geo] Calculating median age for a group of US census blocks?
Kevin Zembower
kev|n @end|ng |rom zembower@org
Mon Aug 7 21:00:38 CEST 2023
Josiah, thanks for your reply.
Regarding my objective, I'm trying to compile census statistics for the
blocks that make up the neighborhood where I live. It consists of ten
census blocks, of which I selected three for simplicity in my example.
The census block-group which contains these ten blocks also contains
some blocks which are outside of my neighborhood and shouldn't be
counted or included.
Since I won't be able to calculate the median age from the age and count
data, and since the individual data doesn't seem to be available, is it
your thought that I can't produce a valid median age for a group of
census blocks?
Thanks so much for your advice.
-Kevin
On 8/7/23 14:38, Josiah Parry wrote:
> Hey Kevin, I don't think you're going to be able to get individual level
> data from the US Census Bureau. The closest you may be able to get is
> the current population survey (CPS) which I believe is also available
> via tidycensus. Regarding your first question, I'm not sure I follow
> what your objective is with it. I would use a geography of census block
> groups as the measure of median for census block groups. Otherwise it is
> unclear how you are defining what a "group of blocks" is.
>
> On Mon, Aug 7, 2023 at 2:34 PM Kevin Zembower via R-sig-Geo
> <r-sig-geo using r-project.org <mailto:r-sig-geo using r-project.org>> wrote:
>
> Hello, all,
>
> I'd like to obtain the median age for a population in a specific group
> of US Decennial census blocks. Here's an example of the problem:
>
> ## Example of calculating median age of population in census blocks.
> library(tidyverse)
> library(tidycensus)
>
> counts <- get_decennial(
> geography = "block",
> state = "MD",
> county = "Baltimore city",
> table = "P1",
> year = 2020,
> sumfile = "dhc") %>%
> mutate(NAME = NULL) %>%
> filter(substr(GEOID, 6, 11) == "271101" &
> substr(GEOID, 12, 15) %in% c(3000, 3001, 3002)
> )
>
> ages <- get_decennial(
> geography = "block",
> state = "MD",
> county = "Baltimore city",
> table = "P13",
> year = 2020,
> sumfile = "dhc") %>%
> mutate(NAME = NULL) %>%
> filter(substr(GEOID, 6, 11) == "271101" &
> substr(GEOID, 12, 15) %in% c(3000, 3001, 3002)
> )
>
> I have two questions:
>
> 1. Is it mathematically valid to multiply the population of a block by
> the median age of that block (in other words, assign the median age to
> each member of a block), then calculate the median of those numbers for
> a group of blocks?
>
> 2. Is raw data on the ages of individuals available anywhere else in
> the
> census data? I can find tables such as P12, that breaks down the
> population by age ranges or bins, but can't find specific data of
> counts
> per age in years.
>
> Thanks for your advice and help.
>
> -Kevin
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org <mailto:R-sig-Geo using r-project.org>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> <https://stat.ethz.ch/mailman/listinfo/r-sig-geo>
>
More information about the R-sig-Geo
mailing list