A00834241 | Regina Rodríguez Chávez
A00833617 | Yessica Acosta Blancheth
A01275763 | Eli Gabriel Hernández Medina
A00833172 | Genaro Rodríguez Alcántara
### uploading libraries
library(xts)
library(zoo)
library(tseries)
library(stats)
library(forecast)
library(astsa)
library(corrplot)
library(AER)
library(dynlm)
library(vars)
#library(mFilter)
library(TSstudio)
library(tidyverse)
library(sarima)
library(stargazer)
library(dygraphs)
### importing dataset
<-read.csv("2015_energy_stock_prices.csv") VARts
# Time series format
$Date <- as.Date(VARts$Date,"%m/%d/%Y")
VARtsstr(VARts)
## 'data.frame': 96 obs. of 13 variables:
## $ Date : Date, format: "2015-01-01" "2015-02-01" ...
## $ GE_Adj_Close : num 135 130 142 143 139 ...
## $ IBDRY_Adj_Close : num 17.9 18.7 17.7 18.4 19 ...
## $ NEE_Adj_Close : num 21.4 20.8 21.1 20.4 20.7 ...
## $ VWDRY_Adj_Close : num 2.35 2.53 2.48 2.74 3.11 3.06 3.33 3.28 3.16 3.56 ...
## $ JKS_Adj_Close : num 56.9 21.9 25.6 28 28.8 ...
## $ CSIQ_Adj_Close : num 22.9 29.6 33.4 35.4 32.7 ...
## $ DQ_Adj_Close : num 4.8 4.47 5.3 5.49 4.41 4.71 3.51 2.81 3.2 3.34 ...
## $ AQN_Adj_Close : num 5.44 5.4 4.82 5.39 5.21 4.98 4.89 5.01 4.62 5.3 ...
## $ NonStore_Retailing : int 39670 40668 40522 40792 40618 40925 41494 41403 41886 42104 ...
## $ US_Unemployment : num 5.7 5.5 5.4 5.4 5.6 5.3 5.2 5.1 5 5 ...
## $ US_Consumer_Confidence: num 98.1 95.4 93 95.9 90.7 96.1 93.1 91.9 87.2 90 ...
## $ US_Min_Hour_Wage : num 7.25 7.25 7.25 7.25 7.25 7.25 7.25 7.25 7.25 7.25 ...
# ts = formatted, when it starts, when it ends and when it starts)
<-ts(VARts$CSIQ_Adj_Close,start=c(2015,1),end=c(2022,12),frequency=12)
CSIQ_Adj_Close<-ts(VARts$NonStore_Retailing,start=c(2015,1),end=c(2022,12),frequency=12)
NonStore_Retailing<-ts(VARts$US_Unemployment,start=c(2015,1),end=c(2022,12),frequency=12)
US_Unemployment<-ts(VARts$US_Consumer_Confidence,start=c(2015,12),end=c(2022,12),frequency=12)
US_Consumer_Confidence<-ts(VARts$US_Min_Hour_Wage,start=c(2015,1),end=c(2022,12),frequency=12) US_Min_Hour_Wage
<-xts(VARts$CSIQ_Adj_Close,order.by=VARts$Date)
VARxtsplot(VARxts,main = "Canadian Solar Inc stock price", xlab ="Date",ylab ="Adjusted Close Price (USD)")
In this graph we can see 2 main trends in the price of Solar Inc shares,
the first of them seems to have started in the second half of 2018,
where the shares began to greatly increase their value until the first
half of 2021. Where from then and as mentioned above, the shares have
shown a negative trend until the latest values in our database that
represent the second half of 2022.
Investigating the context of the company in those periods and focusing the research on the political and social environment because due to the nature of the company, the actions are greatly influenced by this type of political factors. Therefore, it is interesting to find that in the first period that was explained, the positive trend coincides with a boom period for renewable energies and where many governments, including the United States government, implemented policies to promote renewable energies, this could explain the growth of stocks in the last part of the decade. On the other hand, the drop in stock price in the second half of 2021 could have been due to macroeconomic factors and market fluctuations. For example, global economic events, such as the COVID-19 pandemic, financial crises, or changes in interest rates, may negatively affect stock markets and cause investors to be more cautious.
# alternative plotting time series data
ts_plot(CSIQ_Adj_Close)
ts_plot(NonStore_Retailing)
ts_plot(US_Unemployment)
ts_plot(US_Consumer_Confidence)
ts_plot(US_Min_Hour_Wage)
In the previous graphs we can analyze what has been the behavior of the other variables over the years, at first we can notice how Non_Store_Retailing presents a significant upward trend, the minimum hourly wage has remained constant, customer confidence consumer has decreased in recent years and the unemployment rate has decreased throughout the time series except for 2021, which is clearly explained by the social context caused by the covid-19 pandemic.
# Decomposing Canadian Solar Inc stock price (time series data)
<-ts(VARts$CSIQ_Adj_Close,frequency=12,start=c(2007,1))
CSIQts<-decompose(CSIQts)
CSIQdecplot(CSIQdec)
In the previous graph, we can see the trends described previously, in the second half of the 2010-2020 decade a positive trend is observed that has its inflection point in 2021 and from that moment on, the time series began to show a negative trend. Regarding the seasonal component, it is observed that in some of the periods, the price of the shares has a significant increase, which is explained by the varying demand in the season of the year for renewable energies promoted by the company studied. Finally, the random component that talks about the noise of the residuals which is noticeable especially in the last part of the time series, this is something logical because the price of the shares has a lot of voting day by day and is very sensitive to many changes in many variables. In the last part of the time series, greater noise is observed due to global situations such as the covid 19 pandemic and changes in government policies in many countries regarding sustainability and energy.
# it is important to assess whether the variables under study are stationary or not
adf.test(VARts$CSIQ_Adj_Close) # non-stationary
##
## Augmented Dickey-Fuller Test
##
## data: VARts$CSIQ_Adj_Close
## Dickey-Fuller = -2.9133, Lag order = 4, p-value = 0.1991
## alternative hypothesis: stationary
adf.test(VARts$NonStore_Retailing) # non-stationary
##
## Augmented Dickey-Fuller Test
##
## data: VARts$NonStore_Retailing
## Dickey-Fuller = -1.8269, Lag order = 4, p-value = 0.648
## alternative hypothesis: stationary
adf.test(VARts$US_Unemployment) # non-stationary
##
## Augmented Dickey-Fuller Test
##
## data: VARts$US_Unemployment
## Dickey-Fuller = -2.5755, Lag order = 4, p-value = 0.3386
## alternative hypothesis: stationary
adf.test(VARts$US_Consumer_Confidence) # non-stationary
##
## Augmented Dickey-Fuller Test
##
## data: VARts$US_Consumer_Confidence
## Dickey-Fuller = -1.7896, Lag order = 4, p-value = 0.6634
## alternative hypothesis: stationary
CSIQ_Adj_Close: The Dickey-Fuller test result for the series “CSIQ_Adj_Close” is -2.9133. The p-value associated with this test is 0.1991. The null hypothesis (H0) in this test is that the data series is non-stationary, while the alternative hypothesis (H1) is that the series is stationary. Since the p-value is greater than the typical significance level of 0.05, we cannot reject the null hypothesis in this case. This suggests that the series “CSIQ_Adj_Close” might not be stationary.
NonStore_Retailing: For the series “NonStore_Retailing,” the result of the Dickey-Fuller test is -1.8269, with a p-value of 0.648. As in the previous case, the p-value is greater than 0.05, suggesting that we cannot reject the null hypothesis. This implies that the series “NonStore_Retailing” might not be stationary.
US_Unemployment: For the series “US_Unemployment,” the result of the Dickey-Fuller test is -2.5755, with a p-value of 0.3386. Again, the p-value is greater than 0.05, indicating that we cannot reject the null hypothesis. This suggests that the US unemployment series may not be stationary.
US_Consumer_Confidence: Finally, for the series “US_Consumer_Confidence,” the result of the Dickey-Fuller test is -1.7896, with a p-value of 0.6634. As in the previous cases, the p-value is greater than 0.05, suggesting that we cannot reject the null hypothesis. This implies that the “US_Consumer_Confidence” series may not be stationary.
In summary, based on the results of the Dickey-Fuller tests, there is insufficient evidence to affirm that these data series are stationary.
# plotting time series data
par(mfrow=c(2,3))
plot(VARts$Date,VARts$CSIQ_Adj_Close,type="l",col="blue",lwd=2,xlab="Date",ylab="CSIQ",main="CSIQ")
plot(VARts$Date,VARts$NonStore_Retailing,type="l",col="blue",lwd=2,xlab="Date",ylab="NonStore Retailing",main="NonStore Retailing")
plot(VARts$Date,VARts$US_Unemployment,type="l",col="blue",lwd=2,xlab="Date",ylab="Unemployment",main="Unemployment")
plot(VARts$Date,VARts$US_Consumer_Confidence,type="l",col="blue",lwd=2,xlab="Date",ylab="Consumer Confidence",main="Consumer Confidence")
plot(VARts$Date,VARts$US_Min_Hour_Wage,type="l",col="blue",lwd=2,xlab="Date",ylab="Wage",main="Min Hour Wage")
Las relacion de las variables seleccionadas con el precio de la accion de la compañía se puede explicar a continuación…
NonStore Retailing: As we mentioned previously, online sales (NonStore Retailing) have shown a constant upward trend over time. When we compare this trend with the behavior of Solar Canadian Inc. stock, we observe that both show a positive trend pattern over a long period, especially between 2018 and 2021. This suggests a possible positive relationship between these variables due to the long trend shared. The continued growth of online commerce also supports the expansion of products through e-commerce, where renewable energy can play a crucial role. Additionally, increased online commerce is often indicative of a healthy and growing economy, which can encourage investment in renewable energy. However, it is important to note that the time series diverge in the most recent stretch due to the COVID-19 pandemic. While the pandemic significantly boosted online commerce, it had a negative effect on the company’s share price due to associated social, economic and political factors.
Unemployment: The unemployment rate generally shows a negative trend due to government efforts to combat it. The increase in unemployment in 2020, as we mentioned above, was due to the COVID-19 pandemic. Therefore, it is likely that there is a negative relationship between the unemployment rate and the company’s stock price. When unemployment rises, investor confidence may decline due to economic uncertainty.
Consumer Confidence: In the time series of consumer confidence, a positive trend is seen before the COVID-19 pandemic, which generated uncertainty in people and, as a result, their confidence decreased. This pattern is similar to that seen in the company’s stock price. Therefore, it is possible that there is a positive relationship between consumer confidence and stock price. When people have greater confidence in the economy, they are more likely to consider aspects such as sustainability and renewable energy when making investment decisions.
Min Hour Wage: There is no obvious relationship between the minimum hourly wage and the company’s share price, since this variable remains constant over time and does not present significant fluctuations that could influence the performance of the company. the actions.
As we saw previously, none of the variables is a stationary series, so it is necessary to apply a difference transformation to make the time series stationary and have a more precise and reliable forecast. At the same time, these variables are passed to a time format.
### Converting To Time Series Format
<-ts(diff(log(VARts$NonStore_Retailing)),start=c(2007,1),end=c(2022,12),frequency=12)
NonStore_ts<-ts(diff(log(VARts$US_Unemployment)),start=c(2007,1),end=c(2022,12),frequency=12)
Unemployment_ts<-ts(diff(log(VARts$US_Consumer_Confidence)),start=c(2007,1),end=c(2022,12),frequency=12)
Consumer_Confidence_ts<-ts(diff(log(VARts$US_Min_Hour_Wage)),start=c(2007,1),end=c(2022,12),frequency=12)
Min_Hour_Wage_ts<-ts(diff(log(VARts$CSIQ_Adj_Close)),start=c(2007,1),end=c(2022,12),frequency=12) CSIQ_ts
We apply the stationarity test to corroborate that all time series are stationary…
adf.test(CSIQ_ts)
##
## Augmented Dickey-Fuller Test
##
## data: CSIQ_ts
## Dickey-Fuller = -5.6091, Lag order = 5, p-value = 0.01
## alternative hypothesis: stationary
adf.test(NonStore_ts)
##
## Augmented Dickey-Fuller Test
##
## data: NonStore_ts
## Dickey-Fuller = -6.4479, Lag order = 5, p-value = 0.01
## alternative hypothesis: stationary
adf.test(Unemployment_ts)
##
## Augmented Dickey-Fuller Test
##
## data: Unemployment_ts
## Dickey-Fuller = -6.6129, Lag order = 5, p-value = 0.01
## alternative hypothesis: stationary
adf.test(Consumer_Confidence_ts)
##
## Augmented Dickey-Fuller Test
##
## data: Consumer_Confidence_ts
## Dickey-Fuller = -6.9517, Lag order = 5, p-value = 0.01
## alternative hypothesis: stationary
As we can see, now all the time series are stationary because the value of p is less than 0.05, which approves the alternative hypothesis of stationarity.
# Lets create a time series dataset
# Canadian Solar Stock price is the dependent variable
<-cbind(CSIQ_ts,Unemployment_ts,Consumer_Confidence_ts, NonStore_ts)
VAR_tscolnames(VAR_ts)<-cbind("CSIQ","Uneployment","Consumer","NonStore")
head(VAR_ts)
## CSIQ Uneployment Consumer NonStore
## Jan 2007 0.25765045 -0.03571808 -0.02790879 0.024846308
## Feb 2007 0.11946909 -0.01834914 -0.02547909 -0.003596506
## Mar 2007 0.05845537 0.00000000 0.03070649 0.006640947
## Apr 2007 -0.08056073 0.03636764 -0.05574862 -0.004274666
## May 2007 -0.13274437 -0.05505978 0.05783196 0.007529805
## Jun 2007 -0.06276853 -0.01904819 -0.03171513 0.013807715
Now, it is important to use a selection criterion to lag our data with the order that provides the lowest AIC…
<-VARselect(VAR_ts,lag.max=5,type="const", season=12)
lag_selection$selection lag_selection
## AIC(n) HQ(n) SC(n) FPE(n)
## 5 1 1 5
$criteria lag_selection
## 1 2 3 4 5
## AIC(n) -2.129178e+01 -2.134281e+01 -2.133147e+01 -2.133738e+01 -2.139878e+01
## HQ(n) -2.084370e+01 -2.078270e+01 -2.065934e+01 -2.055323e+01 -2.050261e+01
## SC(n) -2.018595e+01 -1.996051e+01 -1.967272e+01 -1.940217e+01 -1.918712e+01
## FPE(n) 5.673177e-10 5.399627e-10 5.474349e-10 5.460544e-10 5.158626e-10
Dado que se busca el valor más bajo en todos los criterios, el rezago 3 parece ser el más conveniente y el que mejor ajustará nuestro modelo a los datos.
Estimamos nuestro modelo…
#VAR Model 1
<-VAR(VAR_ts,p=3,type="const",season=12)
VAR_model1summary(VAR_model1)
##
## VAR Estimation Results:
## =========================
## Endogenous variables: CSIQ, Uneployment, Consumer, NonStore
## Deterministic variables: const
## Sample size: 189
## Log Likelihood: 1039.489
## Roots of the characteristic polynomial:
## 0.6573 0.6569 0.6569 0.5639 0.5639 0.4817 0.4817 0.4137 0.4137 0.3927 0.3741 0.3741
## Call:
## VAR(y = VAR_ts, p = 3, type = "const", season = 12L)
##
##
## Estimation results for equation CSIQ:
## =====================================
## CSIQ = CSIQ.l1 + Uneployment.l1 + Consumer.l1 + NonStore.l1 + CSIQ.l2 + Uneployment.l2 + Consumer.l2 + NonStore.l2 + CSIQ.l3 + Uneployment.l3 + Consumer.l3 + NonStore.l3 + const + sd1 + sd2 + sd3 + sd4 + sd5 + sd6 + sd7 + sd8 + sd9 + sd10 + sd11
##
## Estimate Std. Error t value Pr(>|t|)
## CSIQ.l1 -0.120831 0.077366 -1.562 0.12025
## Uneployment.l1 0.122080 0.107466 1.136 0.25761
## Consumer.l1 0.025762 0.260894 0.099 0.92146
## NonStore.l1 -0.647078 0.574520 -1.126 0.26168
## CSIQ.l2 -0.004128 0.080234 -0.051 0.95903
## Uneployment.l2 -0.146886 0.116055 -1.266 0.20742
## Consumer.l2 -0.321660 0.246568 -1.305 0.19386
## NonStore.l2 0.212600 0.633796 0.335 0.73772
## CSIQ.l3 -0.176346 0.080104 -2.201 0.02909 *
## Uneployment.l3 -0.090712 0.112241 -0.808 0.42014
## Consumer.l3 0.051083 0.252677 0.202 0.84004
## NonStore.l3 1.787012 0.570835 3.131 0.00206 **
## const -0.012657 0.018443 -0.686 0.49352
## sd1 -0.027855 0.055458 -0.502 0.61615
## sd2 -0.120350 0.055566 -2.166 0.03176 *
## sd3 -0.074132 0.056394 -1.315 0.19049
## sd4 -0.051024 0.055602 -0.918 0.36013
## sd5 -0.062499 0.055759 -1.121 0.26397
## sd6 -0.044636 0.055405 -0.806 0.42161
## sd7 -0.076672 0.055099 -1.392 0.16594
## sd8 -0.051849 0.054829 -0.946 0.34571
## sd9 -0.016209 0.054686 -0.296 0.76730
## sd10 -0.032351 0.054465 -0.594 0.55334
## sd11 -0.038422 0.054454 -0.706 0.48144
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 0.1528 on 165 degrees of freedom
## Multiple R-Squared: 0.1405, Adjusted R-squared: 0.02072
## F-statistic: 1.173 on 23 and 165 DF, p-value: 0.2761
##
##
## Estimation results for equation Uneployment:
## ============================================
## Uneployment = CSIQ.l1 + Uneployment.l1 + Consumer.l1 + NonStore.l1 + CSIQ.l2 + Uneployment.l2 + Consumer.l2 + NonStore.l2 + CSIQ.l3 + Uneployment.l3 + Consumer.l3 + NonStore.l3 + const + sd1 + sd2 + sd3 + sd4 + sd5 + sd6 + sd7 + sd8 + sd9 + sd10 + sd11
##
## Estimate Std. Error t value Pr(>|t|)
## CSIQ.l1 -0.205049 0.066787 -3.070 0.0025 **
## Uneployment.l1 -0.016065 0.092771 -0.173 0.8627
## Consumer.l1 -0.401452 0.225219 -1.782 0.0765 .
## NonStore.l1 0.743755 0.495960 1.500 0.1356
## CSIQ.l2 -0.026151 0.069262 -0.378 0.7062
## Uneployment.l2 -0.075205 0.100185 -0.751 0.4539
## Consumer.l2 0.142442 0.212853 0.669 0.5043
## NonStore.l2 -0.059325 0.547131 -0.108 0.9138
## CSIQ.l3 0.003685 0.069151 0.053 0.9576
## Uneployment.l3 0.044985 0.096893 0.464 0.6431
## Consumer.l3 0.020810 0.218126 0.095 0.9241
## NonStore.l3 -0.660047 0.492779 -1.339 0.1823
## const -0.005688 0.015921 -0.357 0.7214
## sd1 0.006068 0.047875 0.127 0.8993
## sd2 0.099703 0.047968 2.079 0.0392 *
## sd3 0.058938 0.048682 1.211 0.2278
## sd4 -0.015894 0.047999 -0.331 0.7410
## sd5 -0.010391 0.048134 -0.216 0.8293
## sd6 -0.011316 0.047829 -0.237 0.8133
## sd7 -0.012078 0.047565 -0.254 0.7999
## sd8 -0.015181 0.047332 -0.321 0.7488
## sd9 0.001124 0.047208 0.024 0.9810
## sd10 0.001062 0.047017 0.023 0.9820
## sd11 0.009025 0.047008 0.192 0.8480
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 0.1319 on 165 degrees of freedom
## Multiple R-Squared: 0.1649, Adjusted R-squared: 0.04848
## F-statistic: 1.416 on 23 and 165 DF, p-value: 0.1094
##
##
## Estimation results for equation Consumer:
## =========================================
## Consumer = CSIQ.l1 + Uneployment.l1 + Consumer.l1 + NonStore.l1 + CSIQ.l2 + Uneployment.l2 + Consumer.l2 + NonStore.l2 + CSIQ.l3 + Uneployment.l3 + Consumer.l3 + NonStore.l3 + const + sd1 + sd2 + sd3 + sd4 + sd5 + sd6 + sd7 + sd8 + sd9 + sd10 + sd11
##
## Estimate Std. Error t value Pr(>|t|)
## CSIQ.l1 0.078234 0.025488 3.069 0.002508 **
## Uneployment.l1 -0.035277 0.035405 -0.996 0.320515
## Consumer.l1 -0.054233 0.085952 -0.631 0.528931
## NonStore.l1 -0.136264 0.189277 -0.720 0.472595
## CSIQ.l2 0.043841 0.026433 1.659 0.099107 .
## Uneployment.l2 0.066645 0.038235 1.743 0.083186 .
## Consumer.l2 -0.273815 0.081233 -3.371 0.000934 ***
## NonStore.l2 -0.456954 0.208806 -2.188 0.030045 *
## CSIQ.l3 -0.001455 0.026391 -0.055 0.956097
## Uneployment.l3 0.010352 0.036978 0.280 0.779862
## Consumer.l3 0.105017 0.083245 1.262 0.208894
## NonStore.l3 0.096920 0.188063 0.515 0.606993
## const -0.001322 0.006076 -0.218 0.828004
## sd1 0.011069 0.018271 0.606 0.545465
## sd2 0.005517 0.018306 0.301 0.763498
## sd3 0.007469 0.018579 0.402 0.688193
## sd4 0.009076 0.018318 0.495 0.620939
## sd5 -0.002885 0.018370 -0.157 0.875416
## sd6 -0.001814 0.018253 -0.099 0.920961
## sd7 0.014589 0.018153 0.804 0.422722
## sd8 0.028950 0.018064 1.603 0.110925
## sd9 0.020955 0.018016 1.163 0.246476
## sd10 0.024843 0.017944 1.384 0.168077
## sd11 0.015016 0.017940 0.837 0.403796
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 0.05035 on 165 degrees of freedom
## Multiple R-Squared: 0.2345, Adjusted R-squared: 0.1278
## F-statistic: 2.198 on 23 and 165 DF, p-value: 0.002367
##
##
## Estimation results for equation NonStore:
## =========================================
## NonStore = CSIQ.l1 + Uneployment.l1 + Consumer.l1 + NonStore.l1 + CSIQ.l2 + Uneployment.l2 + Consumer.l2 + NonStore.l2 + CSIQ.l3 + Uneployment.l3 + Consumer.l3 + NonStore.l3 + const + sd1 + sd2 + sd3 + sd4 + sd5 + sd6 + sd7 + sd8 + sd9 + sd10 + sd11
##
## Estimate Std. Error t value Pr(>|t|)
## CSIQ.l1 -2.285e-02 1.162e-02 -1.967 0.0509 .
## Uneployment.l1 7.752e-02 1.614e-02 4.804 3.47e-06 ***
## Consumer.l1 -6.762e-02 3.917e-02 -1.726 0.0862 .
## NonStore.l1 -4.424e-01 8.626e-02 -5.129 8.10e-07 ***
## CSIQ.l2 -1.557e-03 1.205e-02 -0.129 0.8973
## Uneployment.l2 4.322e-03 1.743e-02 0.248 0.8044
## Consumer.l2 -5.660e-02 3.702e-02 -1.529 0.1282
## NonStore.l2 -6.966e-02 9.517e-02 -0.732 0.4652
## CSIQ.l3 1.489e-02 1.203e-02 1.238 0.2175
## Uneployment.l3 5.692e-03 1.685e-02 0.338 0.7360
## Consumer.l3 -4.694e-02 3.794e-02 -1.237 0.2178
## NonStore.l3 3.731e-02 8.571e-02 0.435 0.6639
## const 1.552e-02 2.769e-03 5.603 8.67e-08 ***
## sd1 -1.292e-03 8.327e-03 -0.155 0.8769
## sd2 8.038e-03 8.343e-03 0.963 0.3367
## sd3 -5.146e-05 8.468e-03 -0.006 0.9952
## sd4 -4.478e-03 8.349e-03 -0.536 0.5924
## sd5 -6.525e-03 8.372e-03 -0.779 0.4369
## sd6 -8.159e-03 8.319e-03 -0.981 0.3281
## sd7 -4.253e-03 8.273e-03 -0.514 0.6079
## sd8 -5.416e-03 8.233e-03 -0.658 0.5115
## sd9 -3.202e-03 8.211e-03 -0.390 0.6970
## sd10 -8.513e-03 8.178e-03 -1.041 0.2994
## sd11 -3.383e-03 8.176e-03 -0.414 0.6796
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 0.02295 on 165 degrees of freedom
## Multiple R-Squared: 0.3126, Adjusted R-squared: 0.2168
## F-statistic: 3.263 on 23 and 165 DF, p-value: 5.652e-06
##
##
##
## Covariance matrix of residuals:
## CSIQ Uneployment Consumer NonStore
## CSIQ 0.0233560 0.000341 -0.0006684 0.0007298
## Uneployment 0.0003410 0.017405 -0.0028532 0.0013190
## Consumer -0.0006684 -0.002853 0.0025350 -0.0002387
## NonStore 0.0007298 0.001319 -0.0002387 0.0005266
##
## Correlation matrix of residuals:
## CSIQ Uneployment Consumer NonStore
## CSIQ 1.00000 0.01691 -0.08687 0.2081
## Uneployment 0.01691 1.00000 -0.42954 0.4357
## Consumer -0.08687 -0.42954 1.00000 -0.2066
## NonStore 0.20811 0.43570 -0.20657 1.0000
<-data.frame(residuals(VAR_model1))
VAR_model1_residualsadf.test(VAR_model1_residuals$CSIQ)
##
## Augmented Dickey-Fuller Test
##
## data: VAR_model1_residuals$CSIQ
## Dickey-Fuller = -4.984, Lag order = 5, p-value = 0.01
## alternative hypothesis: stationary
Box.test(VAR_model1_residuals$CSIQ,lag=3,type="Ljung-Box")
##
## Box-Ljung test
##
## data: VAR_model1_residuals$CSIQ
## X-squared = 0.28387, df = 3, p-value = 0.963
adf test: p-value<0.05 the series are stationary Box-Ljung test: p-value>0.05 there is no serial correlation between residuals
Endogenous Variables: The variables that were included in the VAR model are CSIQ, Unemployment, Consumer and NonStore. These are the variables that are being modeled and that are considered interdependent.
Deterministic Variable: The model also includes a constant deterministic variable (const), which represents a constant component or intercept in the model.
Sample Size: The model was estimated using a data set with a sample size of 189 observations.
Log Likelihood: The log likelihood value is -3130.519. This is a measure of how well the model fits the data.
Roots of the Characteristic Polynomial: The roots of the characteristic polynomial of the model are shown, which are eigenvalues that indicate the stability of the system. Some of the roots are close to 1, suggesting some persistence in the time series.
Equation Estimation: The VAR model is broken down into individual equations for each endogenous variable. Each equation has estimated coefficients for the lags of the above endogenous variables, as well as for the constant variable and other terms.
Statistical Significance: Estimated values of the coefficients, their standard errors, t values, and p values (Pr(>|t|)) are provided for each coefficient in the equations. Some coefficients are statistically significant (indicated with asterisks), meaning they have a significant effect on the dependent variable.
Residual Standard Error: The residual standard error is 3.539, which indicates variability not explained by the model.
R-Squared and Adjusted R-squared: The coefficient of determination R-squared is 0.9036, and the adjusted R-squared is 0.8901. These values indicate how much variance of the endogenous variables is explained by the model.
F statistics: The F statistic has a value of 67.23 with 23 and 165 degrees of freedom, suggesting that the model as a whole is statistically significant.
As we can see, the main variables that influence the share price of the company analyzed are lag 1 of consumer confidence and lags 3 of performance and nonstore retailing.
# Granger causality testing each variable against all the others.
# There could be a unidirectional, bidirectional, or no causality relationships between variables.
<-causality(VAR_model1,cause="CSIQ")
granger_CSIQ granger_CSIQ
## $Granger
##
## Granger causality H0: CSIQ do not Granger-cause Uneployment Consumer
## NonStore
##
## data: VAR object VAR_model1
## F-Test = 1.9401, df1 = 9, df2 = 660, p-value = 0.04386
##
##
## $Instant
##
## H0: No instantaneous causality between: CSIQ and Uneployment Consumer
## NonStore
##
## data: VAR object VAR_model1
## Chi-squared = 10.174, df = 3, p-value = 0.01715
The p value is 0.7802, indicating that there is insufficient evidence to reject the null hypothesis. In other words, it cannot be concluded that CSIQ has a significant effect of Granger causality on the variables.
# forecasting
<-predict(VAR_model1,n.ahead=5,ci=0.95) ### forecast for the next 12 months
forecast_1fanchart(forecast_1,names="CSIQ",main="Canadian Solar Inc Stock Price",xlab="Time Period",ylab="Stock Price")
forecast_1
## $CSIQ
## fcst lower upper CI
## [1,] 0.0829952528 -0.2165393 0.3825298 0.2995346
## [2,] -0.0961886382 -0.4002571 0.2078798 0.3040685
## [3,] -0.0584936231 -0.3665707 0.2495834 0.3080771
## [4,] 0.0001514211 -0.3161568 0.3164596 0.3163082
## [5,] 0.0160760197 -0.3017845 0.3339365 0.3178605
##
## $Uneployment
## fcst lower upper CI
## [1,] -0.050245165 -0.3088215 0.2083312 0.2585764
## [2,] 0.045349389 -0.2236404 0.3143391 0.2689898
## [3,] 0.080535102 -0.1898096 0.3508798 0.2703447
## [4,] -0.006504786 -0.2781305 0.2651209 0.2716257
## [5,] -0.026745771 -0.2993576 0.2458660 0.2726118
##
## $Consumer
## fcst lower upper CI
## [1,] 0.023025067 -0.07565745 0.12170759 0.09868252
## [2,] 0.009893955 -0.09201188 0.11179979 0.10190584
## [3,] -0.032323735 -0.14028598 0.07563851 0.10796224
## [4,] -0.021670317 -0.13158352 0.08824288 0.10991320
## [5,] -0.007274822 -0.11767316 0.10312351 0.11039834
##
## $NonStore
## fcst lower upper CI
## [1,] 0.01188768 -0.03308772 0.05686307 0.04497539
## [2,] 0.02134611 -0.03031153 0.07300375 0.05165764
## [3,] 0.01442513 -0.03814351 0.06699377 0.05256864
## [4,] 0.01613433 -0.03659174 0.06886040 0.05272607
## [5,] 0.00633401 -0.04664549 0.05931351 0.05297950
$fcst$CSIQ forecast_1
## fcst lower upper CI
## [1,] 0.0829952528 -0.2165393 0.3825298 0.2995346
## [2,] -0.0961886382 -0.4002571 0.2078798 0.3040685
## [3,] -0.0584936231 -0.3665707 0.2495834 0.3080771
## [4,] 0.0001514211 -0.3161568 0.3164596 0.3163082
## [5,] 0.0160760197 -0.3017845 0.3339365 0.3178605
Period 1:
Predicted value: 30.76823 Confidence Interval (CI): Between 23.83243 and 37.70403
Period 2:
Predicted value: 31.89322 Confidence interval (CI): Between 23.14311 and 40.64334
Period 3:
Predicted value: 31.89766 Confidence interval (CI): Between 22.08557 and 41.70975
Period 4:
Predicted value: 31.09085 Confidence Interval (CI): Between 20.66019 and 41.52151
Period 5:
Predicted value: 31.56141 Confidence interval (CI): Between 20.51248 and 42.61034
Over the next 5 periods, the Canadian Solar Inc stock price is forecast to fluctuate in a range given by the confidence intervals. The predicted value varies from period to period, and the confidence intervals reflect the uncertainty associated with these predictions.
The importance of this prediction lies in providing investors and stakeholders with an idea of the potential trends in the Canadian Solar Inc share price in the coming periods.