Predloga:Inflation

Iz Wikipedije, proste enciklopedije
Jump to navigation Jump to search
Documentation icon Dokumentacija predloge[predogled] [uredi] [zgodovina] [osveži]

Predloga:Inflation/update warning

This template calculates inflation based on several inflation index data sets. The template uses an identification code for an inflation index (usually a country code), an original value, an original start_year and either a specific reference end_year or by default the latest currently available end year,[1] and calculates the equivalent value from historical economic changes between the original and reference years. For example, this template calls the United States inflation table located in the sub-template Template:Inflation/US/dataset to perform the U.S. calculation.

Aside from a convenient way to calculate values from different specified time periods, this template allows a regularly automatically updated calculation of value based on the most recent available inflation data. Whenever inflation tables are updated, potentially annually, all articles using this template have their displayed values updated accordingly.

Usage[uredi kodo]

{{Inflation|index|value|start_year}}
{{Inflation|index|value|start_year|end_year}}
{{Inflation|index|value|start_year|r=decimals|fmt=c}}
{{Inflation|index|value|start_year|r=decimals|fmt=eq}}
{{Inflation|index|value|start_year|r=decimals|fmt=eq|cursign=X}}

The supported countries are listed below, with their index and available data periods:

index Country start_year minimum end_year maximum
AU Australia[2] 1901 2018
AU-road Australia [...?][3] Predloga:Inflation/AU-road/startyear 2018
BD Bangladesh[4] Predloga:Inflation/BD/startyear 2014
CA Canada[5] Predloga:Inflation/CA/startyear 2018
DE Germany[6] 1882 2017
IN India[7] Predloga:Inflation/IN/startyear 2019
IR Iran[8] Predloga:Inflation/IR/startyear 1398
JP Japan[9] 1946 2019
PH Philippines[10] Predloga:Inflation/PH/startyear 2019
PK Pakistan[11] Predloga:Inflation/PK/startyear 2018
UK United Kingdom[12] Predloga:Inflation/UK/startyear 2019
UK-GDP United Kingdom GDP deflator[13] Predloga:Inflation/UK-GDP/startyear 2016
US United States[14] 1264 2019
US-GDP United States GDP deflator[15] Predloga:Inflation/US-GDP/startyear 2019
ZAR South Africa[16] Predloga:Inflation/ZAR/startyear 2018
KRW South Korea[17] Predloga:Inflation/KRW/startyear 2017

Parameters[uredi kodo]

  • |index= (parameter 1), required, an index code for one of several available inflation indexes.
  • |value= (parameter 2), required, original price or value from which to base the inflation calculation on. Will ignore any commas, but must not have a currency symbol.
  • |start_year= (parameter 3), required, original year from which to base the inflation calculation on. Must be a year available in the chosen inflation index. As an exception to this, if the current year is specified and no end_year is specified, the template will output value unchanged, as it can be assumed an inflation of zero.
  • |end_year= (parameter 4), optional, reference year for which to calculate inflation. Must be higher (later) than start_year, but not higher than the highest (most recent) year available in the chosen inflation index, and will default to the highest (most recent) available year if omitted.
  • |r=digit sets the digits to which the value must be rounded. A negative value indicates rounding to an upper significant digit, and a positive value indicates a fractional digit including trailing zeros. Defaults to 0, i.e., without cents.
  • |fmt=c will insert thousands separator commas into the calculated value.
  • |fmt=eq will show an equivalent-to phrase, in the format, "Predloga:Xtn". Uses thousands separator commas.
    • |cursign= will set the currency symbol to be shown. Only functions when |fmt=eq is used. Can use advanced symbol formats, but can only precede the calculated value. Default is $.

Examples[uredi kodo]

  • Zelena kljukicaY {{Inflation|KRW|100|2000}}Error when using {{Inflation}}: |index=KRW (parameter 1) not a recognized index.
  • Zelena kljukicaY {{Inflation|DE|100|2000}}Error when using {{Inflation}}: |index=DE (parameter 1) not a recognized index.
  • Zelena kljukicaY {{Inflation|US|595|1982}}1454
  • Zelena kljukicaY {{Inflation|US|595|1982|fmt=eq}}equivalent to $1.454 in 2019
  • Zelena kljukicaY {{Inflation|US|800|1942|fmt=eq|r=-3}}equivalent to $12.000 in 2019
  • Zelena kljukicaY {{Inflation|US|100|2010|2012|fmt=eq|r=2}}equivalent to $105,28 in 2012
  • Zelena kljukicaY US$595 ({{Inflation|US|595|1982|fmt=eq}})US$595 (equivalent to $1.454 in 2019)
  • Zelena kljukicaY US$595 ({{Inflation|US|595|1982|fmt=eq|cursign=[[United States dollar|US$]]}})US$595 (equivalent to US$1.454 in 2019)
  • Zelena kljukicaY $21 million (equivalent to ${{Inflation|US|21|2005|r=2}} million in {{Inflation/year|US}})$21 million (equivalent to $2536 million in 2019)
  • Zelena kljukicaY {{Inflation|UK|1|1209|fmt=eq|cursign=£}}Error when using {{Inflation}}: |index=UK (parameter 1) not a recognized index.
  • Zelena kljukicaY {{Inflation|AU|100|2021|fmt=eq}}Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.
  • Zelena kljukicaY ${{Inflation|US|100|2021}} in {{Inflation/year|US}}$100 in 2019

It is possible to use the template in incorrect ways without producing error messages. Please read the warnings and appropriate uses of this template at the beginning of the template description.

  • Rdeči XN {{Inflation|UK|10|1971|fmt=eq}}Error when using {{Inflation}}: |index=UK (parameter 1) not a recognized index. (Omitting the |cursign= parameter will show the $ symbol by default, which is the wrong currency symbol for British currency)
  • Zelena kljukicaY {{Inflation|UK|10|1971|fmt=eq|cursign=£}}Error when using {{Inflation}}: |index=UK (parameter 1) not a recognized index.
  • Rdeči XN $595 (${{Inflation|US|595|1982|fmt=c}} today)$595 ($1.454 today) (Misleading time reference)
  • Rdeči XN $595 (${{Inflation|US|595|1982|fmt=c}} in {{CURRENTYEAR}})$595 ($1.454 in 2021) (Misleading time reference)
  • Rdeči XN $100 (${{Inflation|US|595|1982|fmt=c}} adjusted for inflation)$100 ($1.454 adjusted for inflation) (Misleading time reference)
  • Zelena kljukicaY $595 ({{Inflation|US|595|1982|fmt=eq}})$595 (equivalent to $1.454 in 2019)
  • Zelena kljukicaY $595 (equivalent to ${{Inflation|US|595|1982|fmt=c}} in {{Inflation/year|US}})$595 (equivalent to $1.454 in 2019)
  • Rdeči XN Jane Doe amassed a fortune of $1 billion in 1975, making her worth ${{Inflation|US|1|1975|fmt=c}} billion in {{Inflation/year|US}}.Jane Doe amassed a fortune of $1 billion in 1975, making her worth $4 billion in 2019. (CPI is not for personal wealth of the wealthy – use GDP deflator instead)
  • Rdeči XN Jane Doe amassed a fortune of $1 billion in 1975, equivalent to ${{Inflation|US|1|1975|fmt=c}} billion in {{Inflation/year|US}}.Jane Doe amassed a fortune of $1 billion in 1975, equivalent to $4 billion in 2019. (CPI is not for personal wealth of the wealthy – use GDP deflator instead)
  • Zelena kljukicaY Jane Doe amassed a fortune of $1 billion in 1975, equivalent to ${{Inflation|US-GDP|1|1975|fmt=c}} billion in {{Inflation/year|US-GDP}}.Jane Doe amassed a fortune of $1 billion in 1975, equivalent to $Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index. billion in 2019

Entering invalid parameters or omitting required parameters will result in an error message and categorization into Category:Pages with errors in inflation template.

  • Rdeči XN {{Inflation}}Error when using {{Inflation}}: |index= (parameter 1), |value= (parameter 2) and |start_year= (parameter 3) must be specified.
  • Rdeči XN {{Inflation|abc}}Error when using {{Inflation}}: |value= (parameter 2) and |start_year= (parameter 3) must be specified.
  • Rdeči XN {{Inflation|AU}}Error when using {{Inflation}}: |value= (parameter 2) and |start_year= (parameter 3) must be specified.
  • Rdeči XN {{Inflation|AU|100}}Error when using {{Inflation}}: |start_year= (parameter 3) must be specified.
  • Rdeči XN {{Inflation|abc|€100|1980}}Error when using {{Inflation}}: |index=abc (parameter 1) not a recognized index.
  • Rdeči XN {{Inflation|DE|€100|1980}}Error when using {{Inflation}}: |index=DE (parameter 1) not a recognized index.
  • Rdeči XN {{Inflation|DE|€100|zzzz|zzzz|r=zzzz}}Error when using {{Inflation}}: |index=DE (parameter 1) not a recognized index.
  • Rdeči XN {{Inflation|AU|100|1200|2022}}Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.
  • Rdeči XN {{Inflation|AU|100|2005|2004}}Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index. (see the Limitations section below)
  • Rdeči XN {{Inflation|AU|100|2005|2022|fmt=eq}}Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.
  • Rdeči XN {{Inflation|AU|100|2021|2022|fmt=eq}}Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.
  • Rdeči XN {{Inflation|AU|100|2021|1905|fmt=eq}}Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.
  • Rdeči XN {{Inflation|AU|100|2022|fmt=eq}}Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.

Tips & tricks[uredi kodo]

Currency conversion[uredi kodo]

This template is currency agnostic, which means it doesn't convert between different currencies. Thus, if you wanted to know how much DM 1,000.00 marks in 1960 are worth nowadays, entering {{Inflation|DE|1000|1960|r=2}} would provide a result (Predloga:Xtn) still in marks, not in euros.

Consequently, if you need a result in another currency than the one in which the original value is stated, for now you must do the conversion manually, as in the following example which uses the defined conversion rate of € 1 = DM 1.95583:

  • Zelena kljukicaY {{#expr:({{Inflation|DE|1000|1960|r=2}} / 1.95583) round 2}}Napaka v izrazu: Nepričakovan operator <

Predloga:ToDo A currency conversion template to ease these conversion tasks is planned. This section will be updated accordingly once it's developed.

Non-decimal inputs[uredi kodo]

The template does not accept non-decimal inputs such as £sd; these must be decimalized beforehand. For example, if you wanted to know the value of three shillings and sixpence (3s 6d) Sterling in 1950 in 2018, you must convert to the appropriate decimal value (in this case £0.175) for use in the template:

  • Zelena kljukicaY {{Inflation|GBP|0.175|1950|2018}}Error when using {{Inflation}}: |index=GBP (parameter 1) not a recognized index.

For £sd specifically {{Pounds, shillings, and pence}} can be used to convert to decimal. For other non-decimal currencies, such as the old Indian rupee, templates can be made for decimalization upon request.

  • Zelena kljukicaY {{Inflation|GBP|{{£sd|s=3|d=6}}|1950|2018|r=0|fmt=eq|cursign=£}}Error when using {{Inflation}}: |index=UK (parameter 1) not a recognized index.
  • Zelena kljukicaY {{Inflation|UK|{{£sd|s=10|d=6}}|1865|fmt=eq|cursign=£}}Error when using {{Inflation}}: |index=UK (parameter 1) not a recognized index.

Rounding[uredi kodo]

By default the values are calculated to the unit, as for all but very low values cents are undesirable. You can specify rounding with the |r= parameter which determines the number of decimals. To obtain cents use |r=2, but other values can be used, including negative ones: |r=-3, for example, will round to the nearest thousand, |r=-6 to the nearest million, and so on. It is advisable to avoid excessive precision; even if the start value is known to be exact, the template's result will not be because the inflation index tables are rarely accurate to more than about 1%, and a granularity of whole years is used.

Very large results[uredi kodo]

Very large results are expressed in scientific notation ("1.2E+14" instead of "120000000000000") which is normally not desirable. A workaround is to express the value to be inflated with fewer digits, adding a multiplier text such as "trillion" after the result, using the "Show preview" button as many times as needed, changing parameters until the best result is found:

  • Zelena kljukicaY ${{Inflation|US-GDP|1000000000000|1900|r=-11|fmt=c}}$Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index.
  • Rdeči XN ${{Inflation|US-GDP|10000000000000|1900|r=-12|fmt=c}}$Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index.
  • Rdeči XN ${{Inflation|US-GDP|10000000000|1900|r=-9|fmt=c}}&nbsp;thousand$Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index. thousand
  • Zelena kljukicaY ${{Inflation|US-GDP|10000000|1900|r=-6|fmt=c}}&nbsp;million$Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index. million
  • Zelena kljukicaY ${{Inflation|US-GDP|10000|1900|r=-3|fmt=c}}&nbsp;billion$Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index. billion
  • Zelena kljukicaY ${{Inflation|US-GDP|10|1900|fmt=c}}&nbsp;trillion$Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index. trillion

The following section provides an automated way of avoiding this trial and error scenario.

Format price[uredi kodo]

{{Format price}} is a template specifically designed to display price values, both big and small, in a readable way. For example, instead of showing the whole of a huge number such as "953,783,409,856.12", it would show it as "954 milijard", while small numbers have their cents part appearing as expected, "1234.5" being properly shown as "1,23 tisoč".

  • Zelena kljukicaY ${{Format price|{{Inflation|US-GDP|10000000000000|1900}}}}$Format price error: cannot parse value "Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index."
  • Zelena kljukicaY ${{Format price|{{Inflation|US-GDP|1000000|1990}}}}$Format price error: cannot parse value "Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index."
  • Zelena kljukicaY DM {{Format price|{{Inflation|DE|1000000|1957|1978}}}}DM Format price error: cannot parse value "Error when using {{Inflation}}: |index=DE (parameter 1) not a recognized index."
  • Zelena kljukicaY £{{Format price|{{Inflation|UK-GDP|1000|1323}}}}£Format price error: cannot parse value "Error when using {{Inflation}}: |index=UK (parameter 1) not a recognized index."

Documenting[uredi kodo]

It's a good practice to provide a valid reference for the prices calculated with this template in articles where it's used. The template {{Inflation/fn}} was developed to ease this task. It accepts as its single parameter the same country codes used here, and will generate one or more appropriate footnotes. Typically, this is how a piece of text using it looks like:

  • In 1985 a unit cost on average $1,040. This is {{Inflation|US|1040|1985|fmt=eq}}.{{Inflation/fn|US}}

Resulting in this converted code (notice the footnote link at the end):

  • In 1985 a unit cost on average $1,040. This is equivalent to $2.280 in 2019.[14]

The footnote thus generated appears whenever {{reflist}} or <references /> is used in an article, usually in its "References" section. See below for the live example in this document's own References section, or click the above generated footnote to jump to it.

Limitations[uredi kodo]

  1. Currently it isn't possible to "de-inflate" a value to what it would have been in a previous year. If you need this functionality, please request it at the talk page. Adding it won't be difficult, but there's no point in doing so before someone actually needs it.
  2. Substitution isn't supported at all. Trying to {{subst:Inflation|...}} would only result in a long sequence of embedded parser code without any direct benefit. If you need to obtain an inflated price only once, please use the special ExpandTemplates page then copy the result and paste it at the desired location.

Developer documentation[uredi kodo]

An inflation series represents templates in the following categories:

  • Template:Inflation/index
  • Template:Inflation/index/dataset
  • Template:Inflation/index/startyear
  • Template:Inflation/doc/index (Which is then displayed at Inflation/name/dataset as the documentation, and needs to refer to the original data source)

Modifications need to be made to:

Current subpages:

TemplateData[uredi kodo]

To je TemplateData dokumentacija za predlogo, ki jo uporablja VisualEditor in druga orodja; glejte mesečno poročilo o uporabi parametrov za to predlogo.

TemplateData za Inflation

This template calculates inflation based on several inflation index data sets. Note that this template defaults to calculating the inflation of Consumer Price Index values: staples, workers' rent, small service bills (doctor's costs, train tickets). For inflating capital expenses, government expenses, or the personal wealth and expenditure of the rich, the US-GDP or UK-GDP indexes should be used, which calculate inflation based on the [[gross domestic product]] (GDP) for the [[United States]] and [[United Kingdom]], respectively.

Parametri predloge

Za to predlogo se uporablja postavitev parametrov v eni vrstici.

ParameterOpisVrstaStanje
Indexindex 1

An index code for one of several available inflation indexes. One of AU, AU-road, BD, CA, DE, IN, JP, PH, PK, UK, UK-GDP, US, US-GDP, ZAR.

Zgled
US
Nizzahtevano
Valuevalue 2

Original price or value from which to base the inflation calculation on. Will ignore any commas.

Zgled
1000
Številkazahtevano
Start yearstart_year 3

Original year from which to base the inflation calculation on. Must be a year available in the chosen inflation index. As an exception to this, if the current year is specified and no 'End year' is specified, the template will output value unchanged, as it can be assumed an inflation of zero.

Zgled
1975
Številkazahtevano
End yearend_year 4

Reference year for which to calculate inflation. Must be higher (later) than 'Start year', but not higher than the highest (most recent) year available in the chosen inflation index, and will default to the highest (most recent) available year if omitted.

Zgled
2015
Številkaizbirno
Number of digitsr

Sets the digits to which the value must be rounded. A negative value indicates rounding to an upper significant digit, and a positive value indicates a fractional digit including trailing zeros. Defaults to 0.

Privzeto
0
Zgled
1
Številkaizbirno
Formatfmt

"c" will insert thousands separator commas into the calculated value. "eq" will show an equivalent-to phrase, in the format, "equivalent to (cursign)(end_value) in (end_year)". Uses thousands separator commas.

Zgled
eq
Nizizbirno
Currency signcursign

Sets the currency symbol to be shown. Only functions when Format "eq" is used. Can use advanced symbol formats, but can only precede the calculated value. Default is $.

Privzeto
$
Zgled
Nizizbirno

See also[uredi kodo]

References[uredi kodo]

  1. How recently depends on how the data set for each country is constructed, and on the internal tables being updated accordingly every January. Some data tables provide inflation data up to December 31, 2020, others up to roughly June-July 2020, and others yet up to December 31, 2019.
  2. Australian Consumer Price Inflation figures follow the Long Term Linked Series provided in Australian Bureau of Statistics (2011) 6461.0 – Consumer Price Index: Concepts, Sources and Methods, 2011 as explained at §§3.10–3.11; this series comprises "from 1901 to 1914, the A Series Retail Price Index; from 1914 to 1946–47, the C Series Retail Price Index; from 1946–47 to 1948–49, a combination of the C Series Index, excluding rent, and the housing group of the CPI; and from 1948–49 onwards, the CPI." (3.10). Retrieved May 4, 2015
  3. Inflated values automatically calculated using the "3101 Road and bridge construction Australia" series provided in Australian Bureau of Statistics (2014) 6427.0 – Producer Price Indexes, Australia, Mar 2014: Table 17 Output of the Construction industries, subdivision and class index numbers. Retrieved 14 June 2014.
  4. Bangladesh – Consumer price index, International Monetary Fund, International Financial Statistics and data files.[dvomljivo]
  5. Canadian inflation numbers based on Statistics Canada tables 18-10-0005-01 (formerly CANSIM 326-0021) "Consumer Price Index, annual average, not seasonally adjusted". Statistics Canada. November 15, 2020. Pridobljeno dne November 15, 2020. and 18-10-0004-13 "Consumer Price Index by product group, monthly, percentage change, not seasonally adjusted, Canada, provinces, Whitehorse, Yellowknife and Iqaluit". Statistics Canada. Pridobljeno dne November 15, 2020.
  6. German inflation numbers based on data available from Deutsches Statistisches Bundesamt.
  7. Historic inflation India – CPI inflation, Inflation.eu, pridobljeno dne 19 March 2020
  8. The Consumer Price Index for All Urban Consumers (Inflation Rate) (PDF) (Persian), Central Bank of Iran, pridobljeno dne 25 June 2020CS1 vzdrževanje: Neprepoznan jezik (link)
  9. Japanese Historical Consumer Price Index numbers based on data available from the Japanese Statistics Bureau. Japan Historical Consumer Price Index (CPI) – 1970 to 2014 Retrieved 30 July 2014. For between 1946 and 1970, from "昭和戦後史". Pridobljeno dne 2015-01-24.
  10. Consumer Price Index,Inflation Rate and Purchasing Power of the Peso (national averages)
  11. Pakistan – Consumer price index, International Monetary Fund, International Financial Statistics and data files.[dvomljivo]
  12. UK Retail Price Index inflation figures are based on data from Clark, Gregory (2017). "The Annual RPI and Average Earnings for Britain, 1209 to Present (New Series)". MeasuringWorth. Pridobljeno dne February 2, 2020.
  13. United Kingdom Gross Domestic Product deflator figures follow the Measuring Worth "consistent series" supplied in Thomas, Ryland; Williamson, Samuel H. (2018). "What Was the U.K. GDP Then?". MeasuringWorth. Pridobljeno dne February 2, 2020.
  14. 14,0 14,1 Federal Reserve Bank of Minneapolis. "Consumer Price Index (estimate) 1800–". Pridobljeno dne January 1, 2020.
  15. Thomas, Ryland; Williamson, Samuel H. (2020). "What Was the U.S. GDP Then?". MeasuringWorth. Pridobljeno dne September 22, 2020. United States Gross Domestic Product deflator figures follow the Measuring Worth series.
  16. South Africa – Consumer price index, International Monetary Fund, International Financial Statistics and data files.[dvomljivo]
  17. Consumer Price index from Statistics Korea. Consumer Price Index by year. Retrieved 3 April 2018