**factbased**, and kindly contributed to R-bloggers)

After looking at my heating expenses, I turned to the costs for water heating. For some time, I looked at my water meter before and after taking a shower or a bath. Quite often, I forgot one or the other measurement, but I collected about 40 observations. Here is what they look like:

The data suggest that for a shower, it takes between 17 and 26.5 liters hot water and between 11 and 16.5 liters cold water. For a bath, it is 60 to 77 liters hot water and 24 to 32.5 liters cold water. (The numbers refer to the 25% and 75% percentiles, respectively.) The larger share of cold water for a shower makes sense, since I use cold water at the end of the shower for its โinvigorating effectโ.

Multiplied with the average costs, as charged by my landlord the last three years, a bath takes 0.94 to 1.22 EUR and a shower costs 0.29 to 0.45 EUR (again, first and third quartiles). So taking a shower for 0.50 EUR at the fitness club is not optimal, but also not very expensive.

There are water saving shower heads for 30 EUR. It is advertised that such a shower head uses 6.5 liter per minute instead the usual 15 to 16 liters per minute. I believe 15 liters per minute is too much. So letโs assume I save 3.5 liters per minute or (using the median water use of the data) 12 liters per shower. Is it cost-efficient?

Twelve liters less per shower at 10.5 EUR/cbm means a saving of 0.126 EUR per shower. I assume 20 showers a month. This is tentative, since with this assumption the costs sum up to 70 EUR a year for hot water while my bills amount in average to 110 EUR total costs for hot water. So the new shower head saves 20*0.126=2.52 EUR per month.

Letโs calculate the payback period. With an interest rate of 4% p.a. and 5 years expected serviceable life the monthly gain calculates to

2.โ52โ -โ 30โ *โ 0.โ04โ /โ 12โ -โ 30โ /โ (5โ *โ 12)โ=โ1.โ92

so after 30โ
/โ
1.โ92โ=โ16 months, the investment is repaid. This seems acceptable. But just to be sure, letโs calculate the internal rate of return, too. In excel, there is a function `IRR`

for this procedure, which is implemented in three lines in R. For convenience, the `irr`

function is stored in the `pft`

package. The result is 8.3% which seems decent.

Just for reference, here comes the R code for the plot and the `irr`

function:

**leave a comment**for the author, please follow the link and comment on their blog:

**factbased**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...