SHARE
TWEET

Untitled

a guest Apr 18th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. model_order = c(1,1,3)
  4. model_seasonal = c(1,1,1)
  5. model_period = 24
  6. model_xreg = temp[169:816]
  7. #kun aikasarja on stationaarinen, luodaan malli differoidulle aikasarjalle valitsemalla kertaluvut korrelaatiofunktioiden avulla
  8. model = arima(dele168, order=model_order, seasonal=list(order=model_seasonal, period=24), method="CSS", xreg=model_xreg)
  9.  
  10.  
  11. dele_t = 168
  12. pre_ele = ele[1:(816-dele_t)]
  13. pre_dele168 = diff(pre_ele, lag = 168, difference = 1)
  14. pre_model = arima(pre_dele168, order=model_order, seasonal=list(order=model_seasonal, period=model_period), method="CSS", xreg=model_xreg[1:(length(model_xreg)-dele_t)])
  15.  
  16. pre_predict = predict(model, newxreg=temp[(817-dele_t):816], n.ahead=dele_t)
  17.  
  18.  
  19. pre_values = append(ele[1:(816-dele_t)], (ele[(816-167-dele_t):((816-168-dele_t)+dele_t)] + pre_predict$pred[1:dele_t]))
  20.  
  21. pre_enne = ts(pre_values, frequency = 24)
  22. plot(t[(816-dele_t):816], pre_values[(816-dele_t):816], col="red", "l")
  23. lines(t[(816-dele_t):816], ele[(816-dele_t):816], col="blue", "l")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top