How to remove seasonality from daily electricity demand I want to remove seasonality from daily electricity demand (a time series). My understanding is there is weekly (high demand on Tue, Wed, and low demand on Sat, Sun) and annual seasonality (high demand on Winter and lower on Summer). I tried to build a model to forecast daily electricity demand in R, and plot my data as shown below:

I tried to remove seasonality with the following:
demand.xts.diff<-diff(demand.xts,lag=1,difference=1)
demand.xts.diff<-diff(demand.xts,lag=7,difference=1)

I also tried to use lag=365 and lag=366 (I am not sure what lag to use, due to the leap year issue), but none of them successfully removed seasonality. The ACF and PACF are shown below:


Any advice is appreciated.
 A: Modeling daily electricity demand is a data intensive effort.   To simplify this, it's easier to start "zoomed out", estimating monthly loads.   Here's an article (with a Youtube video) that describes a monthly model that is simple and easy to understand.  The article includes R code:
http://revgr.com/2012/11/06/all-forecasts-are-wrong-but-some-generate-fewer-complaints/
As you "zoom in" to shorter time frames the problem gets more and more complicated.   For example, the monthly model includes an integer 12 months/year and starts at the beginning of month 1, while a weekly model includes a non-integer 52.18 weeks/year and might begin at the start of a week, middle of the week, end of the week, etc (i.e. you can't directly compare "week 1" of one year to "week 1" of the next year, they start on different days).    It gets more complicated when you drop down to daily or hourly time frames.
The hierarchy in time frames, starting with the longest time frame, is typically:
1) Population growth and economic activity.
2) Long term seasonal temperature terms (summer, winter, etc).
3) Day of the week (Tuesday, Wednesday and Thursday are typically similar workdays; the remaining days have their own individual "day-of-the-week" values).
4) Holidays, the day before and the day after a holiday (many holidays have a similar value as a typical Sunday "day-of-the-week" value).
5) Temperature due to time of day, cooler nights, warmer days, is the sun shining, is it raining, etc. (this is a refinement of item 2 above).
6) Work load during the day.  People are typically at home during the night and at work during the day, so lot of electricity consuming workplaces shut down at night.
7) Other terms such as humidity, daylight savings time, etc.
The bottom line is, at the daily and hourly time frames, a lot of data (and complexity) is required.
You can Google "daily electrical load models" (or hourly models) and various papers will show up.  Some are based on neural nets, support vector machines, etc.    Here's a link to a paper by Rob Hyndman that explains another technique.
http://www.tandfonline.com/doi/abs/10.1198/jasa.2011.tm09771#.UrNTUtJDuyw
The methods used in that paper are in the "forecast" package:
http://robjhyndman.com/software/forecast/
A: i'm having a fabulous run with ucm. You could model this as daily seasonality & with an annual cycle. You also have a very evident trend. 
Post back here if you succeeded with ucm (proc ucm)
