FRED-MD + FRED-SD#
load_fred_md_sd() combines the monthly national FRED-MD panel with selected
state-level FRED-SD series. This is the recommended combined loader when the
target, evaluation date, or main research design is monthly.
What This Loader Is#
Item |
Value |
|---|---|
Loader |
|
Metadata dataset |
|
Default output frequency |
|
National source |
FRED-MD |
State source |
FRED-SD |
Recommended use |
Monthly state analysis with national macro controls. |
Discouraged use |
Quarterly target analysis; use FRED-QD + FRED-SD instead. |
Function#
macroforecast.data.load_fred_md_sd(
vintage: str | None = None,
*,
force: bool = False,
cache_root: str | pathlib.Path | None = None,
local_fred_md_source: str | pathlib.Path | None = None,
local_fred_sd_source: str | pathlib.Path | None = None,
states: list[str] | None = None,
variables: list[str] | None = None,
frequency: str = "monthly",
quarterly_to_monthly: str = "repeat_within_quarter",
monthly_to_quarterly: str = "quarterly_average",
) -> DataBundle
Inputs#
Name |
Default |
Meaning |
|---|---|---|
|
|
Shared vintage label in |
|
|
Re-download or re-copy both raw sources. |
|
|
Shared raw-file cache root. |
|
|
Local FRED-MD CSV instead of online source. |
|
|
Local FRED-SD workbook or CSV instead of online source. |
|
|
FRED-SD state subset, such as |
|
|
FRED-SD variable subset, such as |
|
|
|
|
|
Rule used when a selected FRED-SD series is quarterly but the output panel is monthly. |
|
|
Rule used only when |
Output#
The function returns DataBundle(panel, metadata).
Field |
Value |
|---|---|
|
Combined wide pandas panel. |
|
|
|
Requested output frequency. |
|
Metadata snapshots from FRED-MD and FRED-SD. |
|
Source dataset for each column. |
|
Inferred source frequency before alignment. |
|
Count of monthly, quarterly, weekly, and unknown native columns before alignment. |
|
FRED-SD date-anchor pattern for state columns when available. |
|
Count of FRED-SD date-anchor patterns when available. |
|
Frequency represented in the returned panel. |
|
Conversion records for source columns that changed frequency. |
|
Target frequency and alignment rules. |
|
FRED-MD official t-codes for national columns. |
FRED-SD has no official t-code map. State-level transformation codes must be supplied during preprocessing.
Default Monthly Use#
import macroforecast as mf
bundle = mf.data.load_fred_md_sd(
states=["CA", "TX"],
variables=["UR", "ICLAIMS", "NQGSP"],
frequency="monthly",
)
This is the intended path for monthly state analysis. Monthly FRED-SD columns
remain monthly. Quarterly FRED-SD columns are aligned to monthly output using
quarterly_to_monthly.
FRED-SD Metadata Preserved In The Combined Panel#
FRED-SD is not a pure monthly dataset. The package keeps its source-frequency and date-anchor metadata even after the returned panel is aligned to monthly output.
Metadata |
Meaning |
|---|---|
|
Source frequency before combination, such as |
|
Count of native source frequencies in the combined panel. |
|
FRED-SD date-anchor pattern, such as |
|
Count of FRED-SD date-anchor patterns in selected state columns. |
|
Per-state/per-variable observed span, native frequency, and date-anchor report. |
This matters most for selected FRED-SD variables that are quarterly in the
official workbook. For example, the official FRED-SD page corrects the paper’s
description of OTOT and STHPI: both are quarterly, not monthly. When these
variables are used in a monthly MD+SD panel, the loader proceeds but warns and
records the exact rule used to convert them.
Quarterly-To-Monthly Rules#
Rule |
Meaning |
|---|---|
|
Assign the quarterly value to each month in the quarter. This is the default. |
|
Place the value at quarter end and forward-fill monthly dates. |
|
Interpolate monthly values between quarterly observations. |
When a quarterly FRED-SD series is converted to monthly output, the loader emits
UserWarning and records the affected variables in
metadata["frequency_conversion_warnings"].
Discouraged Quarterly Use#
bundle = mf.data.load_fred_md_sd(
states=["CA"],
variables=["UR", "NQGSP"],
frequency="quarterly",
monthly_to_quarterly="quarterly_average",
)
This is allowed but not recommended. If the target is quarterly, FRED-QD is the natural national panel. The returned metadata includes a parse note explaining that quarterly alignment of FRED-MD is supported but discouraged.
Weekly Or Other FRED-SD Frequencies#
The default combined output is monthly. The current official FRED-SD workbook
has monthly and quarterly state series, plus columns whose observed dates do
not support a reliable monthly or quarterly classification. The loader does
not silently aggregate weekly or unknown-frequency columns into a combined
monthly panel; it raises ValueError instead. Use frequency="native" to
inspect the mixed native panel first, or call mf.data.align_frequency()
explicitly when you want to decide how a non-monthly state series should enter
a monthly design.
ICLAIMS is treated as native_frequency="monthly" with
date_anchor="monthly_weekday_anchor" because the workbook has one observation
per month on a weekday/Saturday-style anchor rather than first-of-month dates.
It can enter the default monthly MD+SD panel, but the anchor remains visible in
metadata.
Official URLs#
Source |
URL |
|---|---|
FRED-MD official page |
https://www.stlouisfed.org/research/economists/mccracken/fred-databases |
FRED-MD current CSV |
https://www.stlouisfed.org/-/media/project/frbstl/stlouisfed/research/fred-md/monthly/current.csv |
FRED-SD official page |
https://www.stlouisfed.org/research/economists/owyang/fred-sd |