Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

.Rhistory 1007 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  1. # Importando los datos
  2. library(readr)
  3. APTelectric <- read_csv("A CURSO SERIES TEMPORALES (NUEVO)/Clases Nuevas/Redes Neuronales para series/Clase 9/APTelectricity.csv",
  4. col_types = cols(X1 = col_skip()))
  5. library(readr)
  6. APTelectricity <- read_csv("APTelectricity.csv")
  7. View(APTelectricity)
  8. # Objeto ts
  9. myts = ts(APTelectric$watt, frequency = 288)
  10. APTelectric=APTelectricity
  11. # Objeto ts
  12. myts = ts(APTelectric$watt, frequency = 288)
  13. plot(myts)
  14. # Ajuste del modelo
  15. library(forecast)
  16. fit = nnetar(myts)
  17. # Predicciones
  18. nnetforecast <- forecast(fit, h = 400, PI = F)
  19. library(ggplot2)
  20. autoplot(nnetforecast)
  21. # Usando una variable ex?gena
  22. fit2 = nnetar(myts, xreg = APTelectric$appliances)
  23. # Definiendo los pron?sticos de la variable ex?gena para 10 horas
  24. y =rep(2, times = 12*10)
  25. nnetforecast <- forecast(fit2, xreg = y, PI = F)
  26. autoplot(nnetforecast)
  27. # Definiendo los pron?sticos de la variable ex?gena para 30 horas
  28. y =rep(2, times = 12*30)
  29. nnetforecast <- forecast(fit2, xreg = y, PI = F)
  30. autoplot(nnetforecast)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...