Template:Inflation
本模板含有複雜而精密的扩展语法。 編輯本模板前,建議您先熟悉解析器函數与本模板的设计思路、运作原理等。若您的編輯引發了意外的問題,請儘快撤銷編輯,因為本模板可能被大量頁面使用。 您所作的编辑可先在本模板的沙盒或您的个人页面中进行測試。 |
此模板只適用於膨脹中的消費物價指數價值,如日用品、工資、服務費用(診症費,火車票等)。模板不適用於資本支出、政府支出和個人財富及富有人支出。不正當使用此模板會視爲原創研究,如果編者不熟悉使用,請尋找有基本經濟知識的人幫助。 |
模板有三個必填參數,包括country_code、value及start_year。通脹率資料可在模板的子頁面找到及編輯,如美國通脹率資料存在Template:Inflation/US/dataset,每年有新的資料,所有引用此模板的頁面便會自動更新。
另外,編者可使用end_year參數,指定某年之間的通脹率。
用法
{{Inflation|國家代碼|value|start_year}}
{{Inflation|國家代碼|value|start_year|end_year}}
{{Inflation|國家代碼|value|start_year|r=decimals|fmt=c}}
{{Inflation|國家代碼|value|start_year|r=decimals|fmt=eq}}
{{Inflation|國家代碼|value|start_year|r=decimals|fmt=eq|cursign=X}}
此模板支援以下的貨幣:
國家代碼 |
國家 | 最早支援年份start_year |
最晚支援年份end_year
|
---|---|---|---|
AU | 澳洲[1] | 1901 | 2018 |
AU-road | 澳洲[...?][2] | 1998 | 2018 |
CA | 加拿大[3] | 1688 | 2020 |
DE | 德國[4] | 1882 | 2021 |
JP | 日本[5] | 1946 | 2019 |
UK | 英國[6] | 1209 | 2021 |
US | 美國[7] | 1800 | 2023 |
US-GDP | 美國平均物价指数[8] | 1790 | 2020 |
- end_year:如有輸入,數值必須比start_year大,比現時年份小。沒有輸入則預設為今年。
- r=digit:設定四捨五入至某個數值,預設為0。
例子:
-
{{Inflation|DE|1000000|2000}}
= 661641 -
{{Inflation|US|1000000|2001|2001}}
= 相当于2001年的$1,000,000 -
{{Inflation|US|1000000|1990|2005|r=2}}
= 1494905.76 -
{{Inflation|UK|1000000|1323|1978|r=-3}}
= 114610000
-
{{Inflation|JP|100|2000}}
→ 102 -
{{Inflation|DE|100|2000}}
→ 66 -
{{Inflation|US|595|1982}}
→ 1879 -
{{Inflation|US|595|1982|fmt=eq}}
→ 相当于2023年的$1,879 -
{{Inflation|US|800|1942|fmt=eq|r=-3}}
→ 相当于2023年的$15,000 -
{{Inflation|US|100|2010|2012|fmt=eq|r=2}}
→ 相当于2012年的$105.28 -
US$595({{Inflation|US|595|1982|fmt=eq}})
→ US$595(相当于2023年的$1,879) -
US$595({{Inflation|US|595|1982|fmt=eq|cursign=[[美元|US$]]}})
→ US$595(相当于2023年的US$1,879) -
$2,100萬(相当于{{Inflation/year|US}}的${{Inflation|US|2100|2005|r=0}}萬)
→ $2,100萬(相当于2023年的$3276萬) -
{{Inflation|UK|1|1209|fmt=eq|cursign=£}}
→ 相当于2021年的£1,499 -
{{Inflation|AU|100|2024|fmt=eq}}
→ 相当于2024年的$100 -
{{Inflation/year|US}}年的${{Inflation|US|100|2024}}
→ 2023年的$100 -
{{Inflation|UK|100|1982|fmt=eq|orig=yes|cursign=£}}
→ 相当于2021年的£375
參數不當會顯示NaN:
-
{{Inflation}}
= 使用{{Inflation}}时出错:|index=
(参数1),|value=
(参数2) and|start_year=
(参数3) 必须被指定。 -
{{Inflation|abc}}
= 使用{{Inflation}}时出错:|value=
(参数2) and|start_year=
(参数3) 必须被指定。 -
{{Inflation|DE|1000000}}
= 使用{{Inflation}}时出错:|start_year=
(参数3) 必须被指定。 -
{{Inflation|US|1000000|1200|3000}}
= 使用{{Inflation}}时出错:|start_year=1200
(参数3) 低于索引"US"最早可用年(1800)。 and|end_year=3000
(参数4) 大于索引"US"的最新可用年(2023). -
{{Inflation|UK|1000000|2005|2004}}
= 使用{{Inflation}}时出错:|start_year=2005
(参数3) 大于|end_year=2004
(参数4).
提示與技巧
貨幣轉換
此模板不能轉換貨幣單位,因此,如果想知道1960時的1000德國馬克於現在的價值,輸入{{Inflation|DE|1000|1960|r=2}}
顯示的數值仍爲德國馬克,而非歐元。
所以,如要轉換貨幣單位,需要手動輸入數式,下面例子定義€ 1 = DM 1.95583:
- {{#expr:(
{{Inflation|DE|1000|1960|r=2}}
/ 1.95583) round 2}}
四捨五入
|r=
參數可以定義要四捨五入的數位,輸入|r=2
會約至2個小數點;輸入|r=-3
會約至千位;輸入|r=-6
會約至百萬位,如此類推。
Formatnum
為達到更佳效果,編者可以使用{{formatnum:}},用{{Formatprice}}
也可。這個功能為數值每三個數位加上一個分隔逗號,但編者不能控制顯示多少小數位。
- DM {{formatnum:
{{Inflation|DE|1000000|1957|1978}}
}}.00 = DM 2,006,102.00 - £{{formatnum:
{{Inflation|UK|1000000|1323|1978|r=-4}}
}} = £114,610,000 - ${{formatnum:
{{Inflation|US|1000000|1990|r=2}}
}} = $2,332,144.68
Another potential source of difficulties resides in the way certain calculated values are expressed. In many cases the result comes as a number in engineering units ("1.2E+9" instead of "1200000000"), and when that happens {{formatnum:}}'ing the result fails. A workaround then is to express the value to be inflated with fewer digits, adding a multiplier text such as "million" after the result, and then hitting the "Show preview" button as many times as needed, changing parameters until the best result is found:
- ${{formatnum:
{{Inflation|US|1000000000|1900|r=-8}}
}} = $36,600,000,000 - ${{formatnum:
{{Inflation|US|1000000|1900|r=-5}}
}} thousand = $36,600,000 thousand - ${{formatnum:
{{Inflation|US|1000|1900|r=-2}}
}} million = $36,600 million - ${{formatnum:
{{Inflation|US|1|1900|r=1}}
}} billion = $36.6 billion
The following section provides an automated way of avoiding this trial and error scenario.
Formatprice
{{Formatprice}}
is a template specifically designed to display price values, both big and small, in a more pleasant way than {{formatnum:}} allows for. For example, instead of showing the whole of a huge number such as "953,783,409,856.12", it would show it as "9538億", while small numbers have their cents part appearing as expected, "1234.5" being properly shown as "1.23千".
On the down side, {{Formatprice}}
has no built-in intelligent handling of user locale settings, which means that some users might see a dot or a comma the opposite way they'd expect. As a general rule of thumb this shouldn't be a serious concern though, as most numbers in Wikipedia are hand-written anyway and will show as entered regardless of user settings.
- DM {{Formatprice|
{{Inflation|DE|1000000|1957|1978}}
}} = DM 201萬 - £{{Formatprice|
{{Inflation|UK|1000000|1323|1978|r=-4}}
}} = £1.15億 - ${{Formatprice|
{{Inflation|US|1000000|1990|r=2}}
}} = $233萬 - ${{Formatprice|
{{Inflation|US|1000000000|1900|r=-8}}
}} = $366億
Documenting
It's a good practice to provide a valid reference for the prices calculated with this template in the articles where it's used. The template {{Inflation/fn|country}} 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 1910 a ''blah'' cost on average £1,000. This is equivalent to £{{Formatprice|{{Inflation|UK|1000|1910|r=2}}}} in present day terms.{{Inflation/fn|UK}}
Resulting in this converted code (notice the footnote link at the end):
- In 1910 a blah cost on average £1,000. This is equivalent to £10.9萬 in present day terms.[6]
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
- 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.
- 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
An inflation series represents templates in the following categories:
- Template:Inflation/name
- Template:Inflation/name/dataset
- Template:Inflation/name/startyear
- Template:Inflation/doc/name (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:
- Template:Inflation/fn
重定向
- {{通脹}}
參見
- {{Inflation/year}}
- {{Inflation/fn}}
- {{Format price}}
- Tabular data of consumer price indices
- Category:货币模板
- 通货膨胀
- 消費者物價指數
- 流通貨幣列表
- 平均物价指数
- Category:使用Inflation模板时错误的页面(0)
參考資料
- ^ 1850-1899: McLean, I.W. (1999), Consumer Prices and Expenditure Patterns in Australia 1850–1914. Australian Economic History Review, 39: 1-28. For later years, 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 2015-05-04
- ^ 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.
- ^ 1688 to 1923: Geloso, Vincent, A Price Index for Canada, 1688 to 1850 (December 6, 2016). Afterwards, 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. [2021-04-17]. and table 18-10-0004-13 Consumer Price Index by product group, monthly, percentage change, not seasonally adjusted, Canada, provinces, Whitehorse, Yellowknife and Iqaluit. Statistics Canada. [2021-04-17].
- ^ 1500 to 1850: Ulrich Pfister, 2010. "Consumer prices and wages in Germany, 1500 - 1850," CQE Working Papers 1510, Center for Quantitative Economics (CQE), University of Muenster. 1851-1882: Coos Santing, 2007, Inflation 1800-2000, data from OECD, Organisation for Economic Co-operation and Development, Economic Outlook. Historical Statistics and Mitchell, B. R. International Historical Statistics, Africa, Asia and Oceania 1750-1993 London : Macmillan ; New York : Stockton, 1998, International Historical Statistics, Europe 1750-1993 London : Macmillan ; New York : Stockton, 1998, and International Historical Statistics, The Americas 1750-1993 London : Macmillan ; New York : Stockton, 1998. After 1883, German inflation numbers based on data available from the Deutsches Statistisches Bundesamt archive and GENESIS database.
- ^ 1868 to 1938: Williamson J., Nominal Wage, Cost of Living, Real Wage and Land Rent Data for Japan 1831-1938, 1939 to 1945: Bank of Japan Historical Statistics Afterwards, 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 昭和戦後史. [2015-01-24].
- ^ 6.0 6.1 见英国零售价指数,数据来自Clark, Gregory. The Annual RPI and Average Earnings for Britain, 1209 to Present (New Series). MeasuringWorth. 2017 [2022-06-11].
- ^ 1634–1699: McCusker, J. J. How Much Is That in Real Money? A Historical Price Index for Use as a Deflator of Money Values in the Economy of the United States: Addenda et Corrigenda (PDF). American Antiquarian Society. 1997. 1700–1799: McCusker, J. J. How Much Is That in Real Money? A Historical Price Index for Use as a Deflator of Money Values in the Economy of the United States (PDF). American Antiquarian Society. 1992. 1800–present: Federal Reserve Bank of Minneapolis. Consumer Price Index (estimate) 1800–. [2024-02-29].
- ^ Johnston, Louis; Williamson, Samuel H. What Was the U.S. GDP Then?. MeasuringWorth. 2022 [2022-02-12]. United States Gross Domestic Product deflator figures follow the Measuring Worth series.