PowerExtrapolation.R
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
- Plot in years
plot(x,y) lowessObj <- lowess(y~x) lines(lowessObj)
- Percent increase in electricity price in five years
increase <- diff(range(lowessObj$y)) / diff(range(lowessObj$x)) increase
- Per annum increase
(1+increase) ^ (1/diff(range(lowessObj$x))) - 1