Data Transformations
FRED provides powerful transformation capabilities to prepare data for analysis. Learn how to apply transformations directly in your requests.
Levels (lin)
Raw, untransformed data:
{
"series_id": "GDP",
"observation_start": "2020-Q1",
"units": "lin" // Default, can be omitted
}
Output:
[
{ "date": "2024-Q2", "value": "28647.8" },
{ "date": "2024-Q1", "value": "28435.1" }
]
Units: Billions of Dollars
Change (chg)
Absolute period-to-period change:
{
"series_id": "GDP",
"observation_start": "2020-Q1",
"units": "chg"
}
Formula: x_t - x_{t-1}
Output:
[
{ "date": "2024-Q2", "value": "212.7" },
{ "date": "2024-Q1", "value": "157.3" }
]
Use cases:
- Quarterly GDP additions
- Monthly employment changes
- Period-over-period differences
Percent Change (pch)
Period-to-period percentage change:
{
"series_id": "GDP",
"observation_start": "2020-Q1",
"units": "pch"
}
Formula: ((x_t / x_{t-1}) - 1) * 100
Output:
[
{ "date": "2024-Q2", "value": "0.75" },
{ "date": "2024-Q1", "value": "0.56" }
]
Use cases:
- Month-over-month inflation
- Quarter-over-quarter growth
- Short-term momentum
Percent Change from Year Ago (pc1)
Year-over-year percentage change:
{
"series_id": "CPIAUCSL",
"observation_start": "2020-01-01",
"units": "pc1"
}
Formula: ((x_t / x_{t-n}) - 1) * 100
where n = periods in a year
Output:
[
{ "date": "2024-09-01", "value": "2.4" },
{ "date": "2024-08-01", "value": "2.5" }
]
Use cases:
- Annual inflation rates
- Year-over-year GDP growth
- Annual wage growth
pc1 is the most common transformation for inflation and growth rates
Compounded Annual Rate of Change (pca)
Annualized growth rate:
{
"series_id": "GDPC1",
"observation_start": "2020-Q1",
"units": "pca"
}
Formula: (((x_t / x_{t-1})^(n)) - 1) * 100
where n = periods per year
Output:
[
{ "date": "2024-Q2", "value": "3.0" },
{ "date": "2024-Q1", "value": "1.4" }
]
Use cases:
- Quarterly GDP at annual rates (official reporting)
- Annualizing monthly growth
pca compounds the growth rate. A 0.75% quarterly growth becomes ~3% annual rate.
Change from Year Ago (ch1)
Absolute change from same period last year:
{
"series_id": "PAYEMS",
"observation_start": "2020-01-01",
"units": "ch1"
}
Formula: x_t - x_{t-n}
Output:
[
{ "date": "2024-09-01", "value": "2543" },
{ "date": "2024-08-01", "value": "2619" }
]
Use cases:
- Year-over-year job gains
- Annual change in levels
Continuously Compounded Rate (cch)
Log difference (percentage):
{
"series_id": "SP500",
"observation_start": "2020-01-01",
"units": "cch"
}
Formula: (ln(x_t) - ln(x_{t-1})) * 100
Output:
[
{ "date": "2024-10-25", "value": "0.52" },
{ "date": "2024-10-24", "value": "-0.18" }
]
Use cases:
- Financial returns analysis
- Statistical modeling
- Volatility calculations
Continuously Compounded Annual Rate (cca)
Log difference annualized:
{
"series_id": "GDP",
"observation_start": "2020-Q1",
"units": "cca"
}
Formula: (ln(x_t) - ln(x_{t-n})) * 100
Use cases:
- Academic research
- Econometric modeling
Natural Log (log)
Logarithmic transformation:
{
"series_id": "GDP",
"observation_start": "2020-Q1",
"units": "log"
}
Formula: ln(x_t)
Output:
[
{ "date": "2024-Q2", "value": "10.2627" },
{ "date": "2024-Q1", "value": "10.2553" }
]
Use cases:
- Identifying exponential trends
- Statistical analysis requiring normality
- Growth rate calculations
By Use Case
Headlines & Reporting
Trend Analysis
Momentum Analysis
Statistical Analysis
// Year-over-year (most common for news)
{ "units": "pc1" }
// Annualized rate (GDP reporting)
{ "units": "pca" }
// Original levels
{ "units": "lin" }
// Log transformation for exponential trends
{ "units": "log" }
// Month-over-month
{ "units": "pch" }
// Absolute changes
{ "units": "chg" }
// Log returns
{ "units": "cch" }
// Log levels
{ "units": "log" }
By Data Frequency
| Frequency | Common Transformations | Example |
|---|
| Daily | lin, pch, cch | Stock returns |
| Weekly | lin, pch, pc1 | Initial claims |
| Monthly | pc1, pch, ch1 | Inflation, employment |
| Quarterly | pca, pc1, log | GDP growth |
| Annual | pc1, chg | Demographics |
Practical Examples
Inflation Analysis
{
"series_id": "CPIAUCSL",
"units": "pch"
}
// Shows monthly price changes
GDP Growth
{
"series_id": "GDPC1",
"units": "pch"
}
// Simple quarterly growth
Employment Changes
{
"series_id": "PAYEMS",
"units": "chg"
}
// Net jobs added/lost (in thousands)
Compare Multiple Views
// Original levels
const levels = {
"series_id": "UNRATE",
"observation_start": "2020-01-01",
"units": "lin"
};
// Month-over-month change
const monthly = {
"series_id": "UNRATE",
"observation_start": "2020-01-01",
"units": "chg"
};
// Year-over-year change
const annual = {
"series_id": "UNRATE",
"observation_start": "2020-01-01",
"units": "ch1"
};
Growth Decomposition
// Nominal GDP growth
const nominal = {
"series_id": "GDP",
"units": "pc1"
};
// Real GDP growth
const real = {
"series_id": "GDPC1",
"units": "pc1"
};
// Implicit: Price change ≈ Nominal - Real
Advanced Techniques
Detrending
Remove long-term trends using logs:
// Step 1: Get log values
{
"series_id": "GDPC1",
"observation_start": "2000-Q1",
"units": "log"
}
// Step 2: Calculate deviations from trend
// (done in analysis tool)
Volatility Measurement
Use continuous compounding for returns:
{
"series_id": "SP500",
"observation_start": "2023-01-01",
"units": "cch" // Daily log returns
}
// Calculate standard deviation for volatility
Real vs Nominal
Deflate nominal series:
// Nominal wages
const nominal_wages = {
"series_id": "CES0500000003"
};
// CPI (for deflation)
const cpi = {
"series_id": "CPIAUCSL"
};
// Real wages = (Nominal / CPI) * 100
FRED often provides pre-calculated real series (look for “Real” in title)
Common Pitfalls
❌ Don’t: Compare monthly % change with quarterly{ "series_id": "CPIAUCSL", "units": "pch" } // Monthly
{ "series_id": "GDP", "units": "pch" } // Quarterly
✅ Do: Use consistent frequencies{ "series_id": "CPIAUCSL", "units": "pc1" } // Annual
{ "series_id": "GDP", "units": "pc1" } // Annual
Transformation on Transformations
❌ Don’t: Forget to check original units// Some series are in billions, others in thousands
{ "series_id": "GDP" } // Billions
{ "series_id": "PAYEMS" } // Thousands
✅ Do: Verify units in response
❌ Don’t: Use NSA data for growth rates{ "series_id": "UNRATENSA", "units": "pch" } // Seasonal distortion
✅ Do: Use SA data for comparisons{ "series_id": "UNRATE", "units": "pch" } // Seasonally adjusted
Quick Reference Table
| Code | Name | Formula | Period | Use Case |
|---|
| lin | Levels | x_t | - | Raw data |
| chg | Change | x_t - x_ | Prior | Absolute change |
| ch1 | Change YoY | x_t - x_ | Year ago | Annual absolute change |
| pch | % Change | ((x_t/x_)-1)*100 | Prior | Growth rate |
| pc1 | % Change YoY | ((x_t/x_)-1)*100 | Year ago | Annual growth |
| pca | Compounded Annual | (((x_t/x_)^n)-1)*100 | Annual | Annualized rate |
| cch | Log Change | (ln(x_t)-ln(x_))*100 | Prior | Log returns |
| cca | Log Change Annual | (ln(x_t)-ln(x_))*100 | Annual | Annual log returns |
| log | Natural Log | ln(x_t) | - | Log levels |
Frequency Multipliers (n)
| Frequency | n (per year) |
|---|
| Daily | 365 (business) / 260 (trading) |
| Weekly | 52 |
| Monthly | 12 |
| Quarterly | 4 |
| Semi-annual | 2 |
| Annual | 1 |
Best Practices
Start with Levels
Always examine raw data first to understand scale and patterns
Match Use Case
Choose transformation based on your analysis needs
Document Choices
Note which transformations you applied for reproducibility
Verify Results
Sanity-check transformed values against known economic facts
Next Steps