mverma29 / MeganVermaMsc

0 stars 0 forks source link

Weighting when moving to subregion #33

Closed samclifford closed 2 years ago

samclifford commented 2 years ago

https://github.com/samclifford/MeganVermaMsc/blob/6e98e78cb50fad0a9a3b493f87f7845eec2c95f8/mscprojectscript_03_explore_data.R#L92

You probably need to look at the national population rather than the study size, as if we have lots of studies from a small country then that won't be as representative of the entire subregion.

samclifford commented 2 years ago

The wpp2019 package should be enough here

mverma29 commented 2 years ago

what year should i draw the population from, given that we're summarizing here? just the most recent but for the entire subregions?

samclifford commented 2 years ago

Using each country's most recent is probably the best approach. I think wpp2019 has 2020 data in it.

mverma29 commented 2 years ago

so i should first get a weighted average for each country based on total tested in each country (over the studies), then take the country weighted average to the subregions, where i will be weighting by total pop?

samclifford commented 2 years ago

Use the country level weighted averages that are already calculated. Merge with the country's latest population from wpp2019 (or WDI if necessary). Group by UN subregion and calculate weighted means.

mverma29 commented 2 years ago

fixed in e84b0ec