<div dir="ltr">Hi Kate,<div><br></div><div>I have wrestled with this issue a bit myself. It baffles me that there isn&#39;t a clear breakdown of how to do this floating somewhere on the internet!</div><div><br></div><div>The solution that I have arrived at was suggested <a href="https://www.reddit.com/r/statistics/comments/2s7icg/proper_way_to_aggregate_medians/">here</a>, and it involves estimating the median using <a href="http://factfinder.census.gov/help/en/interpolation.htm">interpolation</a>. </div><div><br></div><div>Here&#39;s a quick breakdown of the steps:</div><div><ol><li>Aggregate the B19001 table for the census tracts of interest</li><li>Find the income bracket where the median is expected to be</li><li>Use a method called pareto interpolation to estimate the median (or linear interpolation if the bracket ranges are less than $2500)<br></li></ol></div><div><br></div><div>I found the most straightforward breakdown of pareto interpolation to be this one: <a href="http://www.s4.brown.edu/us2010/SUC/MHHINote.htm">http://www.s4.brown.edu/us2010/SUC/MHHINote.htm</a></div><div><br></div><div>And this example should give you a decent idea of how to write a function (albeit this is a python script, but the idea is the same: <a href="https://gist.github.com/albertsun/1245817">https://gist.github.com/albertsun/1245817</a></div><div><br></div><div>I can send you the R function that I wrote if it will save you some time, but I can&#39;t make any guarantees that it is statistically impeccable. If you want to calculate the sampling error you can find the method explained on p.16-17 of this document: <a href="http://www.census.gov/content/dam/Census/programs-surveys/sipp/tech-documentation/source-accuracy-statements/2008/SIPP%202008%20Panel%20Wave%2005%20-%20Core%20Source%20and%20Accuracy%20Statements.pdf">http://www.census.gov/content/dam/Census/programs-surveys/sipp/tech-documentation/source-accuracy-statements/2008/SIPP%202008%20Panel%20Wave%2005%20-%20Core%20Source%20and%20Accuracy%20Statements.pdf</a> </div><div><br></div><div>If you find a better solution than this approach please share it!</div><div><br></div><div>Best,</div><div><br></div><div>Tiernan</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 12, 2016 at 10:02 AM, Ezra Haber Glenn <span dir="ltr">&lt;<a href="mailto:eglenn@mit.edu" target="_blank">eglenn@mit.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Kate:<br>
<br>
Unfortunately, as I understand it, you simply cannot compute an actual<br>
median from a group of medians -- the exact data you need is  not<br>
there.<br>
<br>
There are ways to approximate this -- a median of medians or a mean of<br>
medians (or even a weighted mean of medians) -- but they are sort of<br>
guesses and approximations.  That said, for lots of planning types<br>
applications, close enough is close enough.  But maybe check with a<br>
statistician friend and discuss your options.<br>
<br>
--Ezra<br>
<br>
At Tue, 12 Jan 2016 09:01:52 -0800, Kate Kelsey wrote:<br>
&gt;<br>
&gt; [1  &lt;multipart/alternative (7bit)&gt;]<br>
&gt; [1.1  &lt;text/plain; UTF-8 (7bit)&gt;]<br>
&gt; [1.2  &lt;text/html; UTF-8 (quoted-printable)&gt;]<br>
<div><div class="h5">&gt; Hi All,<br>
&gt; I am working on a project where I need to calculate median household income for a group of<br>
&gt; census tracts.<br>
&gt; Because this is median income I can&#39;t just add the median income for each tract and divide<br>
&gt; by the total number of households.<br>
&gt; Does anyone have any code they can share to do this?<br>
&gt; Thanks,<br>
&gt; Kate<br>
&gt;<br>
&gt;<br>
</div></div>&gt; [2  &lt;text/plain; us-ascii (7bit)&gt;]<br>
&gt; _______________________________________________<br>
&gt; acs-r mailing list<br>
&gt; <a href="mailto:acs-r@mit.edu">acs-r@mit.edu</a><br>
&gt; <a href="http://mailman.mit.edu/mailman/listinfo/acs-r" rel="noreferrer" target="_blank">http://mailman.mit.edu/mailman/listinfo/acs-r</a><br>
<br>
--<br>
Ezra Haber Glenn, AICP<br>
Department of Urban Studies and Planning<br>
Massachusetts Institute of Technology<br>
77 Massachusetts Ave., Room 7-337<br>
Cambridge, MA 02139<br>
<a href="mailto:eglenn@mit.edu">eglenn@mit.edu</a><br>
<a href="http://dusp.mit.edu/faculty/ezra-glenn" rel="noreferrer" target="_blank">http://dusp.mit.edu/faculty/ezra-glenn</a> | <a href="http://eglenn.scripts.mit.edu/citystate/" rel="noreferrer" target="_blank">http://eglenn.scripts.mit.edu/citystate/</a><br>
<a href="tel:617.253.2024" value="+16172532024">617.253.2024</a> (w)<br>
<a href="tel:617.721.7131" value="+16177217131">617.721.7131</a> (c)<br>
_______________________________________________<br>
acs-r mailing list<br>
<a href="mailto:acs-r@mit.edu">acs-r@mit.edu</a><br>
<a href="http://mailman.mit.edu/mailman/listinfo/acs-r" rel="noreferrer" target="_blank">http://mailman.mit.edu/mailman/listinfo/acs-r</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><font color="#666666"><b>Tiernan Martin</b></font><div><font color="#666666"> 206.979.7801</font></div></div>
</div>