Subject: Re: [xsl] Re: summing up incrementally From: Paul Tremblay <phthenry@xxxxxxxxxxxxx> Date: Fri, 19 Dec 2003 04:29:53 0500 
On Fri, Dec 19, 2003 at 07:12:36AM +0100, Dimitre Novatchev wrote: > > It is quite simple to see that the real comulative increase is the product > of percentages of yearly increases, not their sum. > > E.g. two yearly increases of 50% each give 225% comulative increase. That is > 1.5 x 1.5, or it may be calculated: > > In case the value is 100 at start, it would be 150 after year 1. > > An increase of 50% the second year is 50% of 150  that is 75. > > The value at the end of the second year is 150 + 75 = 225 > > Therefore, the total increase is: 225/100 = 2.25 = 225% > > Your approach to calculating the total increase is wrong  e.g. in the > above case it woud give 100%, not 225%. > I see your reasoning. In fact, I cannot add up percentages. That gives me a false value. But I calculate percent increase by this formula: % increase = (new old)/old * 100 If someone says that their profits increased 100 percent, this usually means it has doubled in value. Perhaps a mathmatician would correct me. However, the modern high school math books teach percentage increase in this way. In your example, I would say that 225 has increased 125 percent from 100. I realize that technically this might be wrong (1.25 * 100 = 125). On the other hand, if you are graphing the increase, you want to have these figures: Graph showing percentage increase for first three years ======================================================= x y = = 1 0 2 50 3 125 The slopes of the lines would be identical if you plotted raw data: Graph showing raw profits for first three years =============================================== x y = = 1 100 2 150 3 225 Here is a partial representation of the real figures: year sales % increase from last year ==== ===== ========================= 1933: 250,516,527  1934: 270,684,797 108 1935: 268,740,483 100 1936: 290,386,935 108 The thesisactually my girlfriend's thesistries to show that as Woolworth chainstores modernized its buildings, its profits increased. I want to make a line graph to illustrate this point. These figures come from the publication itself. However, I just checked them, using this formula: % increase = (year  previousYear)/perviousYear * 100 Originally I had added the percentages to get a 16 percent increase by year 1936 from 1933. If you work the math the right way ((new  old)/new * 100), you come up with 16 percent. If you add the figures, you also come up with 16 percent. But of course, that is a mere coincidence. As you pointed out, you cannot add up percentages. To caculate the figures is to use 1933 as a base year. Hence, this formula: % increase = (year  250,516,527)/250,516,527 * 100 So for the 1934: % = (270,684,797  250,516,527)/250,516,527 * 100 = 8 For 1935: % = (268,740,483  250,516,527)/250,516,527 * 100 = 8 For 1936: % = (290,386,935  250,516,527)/250,516,527 * 100 = 16 Or, if I do it your way: 1.08 * 1.00 * 1.08 = 1.16 Then subtract 100%, or 1, and I get the same answer. Okay, that makes sense! If you start your graph at 0 rather than 100, you simply subract 100 from the result, as I did above. Luckily, I entered the raw data in my XML as well as the percent increase. I so simply did: <xsl:vaiable name = "baseyear" select = "/data/year[1]/record[@month = 'December']/@targetyeartodate"/> Then, when I want to find the percent increase, I can do: <xsl:valueof select = "round((@targetyeartodate  $baseyear)/$baseyear * 100)"/> As I said in the last post, this math doesn't take inflation into account. From 1934 to 1942, Woolworth increased around 70 percent. Perhaps their sales did really increase this much; but I think inflation would probably bring the number down. Sorry this post is so long. I started off by thinking you didn't understand my problem. Then I thought that you might be partially wrong. And as I wrote it I realized you were completely correct. Paul  PS 225 is 225% of 100 225 shows a 125% increase from 100 I think both these statements are correct? ************************ *Paul Tremblay * *phthenry@xxxxxxxxxxxxx* ************************ XSLList info and archive: http://www.mulberrytech.com/xsl/xsllist
Current Thread 


< Previous  Index  Next > 

[xsl] Re: summing up incrementally, Dimitre Novatchev  Thread  RE: [xsl] Re: summing up incrementa, kakridge 
Re: [xsl] Why template match differ, Rakesh  Date  Re: [xsl] Unique Node Value in for, Rakesh 
Month 