A second natural experiment for the state-government rule in R/fiscal.R, using IG Federal revenue from the public API (corpus build 2026-10-26, fccd87c), survey years 2006-2011: - Alabama and Michigan (September 30) and Texas (August 31) jump in survey year 2009 (+18.0%, +22.2%, +12.3%) and slow in 2011 (-4.7%, +3.9%, +4.3%), as the June 30 states do (median +12.4%, +3.6%). Under the plain rule their 2009 would end in 2008, before the stimulus, and their 2011 would be the full stimulus year. - 15 large September-30 cities and counties jump in 2011 (median +17.7%, against +2.1% and +3.1% in 2009 and 2010), as the plain rule predicts. - D.C. is inconclusive again: its 2009 is flat (+4.1%), like the plain rule, but its 2011 falls (-0.9%), like the documented one. The data agrees with the code, so the rule and .SURVEY_YEAR_SAME_YEAR_GOVIDS are unchanged. The header comment and the "survey-year rule" section now cite survey years 2009 and 2020 for the state rule and say D.C. was inconclusive in both. man/ regenerated with roxygen2 7.3.3. Refs #77 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qbe6u2h83wgZdTgJgE4Xh5
91 lines
4.0 KiB
R
91 lines
4.0 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/fiscal.R
|
|
\name{cog_survey_year}
|
|
\alias{cog_survey_year}
|
|
\title{Survey year that covers a calendar date for a government}
|
|
\usage{
|
|
cog_survey_year(govid, date)
|
|
}
|
|
\arguments{
|
|
\item{govid}{Character vector of `canonical_govid` values, or a data frame
|
|
with a `canonical_govid` column.}
|
|
|
|
\item{date}{Dates, or character strings in `"YYYY-MM-DD"` form. `govid`
|
|
and `date` must have the same length, or one of them must have length 1.}
|
|
}
|
|
\value{
|
|
Tibble with one row per (`govid`, `date`) pair, in input order:
|
|
`canonical_govid`, `date`, `year` (the survey year, `NA` when it cannot
|
|
be determined), `fiscal_year_end`, `period_start` and `period_end`.
|
|
}
|
|
\description{
|
|
Maps a date to the survey year whose fiscal period, for that government,
|
|
contains it. This is the reverse of [cog_fiscal_periods()]: use it to place
|
|
an event that happened on a known date against the corpus's `year`.
|
|
}
|
|
\details{
|
|
The date can fall in survey year Y, Y+1 or Y+2 of its own calendar year Y,
|
|
depending on the government's fiscal year end. Each candidate is looked up
|
|
with the `fiscal_year_end` the corpus records for that government-year, so
|
|
a change of fiscal year is respected. When the government has no rows, or
|
|
no `fiscal_year_end`, in the survey year that would cover the date, the
|
|
result is `NA`; the function does not borrow another year's value. If a
|
|
change of fiscal year makes two survey years' periods overlap, the earlier
|
|
survey year is returned.
|
|
}
|
|
\section{The survey-year rule}{
|
|
|
|
Census assigns each government's fiscal year to a survey year by when the
|
|
fiscal year ended. Survey year Y holds the fiscal year that ended between
|
|
July 1 of Y-1 and June 30 of Y. The corpus records each government-year's
|
|
fiscal year end as `fiscal_year_end`, an MMDD integer such as `630` or
|
|
`1231`.
|
|
|
|
Survey year 2017 therefore covers, for a county, city or township:
|
|
|
|
* `fiscal_year_end = 630` (June 30): the fiscal year ending June 30,
|
|
2017, so July 2016 to June 2017.
|
|
* `930` (September 30): the fiscal year ending September 30, 2016, so
|
|
October 2015 to September 2016.
|
|
* `1231` (December 31): the fiscal year ending December 31, 2016, so
|
|
January to December 2016.
|
|
|
|
A city with a December year end and a city with a June year end are both
|
|
"2017" in the corpus, but their figures are six months apart. A September
|
|
year end is nine months behind a June one.
|
|
|
|
State governments (type 0) follow a different rule: survey year Y holds the
|
|
fiscal year ending in calendar year Y. For Alabama and Michigan (September
|
|
30) that means October 2016 to September 2017, and for Texas (August 31)
|
|
September 2016 to August 2017. Census's 2004 and 2006 technical
|
|
documentation lists these three states as exceptions to the June 30 window,
|
|
and the corpus agrees in survey years 2009 and 2020, the two years checked:
|
|
their federal aid moves with the 2009 stimulus and the 2020 CARES Act in
|
|
the same survey years as the June 30 states' does. The same documentation
|
|
lists the District of Columbia, so it is treated the same way. Checks
|
|
against the 2009 and 2020 data were inconclusive for it, so that treatment
|
|
rests on the documentation alone. For New York (March 31) and the 46 states
|
|
with a June 30 year end, the two rules give the same months.
|
|
|
|
A government can change its fiscal year end, so the periods are looked up
|
|
per government-year. Where the corpus has no `fiscal_year_end` for a
|
|
government-year, or the government has no rows that year, the period is
|
|
`NA`. Most of FY1993 is `NA`: 99% of its government-years have no usable
|
|
value in the public corpus as of November 2026. So do 5% to 11% in FY1978
|
|
and FY1987 to FY1990, and under 3% in every other year.
|
|
|
|
From FY2023 the source files mark some rows as estimates carried forward
|
|
from an earlier year. The periods here describe the survey year, not the
|
|
year a carried-forward row's data pertain to.
|
|
}
|
|
|
|
\examples{
|
|
\dontrun{
|
|
# April 15, 2020 for a September 30 county and a September 30 state
|
|
cog_survey_year(c("121011212191", "010000226085"), as.Date("2020-04-15"))
|
|
}
|
|
}
|
|
\seealso{
|
|
[cog_fiscal_periods()]
|
|
}
|