library(fpp3)
## ── Attaching packages ──────────────────────────────────────────── fpp3 0.4.0 ──
## ✔ tibble 3.1.8 ✔ tsibble 1.1.2
## ✔ dplyr 1.0.9 ✔ tsibbledata 0.4.0
## ✔ tidyr 1.2.0 ✔ feasts 0.2.2
## ✔ lubridate 1.8.0 ✔ fable 0.3.1
## ✔ ggplot2 3.3.6
## ── Conflicts ───────────────────────────────────────────────── fpp3_conflicts ──
## ✖ lubridate::date() masks base::date()
## ✖ dplyr::filter() masks stats::filter()
## ✖ tsibble::intersect() masks base::intersect()
## ✖ tsibble::interval() masks lubridate::interval()
## ✖ dplyr::lag() masks stats::lag()
## ✖ tsibble::setdiff() masks base::setdiff()
## ✖ tsibble::union() masks base::union()
library(readxl)
Plotting the data
TSLA_MAX_Years <- read_excel("C:/Users/natha/Desktop/Forecasting in R/TSLA MAX Years.xlsx")
TSLA <- TSLA_MAX_Years
TSLAtsib <- TSLA%>%
mutate(day = row_number())%>%
as_tsibble(index = day)
head(TSLAtsib)
## # A tsibble: 6 x 3 [1]
## Date Close day
## <dttm> <dbl> <int>
## 1 2010-06-29 00:00:00 1.59 1
## 2 2010-06-30 00:00:00 1.59 2
## 3 2010-07-01 00:00:00 1.46 3
## 4 2010-07-02 00:00:00 1.28 4
## 5 2010-07-06 00:00:00 1.07 5
## 6 2010-07-07 00:00:00 1.05 6
TSLA%>%
ggplot(aes(x = Date))+ geom_line(aes(y = Close))
This graph shows Tesla’s stock price through time. The company has developed since it’s IPO, which leads me to believe that it is most appropriate to only consider the data from 2020 at the latest. After a quick fundamental analysis, Tesla has only recently had a positive EPS. This suggest that investors are heavily speculating on TSLA’s future. Elon Musk has proven in the past that his action heavily impact the market and because of this I decided to slice the data into 5 ways: price since 2020, 2021, 2022(YTD), the price since the announcement of Musk’s plan to acquire Twitter, and the price since he’s owned Twitter. I am doing this because the momentum of a stock’s price is heavily driven by the most recent events and information.
#Jan. 1, 2020 - Current
TSLA2020 <- TSLAtsib%>%
slice(2395:3120)
#Jan. 1, 2021 - Current
TSLA2021 <- TSLAtsib%>%
slice(2648:3120)
#Jan. 1, 2022 - Current
TSLAytd <- TSLAtsib%>%
slice(2900:3120)
#April 14, 2022 (the day Elon Musk announced he wanted to buy Twitter) - Current
Twitstart <- TSLAtsib%>%
slice(2971:3120)
#Oct. 27,2022 (The day Elon became owner of Twitter) - Current
Twitterowned <- TSLAtsib%>%
slice(3106:3120)
Below shows the plots of TSLA stock price at the different starting points. With the exception of 2020’s upward trend, every graph has a downward trend.
#Jan. 1, 2020 - Current
TSLA2020%>%
ggplot(aes(x = Date))+ geom_line(aes(y = Close))
#Jan. 1, 2021 - Current
TSLA2021%>%
ggplot(aes(x = Date))+ geom_line(aes(y = Close))
#Jan. 1, 2022 - Current
TSLAytd%>%
ggplot(aes(x = Date))+ geom_line(aes(y = Close))
#April 14, 2022 (the day Elon Musk announced he wanted to buy Twitter) - Current
Twitstart%>%
ggplot(aes(x = Date))+ geom_line(aes(y = Close))
#Oct. 27,2022 (The day Elon became owner of Twitter) - Current
Twitterowned%>%
ggplot(aes(x = Date))+ geom_line(aes(y = Close))
Exponential Smoothing and ARIMA models
#Determining the best model, PI, and point forecast using the 2021 dataset.
head(TSLA2021)
## # A tsibble: 6 x 3 [1]
## Date Close day
## <dttm> <dbl> <int>
## 1 2021-01-04 00:00:00 243. 2648
## 2 2021-01-05 00:00:00 245. 2649
## 3 2021-01-06 00:00:00 252. 2650
## 4 2021-01-07 00:00:00 272. 2651
## 5 2021-01-08 00:00:00 293. 2652
## 6 2021-01-11 00:00:00 270. 2653
TSLA2021%>%
autoplot(difference(Close))
## Warning: Removed 1 row(s) containing missing values (geom_path).
wntsla2021 <- TSLA2021%>%
features(difference(Close),ljung_box,lag=10)
wntsla2021
## # A tibble: 1 × 2
## lb_stat lb_pvalue
## <dbl> <dbl>
## 1 19.9 0.0299
#The P value is less than .05, which means I will be using a first difference in my ARIMA model.
TSLA2021%>%
gg_tsdisplay(difference(Close), plot_type='partial')
## Warning: Removed 1 row(s) containing missing values (geom_path).
## Warning: Removed 1 rows containing missing values (geom_point).
#The ACF and PACF show some autocorrelation in the model, however, the effected lags are too far into the past to matter. For this data set I will be using an ARIMA(0,1,0).
TSLA2021models <- TSLA2021%>%
model(arima020 = ARIMA(Close ~ pdq(0,1,0)),
stepwise = ARIMA(Close),
search = ARIMA(Close, stepwise=FALSE),
'Auto' = ETS(Close),
'Simple' = ETS(Close ~ error("A") + trend("N") + season("N")),
'Holt-Winters' = ETS(Close ~ error("A") + trend("A") + season("N")),
'Damped Holt-Winters' = ETS(Close ~ error("A") + trend("Ad") + season("N")))
TSLA2021models
## # A mable: 1 x 7
## arima020 stepwise search Auto Simple
## <model> <model> <model> <model> <model>
## 1 <ARIMA(0,1,0)> <ARIMA(0,1,0)> <ARIMA(4,1,2)> <ETS(M,N,N)> <ETS(A,N,N)>
## # … with 2 more variables: `Holt-Winters` <model>,
## # `Damped Holt-Winters` <model>
TSLA2021models%>%
glance()
## # A tibble: 7 × 11
## .model sigma2 log_lik AIC AICc BIC ar_ro…¹ ma_ro…² MSE AMSE MAE
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <list> <list> <dbl> <dbl> <dbl>
## 1 arima020 1.10e+2 -1779. 3559. 3559. 3563. <cpl> <cpl> NA NA NA
## 2 stepwise 1.10e+2 -1779. 3559. 3559. 3563. <cpl> <cpl> NA NA NA
## 3 search 1.08e+2 -1771. 3556. 3556. 3585. <cpl> <cpl> NA NA NA
## 4 Auto 1.43e-3 -2542. 5091. 5091. 5103. <NULL> <NULL> 109. 210. 0.0278
## 5 Simple 1.10e+2 -2567. 5140. 5140. 5152. <NULL> <NULL> 109. 210. 7.51
## 6 Holt-Wi… 1.10e+2 -2567. 5144. 5144. 5165. <NULL> <NULL> 109. 211. 7.52
## 7 Damped … 1.10e+2 -2567. 5146. 5146. 5171. <NULL> <NULL> 109. 209. 7.52
## # … with abbreviated variable names ¹ar_roots, ²ma_roots
#The ARIMA search (ARIMA(4,1,2)) model has the lowest AICc, however, it's only slightly lower than the ARIMA(0,1,0) I determined from earlier.
TSLA2021fit <- TSLA2021%>%
model(ARIMA(Close~pdq(0,1,0)))
TSLA2021fc <- TSLA2021fit%>%
forecast(h=1)
TSLA2021fc
## # A fable: 1 x 4 [1]
## # Key: .model [1]
## .model day Close .mean
## <chr> <dbl> <dist> <dbl>
## 1 ARIMA(Close ~ pdq(0, 1, 0)) 3121 N(187, 110) 187.
hilo(TSLA2021fc)
## # A tsibble: 1 x 6 [1]
## # Key: .model [1]
## .model day Close .mean `80%` `95%`
## <chr> <dbl> <dist> <dbl> <hilo> <hilo>
## 1 ARIMA(C… 3121 N(187, 110) 187. [173.4907, 200.3493]80 [166.3816, 207.4584]95
#The 2021 ARIMA(0,1,0) model has produced a point forecast of $187 with a PI of [173.49, 200.35].
#Determining the best model, PI, and point forecast using the 2020 data set.
head(TSLA2020)
## # A tsibble: 6 x 3 [1]
## Date Close day
## <dttm> <dbl> <int>
## 1 2020-01-02 00:00:00 28.7 2395
## 2 2020-01-03 00:00:00 29.5 2396
## 3 2020-01-06 00:00:00 30.1 2397
## 4 2020-01-07 00:00:00 31.3 2398
## 5 2020-01-08 00:00:00 32.8 2399
## 6 2020-01-09 00:00:00 32.1 2400
TSLA2020%>%
autoplot(difference(Close))
## Warning: Removed 1 row(s) containing missing values (geom_path).
wntsla2020 <- TSLA2020%>%
features(difference(Close),ljung_box,lag=10)
wntsla2020
## # A tibble: 1 × 2
## lb_stat lb_pvalue
## <dbl> <dbl>
## 1 25.1 0.00520
#The P value is less than .05, which means I will be using the first difference in my ARIMA model.
TSLA2020%>%
gg_tsdisplay(difference(Close), plot_type='partial')
## Warning: Removed 1 row(s) containing missing values (geom_path).
## Removed 1 rows containing missing values (geom_point).
#The ACF and PACF show some autocorrelation in the model, however, the effected lagges are too far into the past to matter. For this data set I will be using an ARIMA(0,1,0).
TSLA2020models <- TSLA2020%>%
model(arima020 = ARIMA(Close ~ pdq(0,1,0)),
stepwise = ARIMA(Close),
search = ARIMA(Close, stepwise=FALSE),
'Auto' = ETS(Close),
'Simple' = ETS(Close ~ error("A") + trend("N") + season("N")),
'Holt-Winters' = ETS(Close ~ error("A") + trend("A") + season("N")),
'Damped Holt-Winters' = ETS(Close ~ error("A") + trend("Ad") + season("N")))
TSLA2020models
## # A mable: 1 x 7
## arima020 stepwise search Auto Simple
## <model> <model> <model> <model> <model>
## 1 <ARIMA(0,1,0)> <ARIMA(0,1,0)> <ARIMA(2,1,4)> <ETS(M,A,N)> <ETS(A,N,N)>
## # … with 2 more variables: `Holt-Winters` <model>,
## # `Damped Holt-Winters` <model>
TSLA2020models%>%
glance()
## # A tibble: 7 × 11
## .model sigma2 log_lik AIC AICc BIC ar_ro…¹ ma_ro…² MSE AMSE MAE
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <list> <list> <dbl> <dbl> <dbl>
## 1 arima020 8.16e+1 -2625. 5251. 5251. 5256. <cpl> <cpl> NA NA NA
## 2 stepwise 8.16e+1 -2625. 5251. 5251. 5256. <cpl> <cpl> NA NA NA
## 3 search 8.00e+1 -2614. 5242. 5243. 5275. <cpl> <cpl> NA NA NA
## 4 Auto 2.01e-3 -3884. 7778. 7778. 7801. <NULL> <NULL> 81.5 158. 0.0319
## 5 Simple 8.16e+1 -3988. 7982. 7982. 7996. <NULL> <NULL> 81.4 157. 6.17
## 6 Holt-Wi… 8.18e+1 -3988. 7986. 7986. 8009. <NULL> <NULL> 81.3 157. 6.16
## 7 Damped … 8.19e+1 -3988. 7988. 7988. 8015. <NULL> <NULL> 81.3 157. 6.16
## # … with abbreviated variable names ¹ar_roots, ²ma_roots
#The ARIMA search (ARIMA(2,1,4)) model has the lowest AICc.
TSLA2020fit <- TSLA2020%>%
model(ARIMA(Close~pdq(2,1,4)))
TSLA2020fc <- TSLA2020fit%>%
forecast(h=1)
TSLA2020fc
## # A fable: 1 x 4 [1]
## # Key: .model [1]
## .model day Close .mean
## <chr> <dbl> <dist> <dbl>
## 1 ARIMA(Close ~ pdq(2, 1, 4)) 3121 N(186, 80) 186.
hilo(TSLA2020fc)
## # A tsibble: 1 x 6 [1]
## # Key: .model [1]
## .model day Close .mean `80%` `95%`
## <chr> <dbl> <dist> <dbl> <hilo> <hilo>
## 1 ARIMA(Cl… 3121 N(186, 80) 186. [174.8737, 197.7933]80 [168.8073, 203.8597]95
#The 2020 ARIMA(2,1,4) model has produced a point forecast of $186 with a PI of [174.87, 197.79].
#Determining the best model, PI, and point forecast using the 2022 YTD data set.
head(TSLAytd)
## # A tsibble: 6 x 3 [1]
## Date Close day
## <dttm> <dbl> <int>
## 1 2022-01-03 00:00:00 400. 2900
## 2 2022-01-04 00:00:00 383. 2901
## 3 2022-01-05 00:00:00 363. 2902
## 4 2022-01-06 00:00:00 355. 2903
## 5 2022-01-07 00:00:00 342. 2904
## 6 2022-01-10 00:00:00 353. 2905
TSLAytd%>%
autoplot(difference(Close))
## Warning: Removed 1 row(s) containing missing values (geom_path).
wntslaytd <- TSLAytd%>%
features(difference(Close),ljung_box,lag=10)
wntslaytd
## # A tibble: 1 × 2
## lb_stat lb_pvalue
## <dbl> <dbl>
## 1 29.5 0.00104
#The P value is less than .05, which means I will be using the first difference in my ARIMA model.
TSLAytd%>%
gg_tsdisplay(difference(Close), plot_type='partial')
## Warning: Removed 1 row(s) containing missing values (geom_path).
## Removed 1 rows containing missing values (geom_point).
#The ACF and PACF show some autocorrelation in the model, however, the effected lags are too far into the past to matter. For this data set I will be using an ARIMA(0,1,0).
TSLAytdmodels <- TSLAytd%>%
model(arima020 = ARIMA(Close ~ pdq(0,2,0)),
stepwise = ARIMA(Close),
search = ARIMA(Close, stepwise=FALSE),
'Auto' = ETS(Close),
'Simple' = ETS(Close ~ error("A") + trend("N") + season("N")),
'Holt-Winters' = ETS(Close ~ error("A") + trend("A") + season("N")),
'Damped Holt-Winters' = ETS(Close ~ error("A") + trend("Ad") + season("N")))
TSLAytdmodels
## # A mable: 1 x 7
## arima020 stepwise search Auto Simple
## <model> <model> <model> <model> <model>
## 1 <ARIMA(0,2,0)> <ARIMA(2,1,0)> <ARIMA(0,1,5)> <ETS(M,N,N)> <ETS(A,N,N)>
## # … with 2 more variables: `Holt-Winters` <model>,
## # `Damped Holt-Winters` <model>
TSLA2020models%>%
glance()
## # A tibble: 7 × 11
## .model sigma2 log_lik AIC AICc BIC ar_ro…¹ ma_ro…² MSE AMSE MAE
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <list> <list> <dbl> <dbl> <dbl>
## 1 arima020 8.16e+1 -2625. 5251. 5251. 5256. <cpl> <cpl> NA NA NA
## 2 stepwise 8.16e+1 -2625. 5251. 5251. 5256. <cpl> <cpl> NA NA NA
## 3 search 8.00e+1 -2614. 5242. 5243. 5275. <cpl> <cpl> NA NA NA
## 4 Auto 2.01e-3 -3884. 7778. 7778. 7801. <NULL> <NULL> 81.5 158. 0.0319
## 5 Simple 8.16e+1 -3988. 7982. 7982. 7996. <NULL> <NULL> 81.4 157. 6.17
## 6 Holt-Wi… 8.18e+1 -3988. 7986. 7986. 8009. <NULL> <NULL> 81.3 157. 6.16
## 7 Damped … 8.19e+1 -3988. 7988. 7988. 8015. <NULL> <NULL> 81.3 157. 6.16
## # … with abbreviated variable names ¹ar_roots, ²ma_roots
#The ARIMA search (ARIMA(0,1,5)) model has the lowest AICc.
TSLAytdfit <- TSLAytd%>%
model(ARIMA(Close~pdq(0,1,5)))
TSLAytdfc <- TSLAytdfit%>%
forecast(h=1)
TSLA2020fc
## # A fable: 1 x 4 [1]
## # Key: .model [1]
## .model day Close .mean
## <chr> <dbl> <dist> <dbl>
## 1 ARIMA(Close ~ pdq(2, 1, 4)) 3121 N(186, 80) 186.
hilo(TSLA2020fc)
## # A tsibble: 1 x 6 [1]
## # Key: .model [1]
## .model day Close .mean `80%` `95%`
## <chr> <dbl> <dist> <dbl> <hilo> <hilo>
## 1 ARIMA(Cl… 3121 N(186, 80) 186. [174.8737, 197.7933]80 [168.8073, 203.8597]95
#The 2022 YTD ARIMA(0,1,5) model has produced a point forecast of $186 with an 80% PI of [174.87, 197.79].
#Determining the best model, PI, and point forecast using the data set from Elon's first twitter announcement.
head(Twitstart)
## # A tsibble: 6 x 3 [1]
## Date Close day
## <dttm> <dbl> <int>
## 1 2022-04-14 00:00:00 328. 2971
## 2 2022-04-18 00:00:00 335. 2972
## 3 2022-04-19 00:00:00 343. 2973
## 4 2022-04-20 00:00:00 326. 2974
## 5 2022-04-21 00:00:00 336. 2975
## 6 2022-04-22 00:00:00 335. 2976
Twitstart%>%
autoplot(difference(Close))
## Warning: Removed 1 row(s) containing missing values (geom_path).
wntslatwit <- Twitstart%>%
features(difference(Close),ljung_box,lag=10)
wntslatwit
## # A tibble: 1 × 2
## lb_stat lb_pvalue
## <dbl> <dbl>
## 1 33.3 0.000244
#The P value is less than .05, which means I will be using the first difference in my ARIMA model.
Twitstart%>%
gg_tsdisplay(difference(Close), plot_type='partial')
## Warning: Removed 1 row(s) containing missing values (geom_path).
## Removed 1 rows containing missing values (geom_point).
#The ACF and PACF show some autocorrelation in the model, however, the effected lags are too far into the past to matter. For this data set I will be using an ARIMA(0,1,0).
TSLAtwitmodels <- Twitstart%>%
model(arima020 = ARIMA(Close ~ pdq(0,1,0)),
stepwise = ARIMA(Close),
search = ARIMA(Close, stepwise=FALSE),
'Auto' = ETS(Close),
'Simple' = ETS(Close ~ error("A") + trend("N") + season("N")),
'Holt-Winters' = ETS(Close ~ error("A") + trend("A") + season("N")),
'Damped Holt-Winters' = ETS(Close ~ error("A") + trend("Ad") + season("N")))
TSLAtwitmodels
## # A mable: 1 x 7
## arima020 stepwise search Auto Simple
## <model> <model> <model> <model> <model>
## 1 <ARIMA(0,1,0)> <ARIMA(2,1,2)> <ARIMA(2,1,2)> <ETS(M,N,N)> <ETS(A,N,N)>
## # … with 2 more variables: `Holt-Winters` <model>,
## # `Damped Holt-Winters` <model>
TSLAtwitmodels%>%
glance()
## # A tibble: 7 × 11
## .model sigma2 log_lik AIC AICc BIC ar_ro…¹ ma_ro…² MSE AMSE MAE
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <list> <list> <dbl> <dbl> <dbl>
## 1 arima020 1.08e+2 -560. 1122. 1122. 1125. <cpl> <cpl> NA NA NA
## 2 stepwise 9.75e+1 -551. 1112. 1113. 1127. <cpl> <cpl> NA NA NA
## 3 search 9.75e+1 -551. 1112. 1113. 1127. <cpl> <cpl> NA NA NA
## 4 Auto 1.61e-3 -724. 1455. 1455. 1464. <NULL> <NULL> 106. 200. 0.0301
## 5 Simple 1.07e+2 -725. 1457. 1457. 1466. <NULL> <NULL> 106. 200. 7.69
## 6 Holt-Wi… 1.09e+2 -726. 1462. 1462. 1477. <NULL> <NULL> 106. 196. 7.88
## 7 Damped … 1.09e+2 -725. 1462. 1462. 1480. <NULL> <NULL> 105. 191. 7.92
## # … with abbreviated variable names ¹ar_roots, ²ma_roots
#The ARIMA search (ARIMA(2,1,2)) model has the lowest AICc.
TSLAtwitfit <- Twitstart%>%
model(ARIMA(Close~pdq(2,1,2)))
TSLAtwitfc <- TSLAtwitfit%>%
forecast(h=1)
TSLAtwitfc
## # A fable: 1 x 4 [1]
## # Key: .model [1]
## .model day Close .mean
## <chr> <dbl> <dist> <dbl>
## 1 ARIMA(Close ~ pdq(2, 1, 2)) 3121 N(188, 98) 188.
hilo(TSLAtwitfc)
## # A tsibble: 1 x 6 [1]
## # Key: .model [1]
## .model day Close .mean `80%` `95%`
## <chr> <dbl> <dist> <dbl> <hilo> <hilo>
## 1 ARIMA(Cl… 3121 N(188, 98) 188. [175.3741, 200.6844]80 [168.6748, 207.3837]95
#The ARIMA(2,1,2) model has produced a point forecast of $188 with an 80% PI of [175.37, 200.68].
#Determining the best model, PI, and point forecast using the data set from the day Elon actually purchased Twitter.
head(Twitterowned)
## # A tsibble: 6 x 3 [1]
## Date Close day
## <dttm> <dbl> <int>
## 1 2022-10-27 00:00:00 225. 3106
## 2 2022-10-28 00:00:00 229. 3107
## 3 2022-10-31 00:00:00 228. 3108
## 4 2022-11-01 00:00:00 228. 3109
## 5 2022-11-02 00:00:00 215. 3110
## 6 2022-11-03 00:00:00 215. 3111
Twitterowned%>%
autoplot(difference(Close))
## Warning: Removed 1 row(s) containing missing values (geom_path).
wntslatwitowned <- Twitterowned%>%
features(difference(Close),ljung_box,lag=10)
wntslatwitowned
## # A tibble: 1 × 2
## lb_stat lb_pvalue
## <dbl> <dbl>
## 1 8.78 0.553
#The P value is greater than .05. I tried a 2nd,3rd,4th, and 5th difference here and still got a p-value greater than .05. I believe this is because the data set is too small. My plan to fix this is to compare the AICc of the stepwise and search, OR use an to an Exponential smoothing model.
Twitterowned%>%
gg_tsdisplay(difference(Close), plot_type='partial')
## Warning: Removed 1 row(s) containing missing values (geom_path).
## Removed 1 rows containing missing values (geom_point).
#The ACF and PACF shows no autocorrelation in the model.
TSLAtwitownedmodels <- Twitterowned%>%
model(arima020 = ARIMA(Close ~ pdq(0,2,0)),
stepwise = ARIMA(Close),
search = ARIMA(Close, stepwise=FALSE),
'Auto' = ETS(Close),
'Simple' = ETS(Close ~ error("A") + trend("N") + season("N")),
'Holt-Winters' = ETS(Close ~ error("A") + trend("A") + season("N")),
'Damped Holt-Winters' = ETS(Close ~ error("A") + trend("Ad") + season("N")))
TSLAtwitownedmodels
## # A mable: 1 x 7
## arima020 stepwise search Auto Simple
## <model> <model> <model> <model> <model>
## 1 <ARIMA(0,2,0)> <ARIMA(0,1,0)> <ARIMA(0,1,0)> <ETS(A,N,N)> <ETS(A,N,N)>
## # … with 2 more variables: `Holt-Winters` <model>,
## # `Damped Holt-Winters` <model>
TSLAtwitownedmodels%>%
glance()
## # A tibble: 7 × 11
## .model sigma2 log_lik AIC AICc BIC ar_ro…¹ ma_ro…² MSE AMSE MAE
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <list> <list> <dbl> <dbl> <dbl>
## 1 arima020 123. -49.7 101. 102. 102. <cpl> <cpl> NA NA NA
## 2 stepwise 61.6 -48.7 99.4 99.7 100. <cpl> <cpl> NA NA NA
## 3 search 61.6 -48.7 99.4 99.7 100. <cpl> <cpl> NA NA NA
## 4 Auto 66.3 -50.7 107. 110. 110. <NULL> <NULL> 57.5 134. 6.00
## 5 Simple 66.3 -50.7 107. 110. 110. <NULL> <NULL> 57.5 134. 6.00
## 6 Holt-Winte… 78.3 -50.7 111. 118. 115. <NULL> <NULL> 57.4 101. 6.46
## 7 Damped Hol… 85.2 -50.6 113. 124. 117. <NULL> <NULL> 56.8 95.6 6.47
## # … with abbreviated variable names ¹ar_roots, ²ma_roots
#The ARIMA stepwise and search produced (ARIMA(0,1,0)) and have the lowest AICc, however, I will be using the Auto ETS model since I know a first difference does not create a stationary series.
TSLAtwitownedfit <- Twitterowned%>%
model('Auto' = ETS(Close))
TSLAtwitownedfc <- TSLAtwitownedfit%>%
forecast(h=1)
TSLAtwitownedfc
## # A fable: 1 x 4 [1]
## # Key: .model [1]
## .model day Close .mean
## <chr> <dbl> <dist> <dbl>
## 1 Auto 3121 N(187, 66) 187.
hilo(TSLAtwitownedfc)
## # A tsibble: 1 x 6 [1]
## # Key: .model [1]
## .model day Close .mean `80%` `95%`
## <chr> <dbl> <dist> <dbl> <hilo> <hilo>
## 1 Auto 3121 N(187, 66) 187. [176.485, 197.3565]80 [170.9606, 202.8809]95
#The ETS model has produced a point forecast of $187 with an 80% PI of [176.49, 197.36].
After the results of the models, I decided to go with the point forecast of $188 and the 80% PI of 168.67, 207.38 from the data set that includes all days after Elon’s announcement. I picked this because the time frame is large enough to produce significant numbers, yet close enough to the forecasting period to not be too uncorrelated with the price. The Twitter news is starting to die down which makes me believe Tesla’s stock price will be increasing the next few days. I also used Bollinger Bands and Moving Average for technical analysis from Etrade Pro’s chart tool. Both methods suggested the stock is going to be increasing tomorrow. I’m expecting there to be after hours trading which will push the stock price up on the Open, and the traded down to somewhere around 188 dollars a share by the close.