-
Notifications
You must be signed in to change notification settings - Fork 0
/
case_studies.Rmd
85 lines (61 loc) · 1.24 KB
/
case_studies.Rmd
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
title: "Simple Case Studies"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Simple Case Studies}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(fastTS)
library(magrittr) # for pipe
```
# Lake Huron data set
```{r lakehuron}
data("LakeHuron")
fit_LH <- fastTS(LakeHuron)
fit_LH
coef(fit_LH)
```
# EuStockMarkets
If you have a univariate time series with suspected trend, such as the EuStockMarkets data set,
```{r stocks}
data("EuStockMarkets")
X <- as.numeric(time(EuStockMarkets))
X_sp <- splines::bs(X-min(X), df = 9)
fit_stock <- fastTS(log(EuStockMarkets[,1]), n_lags_max = 400, X = X_sp, w_exo = "unpenalized")
fit_stock
tail(coef(fit_stock), 11)
# insert plot?
```
# Seasonal examples
## Nottem
```{r nottem}
data("nottem")
fit_nt <- fastTS(nottem, n_lags_max = 24)
fit_nt
coef(fit_nt)
```
## UKDriverDeaths
```{r UKDriverDeaths}
data("UKDriverDeaths")
fit_ukdd <- fastTS(UKDriverDeaths, n_lags_max = 24)
fit_ukdd
coef(fit_ukdd)
```
## sunspot
```{r sunspot}
data("sunspot.month")
fit_ssm <- fastTS(sunspot.month)
fit_ssm
```
Model summaries
```{r sunspot2}
summary(fit_ssm)
```