Next: , Previous: , Up: Nonlinear Unit Conversions   [Contents][Index]

### 6.2 US Consumer Price Index

`units` includes the US Consumer Price Index published by the US Bureau of Labor Statistics. Several functions that use this value are provided: ‘cpi’, ‘cpi_now’, ‘inflation_since’, and ‘dollars_in’.

The ‘cpi’ function gives the CPI for a specified decimal year. A decimal year is given as the year plus the fractional part of the year; because of leap years and the different lengths of months, calculating an exact value for the fractional part can be tedious, but for the purposes of CPI, an approximate value is usually adequate. For example, 1 January 2000 is 2000.0, 1 April 2000 is 2000.25, 1 July 2000 is 2000.4986, and 1 October 2000 is 2000.75. Note also that the CPI data update monthly; values in between months are linearly interpolated.

In the middle of 1975, the CPI was

```You have: cpi(1975.5)
You want:
Definition: 53.6
```

The value of the CPI for the previous month is usually published toward the the month; the latest value of the CPI is available with ‘cpi_now’. On 7 January 2024, the value was

```You have: cpi_now
You want:
Definition: UScpi_now = 307.051
```

This means that the CPI was 307.015 on 1 December 2023. The ‘cpi_now’ variable can only present the most recent data available, so it can lag the current CPI by several weeks. The decimal year of the last update is available with ‘cpi_lastdate’.

The ‘inflation_since’ function provides a convenient way to determine the inflation factor from a specified decimal year to the latest value in the CPI table. For example, on 7 January 2024:

```You have: inflation_since(1970)
You want:
Definition: 8.1445889
```

In other words, goods that cost 1 US\$ in 1970 would cost 8.14 US\$ on 1 December 2023.

The ‘inflation_since’ function can be used to determine an annual rate of inflation. The earliest US CPI data are from about 1913.1; the approximate time between then and 7 January 2024 is 110.9 years. The approximate annual inflation rate for that period is then

```You have: inflation_since(1913.1)^1|110.9 - 1
You want: %
* 3.1548115
/ 0.31697614
```

The inflation rate for any time period can be found from the ratio of the CPI at the end of the period to that of the beginning:

```You have: (cpi(1982)/cpi(1972))^1|10 - 1
You want: %
* 8.6247033
/ 0.11594602
```

The period 1972–1982 was indeed one of high inflation.

The ‘dollars_in’ function is similar to ‘inflation_since’ but its output is in US\$ rather than dimensionless:

```You have: dollars_in(1970)
You want:
Definition: 8.1445889 US\$
```

A typical use might be

```You have: 250 dollars_in(1970)
You want: \$
* 2036.1472
/ 0.00049112362
```

Because ‘dollars_in’ includes the units, you should not include them at the ‘You have: prompt. You can also use ‘dollars_in’ to convert between two specified years:

```You have: 250 dollars_in(1970)
You want: dollars_in(1950)
* 156.49867
/ 0.0063898305
```

which shows that 250 US\$ in 1970 would have equivalent purchasing power to 156 US\$ in 1950.

Next: Other Nonlinear Units, Previous: Temperature Conversions, Up: Nonlinear Unit Conversions   [Contents][Index]