library(forecast)
## Warning: package 'forecast' was built under R version 4.2.2
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library(tseries)
## Warning: package 'tseries' was built under R version 4.2.2
rainfall <- c(799,1174.8,865.1,1334.6,635.4,918.5,685.5,998.6,784.2,985,882.8,1071)
x <- ts(rainfall,start = c(2012,1),frequency = 12)
plot(x)
tseries::adf.test(x)
##
## Augmented Dickey-Fuller Test
##
## data: x
## Dickey-Fuller = -1.5247, Lag order = 2, p-value = 0.7535
## alternative hypothesis: stationary
dx <- diff(x)
plot(dx)
tseries::adf.test(dx)
## Warning in tseries::adf.test(dx): p-value smaller than printed p-value
##
## Augmented Dickey-Fuller Test
##
## data: dx
## Dickey-Fuller = -8.9033, Lag order = 2, p-value = 0.01
## alternative hypothesis: stationary
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
#Conclusion Se realizaron dos ejecuciones, ya que la primera no mostró estacionaridad. La segunda ejecución tiene estacionaridad debido al P-value de 0.01.
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.