Template talk:Inflation

From Wikipedia, the free encyclopedia

This article is within the scope of the following WikiProjects:

Contents

[edit] New template: Inflation

This discussion started at the template author's talk page and was moved here for template users' convenience.

Great work! I would like to adapt this template to the German wikipedia, if you agree. To do so I need to add the inflation rate for DM/Euro. Would it be usefull to add this currency also in the english template? I provide you with the figures in the hidden text to keep the page readable.Karsten11 (talk) 18:26, 26 May 2008 (UTC)

Sure! Both for you adapting it to the German Wikipedia and for me adding DM and Euro it. In fact, adding a new currency is pretty easy, although I think I'll change the structure so that individual currencies are stored in individual pages, for an easier maintenance.
But first tell me: do these numbers take into account the change in currency, so that values in DM get automatically converted to Euros if I simply go multiplying year after year? Or will an input in DM also output in DM? Because I think the best thing is for currencies to not be converted, requiring the user to do a conversion by hand, as it would be quite difficult to keep track of which currency was valid for which year.
Also, could you please provide me a list for Euro-only inflations? If I'm going to add the older DM, it's fair I also add the Euro itself in the same move. :-)
And what about Germany before 1951? Is data available? -- alexgieg (talk) 00:22, 27 May 2008 (UTC)

Individual currencies in individual pages seems to be a good approach. Only for the german wikipedia we have DM/Euro for Germany, ÖS/Euro für Austria and SFR for Switzerland (and need the exiting USD and GBP too).

There are 3 phases: a) 1951 to 1998: In this phase only DM exists. So each value in articles describing an amount must be in DM. Today DM is history. So these amounts need to be inflation-adjusted and changed into Euro (1 Euro = 1,95583 DM). b) Between 1999-01-01 and 2001-12-31 DM and Euro exists in parallel. So the amount in the article can be given in DM or Euro. Only in the first case it needs to be converted. c) From 2002 we use only Euro. No conversion is needed. An Output schould be everytime in Euro. A manual conversion is possible but not user-friendly. May be we can make the calculation much easier by taking an assumtion, that all amounts in phase b are in DM.

There is no Euro-only inflation. In Europe we measure inflation by country. Even if Germany as well as Ireland use Euro, we have a different inflation rate for both countries. So we have a Inflation rate for Germany, not for the currencies.

Historical inflation rates are a problem. After WW II there was a hyperinflation. The former currency (German Reichsmark) lost the value and was replaced 1948 by the DM. The inflation rates in the 1940s was so high that it would be necessary to know in which month or week the amount was payed to use the right factor. And: Due to the war the quality of the statistics is rather poor. For the time between 1924 an 1940 inflation rates are available. Ther we would need a factor to link the 1940 value with the value of 1951. This is not easy. 1922/23 there was also a hyperinflation with inflation rates which are not usable. In advance there was the German gold mark. If we can link 1924 and 1921 than we can go back to 1876 when the Goldmark was initialy issued. You can see: It´s a little tricky with german currencies.Karsten11 (talk) 06:20, 27 May 2008 (UTC)

Thanks for the information. I've been thinking about this since yesterday, and my conclusion is that it would be very difficult to correctly implement currency conversion in this template. Even if I design a system that makes it easy for the European countries with the Euro, other countries might have much more convoluted situations, and adding a special case for each one, with extra variables that would have different meanings in each case, wouldn't be a good solution. So, my option is to change the template in the following way: it will be currency-agnostic, taking as first parameter not a currency code, but a country code. Later, I or someone else could develop specific currency-conversion templates to take care of the stranger details. This is what such a solution might look like:
{{Currconv|DM|EUR|{{Inflation|DE|1000000|1970|2000}}|additional_parameters}}
This is better, IMHO, because the editor wanting to show in an article how a certain value updates already knows in which currency the original value is (why would he want to know its updated value otherwise?), and in which currency he wants to see the result (it's him who ends up writing the currency symbol before the "formatnum" result anyway). So, since he can himself knowledgeably select these things, there's no point in guessing for him.

It would be helpful to round the results to 2 positions after decimal point.Karsten11 (talk) 11:39, 27 May 2008 (UTC)

This isn't a good idea because of the way MediaWiki produces the results of calculations. You can make a calculation with two positions after the decimal point, but you can't guarantee that the output will contain two digits. For example, if the result was 1234567.8, "formatnum" would show it as "1,234,567.8", not as "1,234,567.80". And since MediaWiki also doesn't provide any advanced string manipulation functions, there's no way to optionally insert that missing "0". So, the best I came with was to do an integer calculus. At least integers don't usually come with missing digits.
And I say "usually" because if MediaWiki decides to present the result in engineering units (for example, "1E+9"), "formatnum" gets completely lost, and there's no way to convert it back to "1,000,000,000" either. It's all very limiting, unfortunately... :-(
PS.: By the way, would you mind if I moved this discussion to the template's talk page? I think it's better to have this talk there, so that others looking at the template itself might know what's going on behind it. -- alexgieg (talk) 18:30, 27 May 2008 (UTC)

This Currconv sounds good. This template can be used in combination with inflation template as well as stand-alone. You are right: The template discussion page is the right place for this discussion.Karsten11 (talk) 08:48, 28 May 2008 (UTC)

In the de:wikipedia the template has been implemented (de:Vorlage:Inflation) We decided on 2 changes compared with the en-version: The conversion from DM to Euro is to be done automatical using the inflation rate of 2001. So a Currconv template is not requested any longer and the complexity of the template has not increased. The second thing is, that we dont link on NaN if a parameter is wrong but defined an template-specific error page.Karsten11 (talk) 11:25, 1 June 2008 (UTC)
Hmm... I like the idea of providing a template-specific error page or message. As for Currconv, I have plans of making it as a fully fledged currency converter template, not only between Euro and pre-Euro currencies, but between any two currencies, accepting an year parameter much like {{Inflation}} does. But if a version with a default, hard-coded conversion is better for use in the German Wikipedia, that's nice too, as I can see how it would be cumbersome to add explicit conversions there. -- alexgieg (talk) 15:33, 6 June 2008 (UTC)

[edit] Hallmark!

I'd like to inform that Slavery has just became the very first (actual) article in Wikipedia using this template!

The previous, hard-coded version informed that the price for a slave in the USA of 1850 ($1,000) would be "about US$38,000 in present-day terms". After changing it to the dynamically generated {{formatnum:{{Inflation|US|1000|1850}}}}, though, it now shows the much more accurate "about US$27,400 in present-day terms".

As this template is updated year after year, articles properly edited to take advantage of it will be automatically update too. What could be better for an online encyclopedia which has the moral obligation of staying accurate? So, let's start editing articles accordingly! It's more than worth the effort!

But a reminder: take care to not change hard-coded values present in citations or from referenced sources. Only values whose source is a Wikipedia editor should be turned into a dynamically generated ones. Otherwise, obviously, those citations would become invalid and the edit would have to be reverted.

Have fun! Image:Smile.svg -- alexgieg (talk) 14:30, 28 May 2008 (UTC)

[edit] Template {{Inflation-fn}}

I've created a new template, {{Inflation-fn|country}}, that makes it easy to add footnotes referencing the source of the data used for calculating inflated values. By using it you'll make the article you're editing even more WP:V compliant. See the new documentation section for a typical usage example. -- alexgieg (talk) 16:30, 30 May 2008 (UTC)

[edit] Template {{Formatprice}}

I've made another cool template: {{Formatprice}}. It avoids the cents problem in the built-in {{formatnum:}}, while adding some nice capabilities for displaying huge numbers. I've just updated the documentation to explain how to use it in addition to the previous method. Give it a look! -- alexgieg (talk) 15:36, 6 June 2008 (UTC)

[edit] No downside

On the down side, {{Formatprice}} has no built-in intelligent handling of user locale settings, what means that some users might see a dot or a comma the opposite way they'd expect.

I'd say that this is no downside. It's a question of language not location. In English it's a dot for the decimal point and commas (spaces or nothing at all) for thousands delimitation. In Germany English should still be English. Please don't "solve" this non-problem. JIMp talk·cont 23:41, 8 June 2008 (UTC)

Hehe, okay, I'll try not to, although I don't think it's even possible. :-) -- alexgieg (talk) 13:37, 9 June 2008 (UTC)

[edit] Various points

Obviously this is a useful starting point for an unflation template: {{US Inflation}} is the only preexisting one and is focussed on the single task of inflating USD to current prices. There are a number of issues I can see with this template, some minor quibbles, some quite serious. Ultimately, I'd like to be able to redirect {{US Inflation}} to call here, but because of those concerns I'd rather not at this time. Anyway problems in roughly descending order:

  1. Copyright: The German information is from the Federal Government, as I can't read German I can't verify if there are any restrictions. However, Measuring Worth asserts copyright, and its terms of use are too restrictive for Wikipedia: We would require commercial re-use. I'm not totally sure if copyright is a concern, but as they both assert copyright and we use their data verbatim its a problem.
  2. Technical: {{Inflation/UK}} (and /US and /DE) calculates the multiplication factor by chaining the year by year inflation. This is over-complicated as the sources provide each years index but not the percentage from year to year. The fact that the raw figures are rounded means rounding errors may occur too. It is also needlessly heavy on system resources: To calculate {{Inflation|UK|1|1300|2000}} requires MediaWiki to evaluate nearly 800 Ifs and then do a multiplication with 700 arguments. A much simpler method would be similar (but not identical) to how {{US Inflation}} handles things.
    1. Have the sub-templates as giant #switch: statements, with each year listing the Index value from the source.
    2. Work out the factor by doing the calculation Index in final year / Index in initial year. For instance, (for USD) for 2000 to 2005 this would be 195.3 / 172.2 ~ 1.13.
    3. This requires 2 calls of a switch, a division with two arguments and then a multiplication by the required amount: 4 calculations as opposed to 1500.
    4. This would also make deflation from 2005 to 2000 trivial: If the years were swapped, the factor would be inverted - with the desired end result.
  3. Data quality: The German data is from the German government, so can surely be assumed to be correct. However the UK and US data comes from a private organisation, and in my experience I've never seen two inflation calculators agree. {{US Inflation}} uses data from the Federal Reserve Bank of Minneapolis, and for 1914 and 2000 their CPI Index figures are 10.0 and 172.2. Measuring Worth's values for the same time are 9.69 and 172.2. This means using Measuring Worth figures produces an inflation over that period which is 3% higher than using figures from the Fed. Which is more accurate? Personally, I'm inclined to go with the government source. Furthermore, what is the sourcing Measuring Worth used to generate all their older figures? If the sources are unreliable, so is the data.
  4. Minor stuff. "400 billion" should be written with a non-breaking space. It would be better to have the subpages at the ISO 4217 codes and not country codes: This allows for multiple currencies in the same nation if required in the future.

That's a few things to be getting on with, though point 1 needs to be dealt with: either by changing the source of the info or getting permission to use their data. Oh and here is Canadian CPI data for 1914 - present.--Nilfanion (talk) 22:53, 10 June 2008 (UTC)

Very good points. I'll have a look at improving the template according to your suggestions over the next few days. Thank you very much for taking the time to help make this alpha template (because that's what it is) a better one. :-)
About point #1: I'm not quite sure their restrictions apply, since as far as I know neither pure facts, nor mathematical equations, are copyrightable, but I'm no copyright law expert, so I might be wrong. In any case, sure, official data is preferable. I see no problem in switching the base data set to the one you suggest.
About point #4: Originally I made this template using currency codes. In fact, you can still use "USD" and "GBP" as codes, they are now redirects to "US" and "UK". However, another user pointed out (see the first thread above) that this doesn't work for EUR, as each European country has its own, independent inflation rate. Thus, a median inflation over a geographical region seemed to us both more in line with the way inflation actually works in practice than the average over a currency itself. But in fact nothing prevents the template from accepting both kinds of codes. Most of the time a currency would be a redirect to an area (or the other way around), with only a few exceptions. EUR itself would be such an exception, as its data set would end up being an average of the individual European Union countries' inflations. -- alexgieg (talk) 02:42, 11 June 2008 (UTC)