KJE.Default.INFLATION_ID=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91];KJE.Default.INFLATION_RATES=[2.4,0.9,-1.9,-1.2,0,-2.7,-8.9,-10.3,-5.2,3.5,2.6,1,3.7,-2,-1.3,0.7,5.1,10.9,6,1.6,2.3,8.5,14.4,7.7,-1,1.1,7.9,2.3,0.8,0.3,-0.3,1.5,3.3,2.7,1.1,1.5,1.1,1.2,1.2,1.3,1.6,3,2.8,4.3,5.5,5.8,4.3,3.3,6.2,11.1,9.1,5.7,6.5,7.6,11.3,13.5,10.3,6.1,3.2,4.3,3.5,1.9,3.7,4.1,4.8,5.4,4.2,3,3,2.6,2.8,2.9,2.3,1.6,2.2,3.4,2.8,1.6,2.3,2.7,3.4,3.2,2.9,3.8,-0.4,1.6,3.2,2.1,1.5,1.6,0.1,1.1];KJE.Default.INFLATION_INDEX=[17.5,17.7,17.4,17.2,17.2,16.7,15.2,13.6,12.9,13.4,13.7,13.9,14.4,14.1,13.9,14,14.7,16.3,17.3,17.6,18,19.5,22.3,24,23.8,24.1,26,26.6,26.8,26.9,26.8,27.2,28.1,28.9,29.2,29.6,29.9,30.3,30.6,31,31.5,32.5,33.4,34.8,36.7,38.8,40.5,41.8,44.4,49.3,53.8,56.9,60.6,65.2,72.6,82.4,90.9,96.5,99.6,103.9,107.6,109.6,113.6,118.3,124,130.7,136.2,140.3,144.5,148.2,152.4,156.9,160.5,163,166.6,172.2,177.1,179.9,184,188.9,195.3,201.6,207.3,215.3,214.5,218.1,224.9,229.6,233,236.7,237,239.5];KJE.Default.INFLATION_YEAR=[1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016];KJE.Default.INFLATION_INDEX_1924=17.1;KJE.Default.INFLATION_FIRST_YEAR=0;KJE.Default.INFLATION_LAST_YEAR=KJE.Default.INFLATION_YEAR.length-1;KJE.Default.INFLATION_YEAR_1980=1980-KJE.Default.INFLATION_YEAR[0];KJE.InflationPriceCalc=function(){this.iDecimal=2;this.MSG_ERROR1=KJE.parameters.get("MSG_ERROR1","The start year must be before the end year.");this.DR_BALANCE_BFI=KJE.FloatArray(2);this.catLabels=[KJE.parameters.get("MSG_CAT1","KJE1 Price"),KJE.parameters.get("MSG_CAT2","KJE1 Price")];this.cats2=new Array(2);this.sSchedule=new KJE.Repeating()};KJE.InflationPriceCalc.prototype.clear=function(){this.STARTING_AMOUNT=0;this.YEAR_START_ID=KJE.Default.INFLATION_FIRST_YEAR;this.YEAR_END_ID=KJE.Default.INFLATION_LAST_YEAR};KJE.InflationPriceCalc.prototype.calculate=function(u){var d=KJE;var b=this.STARTING_AMOUNT;var p=this.YEAR_START_ID;var a=this.YEAR_END_ID;var q=KJE.Default.INFLATION_YEAR[p];var h=a-p;if(h<1){throw this.MSG_ERROR1}var j=Math.round(h);var c=this.DR_BALANCE=KJE.FloatArray(j+1);var s=this.DR_BALANCE_INFLATION=KJE.FloatArray(j+1);var g=this.cats=new Array(j+1);c[0]=b;s[0]=b;g[0]=d.input(q);if(u){var e=this.sSchedule;e.clearRepeat();e.addHeader(e.sReportCol("Year",1),e.sReportCol("Inflation Rate",2),e.sReportCol("Inflation Adjusted Price",3));e.addRepeat(g[0]," ",d.dollars(b))}var t=KJE.Default.INFLATION_RATES;var f=KJE.Default.INFLATION_INDEX;var r=0;var m=0;var k=f[p];var o=0;for(var l=1;l<=j;l++){o=l-1;r=t[p+l]/100;m=f[p+l]/k;g[l]=d.input(l+q);c[l]=b;s[l]=m*b;if(u){e.addRepeat(g[l],d.percent(r,1),d.dollars(s[l]))}}o=c.length-1;this.YEAR_START=KJE.Default.INFLATION_YEAR[p];this.YEAR_END=KJE.Default.INFLATION_YEAR[a];this.ENDING_BALANCE=this.DR_BALANCE_BFI[0]=c[o];this.ENDING_AMOUNT=this.DR_BALANCE_BFI[1]=s[o];this.cats2[0]=KJE.getKJEReplaced(this.catLabels[1],this.YEAR_START);this.cats2[1]=KJE.getKJEReplaced(this.catLabels[1],this.YEAR_END);this.YEARS_TO_SAVE=h;this.PERIOD_VALUE=(f[a]/k);this.PERIOD_REDUCTION=1-k/f[a]};KJE.InflationPriceCalc.prototype.formatReport=function(b){var c=KJE;var a=this.iDecimal;var d=b;d=KJE.replace("YEAR_START",c.input(this.YEAR_START,0),d);d=KJE.replace("YEAR_END",c.input(this.YEAR_END,0),d);d=KJE.replace("STARTING_AMOUNT",c.dollars(this.STARTING_AMOUNT,a),d);d=KJE.replace("YEARS_TO_SAVE",c.number(this.YEARS_TO_SAVE,0),d);d=KJE.replace("ENDING_AMOUNT",c.dollars(this.ENDING_AMOUNT,a),d);d=KJE.replace("ENDING_BALANCE",c.dollars(this.ENDING_BALANCE,a),d);d=KJE.replace("PERIOD_VALUE",c.percent(this.PERIOD_VALUE,1),d);d=KJE.replace("PERIOD_REDUCTION",c.percent(this.PERIOD_REDUCTION,1),d);d=d.replace("**REPEATING GROUP**",this.sSchedule.getRepeat());this.sSchedule.clearRepeat();return d};KJE.CalcName="Inflation and Consumer Prices Calculator";KJE.CalcType="InflationPrice";KJE.CalculatorTitleTemplate="Price of KJE1 in KJE3 increased to KJE2 in KJE4.";KJE.parseInputs=function(b){var a=KJE.getDropBox("YEAR_START_ID",KJE.parameters.get("YEAR_START_ID",KJE.Default.INFLATION_FIRST_YEAR),KJE.Default.INFLATION_ID,KJE.Default.INFLATION_YEAR);b=KJE.replace("**YEAR_START_ID**",a,b);var a=KJE.getDropBox("YEAR_END_ID",KJE.parameters.get("YEAR_END_ID",KJE.Default.INFLATION_LAST_YEAR),KJE.Default.INFLATION_ID,KJE.Default.INFLATION_YEAR);b=KJE.replace("**YEAR_END_ID**",a,b);return b};KJE.initialize=function(){KJE.CalcControl=new KJE.InflationPriceCalc();KJE.GuiControl=new KJE.InflationPrice(KJE.CalcControl)};KJE.InflationPrice=function(f){var e=KJE;var c=KJE.gLegend;var b=KJE.inputs.items;KJE.DollarSlider("STARTING_AMOUNT","Price",0,1000000000000,2,0,0);KJE.DropBoxSlider("YEAR_START_ID","Starting year",KJE.Default.INFLATION_YEAR);KJE.DropBoxSlider("YEAR_END_ID","Ending year",KJE.Default.INFLATION_YEAR);KJE.Label("INFLATION_RATE","Total inflation",null,null,"KJEBold");KJE.Label("ENDING_AMOUNT","Price");this.MSG_PRICE=KJE.parameters.get("MSG_PRICE","Price in")+" ";this.MSG_INCREASE=KJE.parameters.get("MSG_INCREASE","KJE1 increase in price");this.MSG_PRICE_INCREASE=KJE.parameters.get("MSG_PRICE_INCREASE","KJE1");this.MSG_ORIGINAL_PRICE=KJE.parameters.get("MSG_ORIGINAL_PRICE","Original price");this.MSG_INFLATION_ADJUSTED=KJE.parameters.get("MSG_INFLATION_ADJUSTED","Inflation adjusted");var a=KJE.gNewGraph(KJE.gCATEGORIES,"GRAPH1",true,false,KJE.colorList[1],KJE.parameters.get("MSG_GRAPH_TITLE2","Inflation Adjusted Prices"));a._legend._iOrientation=(c.TOP_RIGHT);a._showItemLabelOnTop=true;a._axisX._fSpacingPercent=0.3;a._grid._showYGridLines=false;a._axisX.setVisible(false);a._showItemLabel=true;a._bPopDetail=true;a._showItemLabelDecimals=2;var a=KJE.gNewGraph(KJE.gLINE,"GRAPH2",true,true,KJE.colorList[1],KJE.parameters.get("MSG_GRAPH_TITLE","Price changes from KJE1 to KJE2 with Inflation"));a._legend._iOrientation=(c.TOP_RIGHT);a._iArea=KJE.gGraphLine.AREA_FIRST_ONLY;a._showItemLabelDecimals=2;a._bPopDetail=true;var d=KJE.parameters.get("MSG_DROPPER_TITLE","Inflation inputs:");KJE.addDropper(new KJE.Dropper("INPUTS",true,d,d),KJE.colorList[0])};KJE.InflationPrice.prototype.setValues=function(b){var a=KJE.inputs.items;b.STARTING_AMOUNT=a.STARTING_AMOUNT.getValue();b.YEAR_END_ID=a.YEAR_END_ID.getValue();b.YEAR_START_ID=a.YEAR_START_ID.getValue()};KJE.InflationPrice.prototype.refresh=function(f){var e=KJE;var d=KJE.gLegend;var b=KJE.inputs.items;var a=KJE.gGraphs[0];var c=KJE.gGraphs[1];KJE.setTitleTemplate(e.dollars(f.STARTING_AMOUNT,2),e.dollars(f.ENDING_AMOUNT,2),e.input(f.YEAR_START),e.input(f.YEAR_END));a.removeAll();a.setGraphCategories(f.cats2);a.add(new KJE.gGraphDataSeries(f.DR_BALANCE_BFI,f.cats2[0],a.getColor(1),null,null,null,2));a.paint();c.removeAll();c.setGraphCategories(f.cats);c.setTitleTemplate(e.input(f.YEAR_START),e.input(f.YEAR_END),e.percent(f.PERIOD_REDUCTION,1));c.add(new KJE.gGraphDataSeries(f.DR_BALANCE_INFLATION,f.cats2[1],c.getColor(2),null,this.MSG_INFLATION_ADJUSTED,null,2));c.add(new KJE.gGraphDataSeries(f.DR_BALANCE,f.cats2[0],c.getColor(1),null,this.MSG_ORIGINAL_PRICE,null,2));c.paint();b.INFLATION_RATE.setValue(KJE.getKJEReplaced(this.MSG_INCREASE,e.percent(f.PERIOD_VALUE,1)),true);b.ENDING_AMOUNT.setValue(KJE.getKJEReplaced(this.MSG_PRICE_INCREASE,e.dollars(f.ENDING_AMOUNT,2),e.input(f.YEAR_START),e.input(f.YEAR_END)),true);KJE.setLabelWrap(b.STARTING_AMOUNT._label,"KJE-STARTING_AMOUNT",false,null,this.MSG_PRICE+f.YEAR_START+KJE.Colon);KJE.setLabelWrap(b.ENDING_AMOUNT._label,"KJE-ENDING_AMOUNT",false,null,this.MSG_PRICE+f.YEAR_END+KJE.Colon)};KJE.InputScreenText="
The underlying data supplies an annual CPI rate and a base amount which represents the relative purchasing power for that year. For example, in 1980 the base amount was 82.4 compared to 224.9 in 2011. In this example, $224.90 in 2011 would have the same purchasing power as $82.40 in 1980. The calculations use the base amounts to calculate the difference between any two years. There are small data discrepancies and loss of precision through rounding in the underlying data supplied by the Federal Reserve. These discrepancies can cause differences between the annual change in base amounts and the stated CPI rate for any given year.
Price in YEAR_START | STARTING_AMOUNT |
---|---|
Price in YEAR_END | ENDING_AMOUNT |
Years of inflation | YEARS_TO_SAVE years |
Total inflation | PERIOD_VALUE increase in price |