This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
## Warning: package 'TSA' was built under R version 4.0.4
##
## Attaching package: 'TSA'
## The following objects are masked from 'package:stats':
##
## acf, arima
## The following object is masked from 'package:utils':
##
## tar
## Warning: package 'aod' was built under R version 4.0.4
## Warning: package 'tseries' was built under R version 4.0.4
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
## Warning: package 'data.table' was built under R version 4.0.3
## Warning: package 'TSstudio' was built under R version 4.0.3
## Loading required package: nlme
## This is mgcv 1.8-31. For overview type 'help("mgcv-package")'.
##
## Attaching package: 'mgcv'
## The following object is masked from 'package:aod':
##
## negbin
## Warning: package 'dynlm' was built under R version 4.0.3
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Warning: package 'fpp2' was built under R version 4.0.3
## Registered S3 methods overwritten by 'forecast':
## method from
## fitted.Arima TSA
## plot.Arima TSA
## -- Attaching packages ------------------------------------------------------------------------- fpp2 2.4 --
## v ggplot2 3.3.0 v fma 2.4
## v forecast 8.13 v expsmooth 2.3
## Warning: package 'forecast' was built under R version 4.0.3
## Warning: package 'fma' was built under R version 4.0.3
## Warning: package 'expsmooth' was built under R version 4.0.3
## -- Conflicts ---------------------------------------------------------------------------- fpp2_conflicts --
## x forecast::getResponse() masks nlme::getResponse()
## Warning: package 'writexl' was built under R version 4.0.3
## Warning: package 'feasts' was built under R version 4.0.3
## Loading required package: fabletools
## Warning: package 'fabletools' was built under R version 4.0.3
##
## Attaching package: 'fabletools'
## The following objects are masked from 'package:forecast':
##
## accuracy, forecast
##
## Attaching package: 'feasts'
## The following object is masked from 'package:nlme':
##
## ACF
## Warning: package 'FitAR' was built under R version 4.0.3
## Loading required package: lattice
## Loading required package: leaps
## Warning: package 'leaps' was built under R version 4.0.3
## Loading required package: ltsa
## Warning: package 'ltsa' was built under R version 4.0.3
## Loading required package: bestglm
## Warning: package 'bestglm' was built under R version 4.0.3
##
## Attaching package: 'FitAR'
## The following object is masked from 'package:forecast':
##
## BoxCox
## Warning: package 'lmtest' was built under R version 4.0.3
## Warning: package 'dplyr' was built under R version 4.0.3
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:nlme':
##
## collapse
## The following objects are masked from 'package:data.table':
##
## between, first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## [1] "C:/Users/perei/Dropbox/Worksheets/Lawrence/Python/Time Series Analysis - ISYE-6402-OANO01/Final"
##
## Augmented Dickey-Fuller Test
##
## data: data.stest
## Dickey-Fuller = -2.3028, Lag order = 1, p-value = 0.4543
## alternative hypothesis: stationary
##
## Box-Pierce test
##
## data: data.stest
## X-squared = 28.21, df = 1, p-value = 1.089e-07
##
## Call:
## lm(formula = data.trend ~ x1 + x2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5670.5 -2202.3 635.6 2115.5 9434.8
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 13865 1456 9.523 1.00e-11 ***
## x1 -30471 6899 -4.416 7.73e-05 ***
## x2 34579 6833 5.060 1.03e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3296 on 39 degrees of freedom
## Multiple R-squared: 0.4272, Adjusted R-squared: 0.3978
## F-statistic: 14.54 on 2 and 39 DF, p-value: 1.912e-05
## Warning in modeldf.default(object): Could not find appropriate degrees of
## freedom for this model.
## Warning in modeldf.default(object): Could not find appropriate degrees of
## freedom for this model.
## Warning in modeldf.default(object): Could not find appropriate degrees of
## freedom for this model.
## Warning in modeldf.default(object): Could not find appropriate degrees of
## freedom for this model.
## Warning in adf.test(resid.4): p-value smaller than printed p-value
##
## Augmented Dickey-Fuller Test
##
## data: resid.4
## Dickey-Fuller = -5.6122, Lag order = 3, p-value = 0.01
## alternative hypothesis: stationary
##
## Box-Pierce test
##
## data: resid.4
## X-squared = 3.4219, df = 1, p-value = 0.06434
## [1] "0 0 0 684.527836458553"
## [1] "0 0 1 674.975562245399"
## [1] "0 0 2 665.755155141721"
## [1] "0 0 3 663.837492390154"
## [1] "0 0 4 660.829707780382"
## [1] "0 0 5 648.69213181255"
## [1] "1 0 0 682.109504438671"
## [1] "1 0 1 676.738512030375"
## [1] "1 0 2 664.854383378218"
## [1] "1 0 3 665.780175356115"
## [1] "1 0 4 661.633492945823"
## [1] "1 0 5 649.522202485456"
## [1] "2 0 0 665.306397636687"
## Warning in log(s2): NaNs produced
## [1] "2 0 1 648.988625071333"
## [1] "2 0 2 648.663590304414"
## [1] "2 0 3 646.98060266005"
## [1] "2 0 4 658.608109782767"
## [1] "2 0 5 647.39815308339"
## [1] "3 0 0 661.538903712276"
## [1] "3 0 1 650.697616477603"
## [1] "3 0 2 652.250977921711"
## [1] "3 0 3 648.522538147271"
## [1] "3 0 4 650.175739155823"
## Warning in log(s2): NaNs produced
## [1] "3 0 5 648.580342944897"
## [1] "4 0 0 660.16234773157"
## [1] "4 0 1 660.812827873844"
## [1] "4 0 2 652.47838169664"
## [1] "4 0 3 651.118327105119"
## [1] "4 0 4 650.261435049189"
## [1] "4 0 5 647.183859843224"
## [1] "5 0 0 661.790193907559"
## [1] "5 0 1 662.422787185315"
## [1] "5 0 2 654.421510121993"
## Warning in log(s2): NaNs produced
## Warning in log(s2): NaNs produced
## [1] "5 0 3 652.723591113608"
## [1] "5 0 4 655.401361081631"
## [1] "5 0 5 648.937576926626"
## p d q AIC
## 16 2 0 2 648.6636
## 25 3 0 5 648.5803
## 23 3 0 3 648.5225
## 19 2 0 5 647.3982
## 31 4 0 5 647.1839
## 17 2 0 3 646.9806
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.