模板:Inflation/doc
此页面是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.