Perhaps something of use here?
"Iterative Proportional Fitting R
Code<https://edyhsgr.github.io/IPFDescription/IPF.zip>
R<http://www.r-project.org/> code, supporting files and instruction/documentation to
perform two-, three- and four-dimensional IPF. Though I did pieces of the development for
the IPF functions, the heavy lifting (the bulk of the 2D and 3D functions) was done by
Nels
Tomlinson<http://www.google.com/search?q=nels+tomlinson>on>, my predecessor at the
Alaska Department of Labor and Workforce
Development<http://labor.state.ak.us/>."
https://edyhsgr.github.io/datafitting.html
Iterative Proportional Fitting - GitHub
Pages<https://edyhsgr.github.io/datafitting.html>
Iterative Proportional Fitting Information and Code Iterative Proportional Fitting for a
Two-Dimensional Table An informal description from May 2008 of two-dimensional IPF that I
(Eddie Hunsinger) prepared for my coworkers and fellow researchers.Please feel free to
offer comments or corrections.
edyhsgr.github.io
or here?
https://spatial-microsim-book.robinlovelace.net/smsimr.html#iterative-propo…
[
https://spatial-microsim-book.robinlovelace.netfigures/cover-image.jpg]<…
Spatial Microsimulation with
R<https://spatial-microsim-book.robinlovelace.net/smsimr.html#iterative-…
5.1 Weighting algorithms. A wide range of methods can be used to allocate individuals to
zones in spatial microsimulation. As with the majority of procedures for statistical
analysis, there are deterministic and stochastic methods. The results of deterministic
methods, such as IPF, never vary: no random or probabilistic numbers are used so the
resulting weights will be the same every time.
spatial-microsim-book.robinlovelace.net
Ed
Edward A. Sullivan, III
Senior Technical Associate
Email: egads@epsys.com<mailto:egads@epsys.com>
Economic & Planning Systems (EPS)
1330 Broadway, Suite 450
Oakland, CA 94612
T 510-841-9190
http://www.epsys.com<http://www.epsys.com/>
[EPS_Logo_01]
Due to the potential that information exchanged by electronic media can deteriorate, be
damaged, lost or modified, intentionally or otherwise, use of this electronic data by
anyone other than Economic & Planning Systems, Inc. shall be at the sole risk of such
user and without liability or legal exposure to Economic & Planning Systems, Inc.
The recipient is responsible for verifying the accuracy of data against governing hard
copy documentation. If there is a discrepancy between the hard copy and the electronic
copy, the hard copy will govern.
Recipient assumes all risks in the changing or modification of data and revisions or
updating of hard copy documents.
________________________________
From: Charles Purvis <clpurvis(a)gmail.com>
Sent: Friday, February 18, 2022 11:43 AM
To: The Census Transportation Products Program Community of Practice/Users discussion and
news list <ctpp(a)listserv.transportation.org>
Subject: [CTPP News] Re: frataring commuter matrices in R
Thanks, Matt:
I’ll dig into your code. I guess I’m perplexed by the different concepts such as arrays
and matrices. And “R” is still a foreign language to me.
In the olden days I had access to transportation planning network packages (UTPS, MINUTP,
TP+, Cube/Voyager) which had built-in procedures for implementing fratar procedures. Since
I’m retired, I no longer have ready access to these commercial (i.e., not free) products.
I could implement a simple one or two iteration fratar (raking) in Excel, but it would be
a chore to do more iterations.
The intent is to use a base seed matrix (CTPP 2012-2016 total workers) and rake it to new
sets (vectors, arrays) of rows (county-of-residence) and columns (county-of-work).
Essentially to simulate different years using the CTPP2012-16 “seed” matrix.
The important thing to note is that the “row totals” and “column totals” for these years:
2012, 2013, 2014, 2015 and 2016, are readily available (for large counties) in STANDARD
ACS tabulations (tables B08007 and B08501)!!! The single-year ACS data is extremely useful
in this regards. (Small counties will be a problem, since there aren’t single-year
estimates for them. I’ll probably use their mother PUMA and POWPUMA to calculate their
target values.)
So, yes, I would have different sets of row targets and column targets.
The last time I implemented this was 18 years age, when I “aged” the CTPP 2000 data to
2010, 2020, and 2030. I considered this a “sketch planning” exercise (where “sketch
planning” means never having to say you’re sorry.)
I actually found my old report hidden on my former agency’s website:
http://files.mtc.ca.gov/library/pub/12933.pdf
Thanks for the sample script!
Chuck
On Feb 17, 2022, at 7:17 PM, Schroeder, Matt
<Matt.Schroeder@metc.state.mn.us<mailto:Matt.Schroeder@metc.state.mn.us>>
wrote:
Hi, Chuck – I’m not quite sure what the goal of this procedure is (perhaps because I’m
more “census” than “transportation”). Based solely on the materials you sent, it looks
like you’re trying to take the residence X workplace matrix and rake it to the row and
column totals from the matrix itself. So the rows already sum to the row targets you
defined, and the columns already sum to the column targets. I’m not sure why raking is
appropriate here; do you have a different set of row/column targets you plan to use (like
the “estimates of individual years” you mentioned)?
In case it’s useful for your particular situation, I’ve attached some code used to develop
population estimates for census
blocks<https://gisdata.mn.gov/dataset/us-mn-state-metc-society-small-are…es>:
* The “seed data” is estimates of the population in households and the population in
group quarters (in columns) for each census block (in rows). (These are fractional, not
rounded.)
* The total population estimates have already been set; we just need to make sure that
the household and group quarters populations add up to those totals (the row targets).
* We also have estimates of the household and GQ populations for cities and townships,
and we want the block-level household and GQ population estimates to roll up to those as
well (the column targets).
* The code uses the `mipfp` package to make these estimates roll up “vertically”
(within columns) to city/township control totals, and roll up “horizontally” (within rows)
to the block-level total populations.
I’m not a statistician – this is just something I worked out to solve a problem – so take
all this with a grain of salt. Good luck!
--Matt
---
Matt Schroeder
Pronouns: he/him/his
Principal Researcher
Metropolitan Council Community Development
P. 651-602-1513
From: Charles Purvis <clpurvis@att.net<mailto:clpurvis@att.net>>
Sent: Thursday, February 17, 2022 3:42 PM
To: The Census Transportation Products Program Community of Practice/Users discussion and
news list
<ctpp@listserv.transportation.org<mailto:ctpp@listserv.transportation.org>>
Subject: [CTPP News] frataring commuter matrices in R
Help!
I’m trying to fratar (iterative proportional fitting, raking) a 58 by 58 commuter matrix
using R packages. I could use some help.
Attached are my initial scripts and input database to create the 58 by 58 “seed” matrix
(2012-16 CTPP, Total Workers, Table A302100). I’m just a little mystified as to how to
implement the raking/frataring given the different IPF packages available: Ipfp, mlfit,
mipfp, rakeR, rake……
My goal is to rake the 58 by 58 county-to-county total commuters for California, using
the 2012/2016 CTPP to estimates of individual years: 2012, 2013, 2014, 2015, 2016.
Chuck
Caution! This email was sent from an external source. Do not click any links or open
attachments unless you trust the sender and know the content is safe.
_______________________________________________
CTPP mailing list --
ctpp@listserv.transportation.org<mailto:ctpp@listserv.transportation.org>
To unsubscribe send an email to
ctpp-leave@listserv.transportation.org<mailto:ctpp-leave@listserv.transportation.org>
<ExampleIPF.R><seedData.csv>_______________________________________________
CTPP mailing list --
ctpp@listserv.transportation.org<mailto:ctpp@listserv.transportation.org>
To unsubscribe send an email to
ctpp-leave@listserv.transportation.org<mailto:ctpp-leave@listserv.transportation.org>