Difference between revisions of "PowerExtrapolation.R"

From Organic Design wiki
(Corrected calc 45% increase in 5 years = 6.9% per annum)
m
Line 41: Line 41:
 
increase
 
increase
  
# Per annum increase
+
# Per annum increase (approximate, trend is linear not exponential compounding)
 
(1+increase) ^ (1/diff(range(lowessObj$x))) - 1
 
(1+increase) ^ (1/diff(range(lowessObj$x))) - 1

Revision as of 01:21, 12 February 2007

library(chron)

dset <- scan(what="") 11/1/00 10.70 60 5/1/02 11.81 33.26 1/1/02 12.36 34.8 4/1/02 11.84 33.67 10/1/02 11.82 33.64 3/1/03 11.82 33.33 10/1/03 13.84 33.33 10/1/04 13.77 33.33 11/1/04 15.26 33.33 12/1/04 14.07 59.59 4/1/05 14.528 60.55 10/1/05 15.7 64.68 3/1/06 16.4 66.02 6/1/06 14.78 33.33 ""

dim(dset) <- c(3, length(dset)/3) dset <- as.data.frame(t(dset)) colnames(dset) <- c("Date", "kwh", "dailyCharge")

dset$Date <- dates(levels(dset$Date)[unclass(dset$Date)])


plot(dset$Date, as.numeric(as.vector(dset$kwh)))


y <- as.numeric(as.vector(dset$kwh)) x <- (dset$Date - dates("11/01/00")) / 365.25

  1. Plot in years

plot(x,y) lowessObj <- lowess(y~x) lines(lowessObj)

  1. Percent increase in electricity price in five years
  2. Percent increase in electricity price in five years

increase <- diff(range(lowessObj$y)) / min(lowessObj$y) increase

  1. Per annum increase (approximate, trend is linear not exponential compounding)

(1+increase) ^ (1/diff(range(lowessObj$x))) - 1