2 % Default to the notebook output style
7 % Inherit from the specified cell style.
13 \documentclass[11pt
]{article
}
17 \usepackage[T1]{fontenc}
18 % Nicer default font (+ math font) than Computer Modern for most use cases
21 % Basic figure setup, for now with no caption control since it's done
22 % automatically by Pandoc (which extracts ![](path) syntax from Markdown).
24 % We will generate all images so they have a width \maxwidth. This means
25 % that they will get their normal width if they fit onto the page, but
26 % are scaled down if they would overflow the margins.
28 \def\maxwidth{\ifdim\Gin@nat@width>
\linewidth\linewidth
29 \else\Gin@nat@width
\fi}
31 \let\Oldincludegraphics\includegraphics
32 % Set max figure width to be 80% of text width, for now hardcoded.
33 \renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=
.8\maxwidth]{#1}}
34 % Ensure that by default, figures have no caption (until we provide a
35 % proper Figure object with a Caption API and a way to capture that
36 % in the conversion process - todo).
38 \DeclareCaptionLabelFormat{nolabel
}{}
39 \captionsetup{labelformat=nolabel
}
41 \usepackage{adjustbox
} % Used to constrain images to a maximum size
42 \usepackage{xcolor
} % Allow colors to be defined
43 \usepackage{enumerate
} % Needed for markdown enumerations to work
44 \usepackage{geometry
} % Used to adjust the document margins
45 \usepackage{amsmath
} % Equations
46 \usepackage{amssymb
} % Equations
47 \usepackage{textcomp
} % defines textquotesingle
48 % Hack from http://tex.stackexchange.com/a/47451/13684:
50 \def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code
52 \usepackage{upquote
} % Upright quotes for verbatim code
53 \usepackage{eurosym
} % defines \euro
54 \usepackage[mathletters
]{ucs
} % Extended unicode (utf-8) support
55 \usepackage[utf8x
]{inputenc} % Allow utf-8 characters in the tex document
56 \usepackage{fancyvrb
} % verbatim replacement that allows latex
57 \usepackage{grffile
} % extends the file name processing of package graphics
58 % to support a larger range
59 % The hyperref package gives us a pdf with properly built
60 % internal navigation ('pdf bookmarks' for the table of contents,
61 % internal cross-reference links, web links for URLs, etc.)
63 \usepackage{longtable
} % longtable support required by pandoc >1.10
64 \usepackage{booktabs
} % table support for pandoc > 1.12.2
65 \usepackage[inline
]{enumitem
} % IRkernel/repr support (it uses the enumerate* environment)
66 \usepackage[normalem
]{ulem
} % ulem is needed to support strikethroughs (\sout)
67 % normalem makes italics be italics, not underlines
72 % Colors for the hyperref package
73 \definecolor{urlcolor
}{rgb
}{0,
.145,
.698}
74 \definecolor{linkcolor
}{rgb
}{.71,
0.21,
0.01}
75 \definecolor{citecolor
}{rgb
}{.12,
.54,
.11}
78 \definecolor{ansi-black
}{HTML
}{3E424D
}
79 \definecolor{ansi-black-intense
}{HTML
}{282C36
}
80 \definecolor{ansi-red
}{HTML
}{E75C58
}
81 \definecolor{ansi-red-intense
}{HTML
}{B22B31
}
82 \definecolor{ansi-green
}{HTML
}{00A250
}
83 \definecolor{ansi-green-intense
}{HTML
}{007427}
84 \definecolor{ansi-yellow
}{HTML
}{DDB62B
}
85 \definecolor{ansi-yellow-intense
}{HTML
}{B27D12
}
86 \definecolor{ansi-blue
}{HTML
}{208FFB
}
87 \definecolor{ansi-blue-intense
}{HTML
}{0065CA
}
88 \definecolor{ansi-magenta
}{HTML
}{D160C4
}
89 \definecolor{ansi-magenta-intense
}{HTML
}{A03196
}
90 \definecolor{ansi-cyan
}{HTML
}{60C6C8
}
91 \definecolor{ansi-cyan-intense
}{HTML
}{258F8F
}
92 \definecolor{ansi-white
}{HTML
}{C5C1B4
}
93 \definecolor{ansi-white-intense
}{HTML
}{A1A6B2
}
95 % commands and environments needed by pandoc snippets
96 % extracted from the output of `pandoc -s`
97 \providecommand{\tightlist}{%
98 \setlength{\itemsep}{0pt
}\setlength{\parskip}{0pt
}}
99 \DefineVerbatimEnvironment{Highlighting
}{Verbatim
}{commandchars=\\\
{\
}}
100 % Add ',fontsize=\small' for more characters per line
101 \newenvironment{Shaded
}{}{}
102 \newcommand{\KeywordTok}[1]{\textcolor[rgb
]{0.00,
0.44,
0.13}{\textbf{{#1}}}}
103 \newcommand{\DataTypeTok}[1]{\textcolor[rgb
]{0.56,
0.13,
0.00}{{#1}}}
104 \newcommand{\DecValTok}[1]{\textcolor[rgb
]{0.25,
0.63,
0.44}{{#1}}}
105 \newcommand{\BaseNTok}[1]{\textcolor[rgb
]{0.25,
0.63,
0.44}{{#1}}}
106 \newcommand{\FloatTok}[1]{\textcolor[rgb
]{0.25,
0.63,
0.44}{{#1}}}
107 \newcommand{\CharTok}[1]{\textcolor[rgb
]{0.25,
0.44,
0.63}{{#1}}}
108 \newcommand{\StringTok}[1]{\textcolor[rgb
]{0.25,
0.44,
0.63}{{#1}}}
109 \newcommand{\CommentTok}[1]{\textcolor[rgb
]{0.38,
0.63,
0.69}{\textit{{#1}}}}
110 \newcommand{\OtherTok}[1]{\textcolor[rgb
]{0.00,
0.44,
0.13}{{#1}}}
111 \newcommand{\AlertTok}[1]{\textcolor[rgb
]{1.00,
0.00,
0.00}{\textbf{{#1}}}}
112 \newcommand{\FunctionTok}[1]{\textcolor[rgb
]{0.02,
0.16,
0.49}{{#1}}}
113 \newcommand{\RegionMarkerTok}[1]{{#1}}
114 \newcommand{\ErrorTok}[1]{\textcolor[rgb
]{1.00,
0.00,
0.00}{\textbf{{#1}}}}
115 \newcommand{\NormalTok}[1]{{#1}}
117 % Additional commands for more recent versions of Pandoc
118 \newcommand{\ConstantTok}[1]{\textcolor[rgb
]{0.53,
0.00,
0.00}{{#1}}}
119 \newcommand{\SpecialCharTok}[1]{\textcolor[rgb
]{0.25,
0.44,
0.63}{{#1}}}
120 \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb
]{0.25,
0.44,
0.63}{{#1}}}
121 \newcommand{\SpecialStringTok}[1]{\textcolor[rgb
]{0.73,
0.40,
0.53}{{#1}}}
122 \newcommand{\ImportTok}[1]{{#1}}
123 \newcommand{\DocumentationTok}[1]{\textcolor[rgb
]{0.73,
0.13,
0.13}{\textit{{#1}}}}
124 \newcommand{\AnnotationTok}[1]{\textcolor[rgb
]{0.38,
0.63,
0.69}{\textbf{\textit{{#1}}}}}
125 \newcommand{\CommentVarTok}[1]{\textcolor[rgb
]{0.38,
0.63,
0.69}{\textbf{\textit{{#1}}}}}
126 \newcommand{\VariableTok}[1]{\textcolor[rgb
]{0.10,
0.09,
0.49}{{#1}}}
127 \newcommand{\ControlFlowTok}[1]{\textcolor[rgb
]{0.00,
0.44,
0.13}{\textbf{{#1}}}}
128 \newcommand{\OperatorTok}[1]{\textcolor[rgb
]{0.40,
0.40,
0.40}{{#1}}}
129 \newcommand{\BuiltInTok}[1]{{#1}}
130 \newcommand{\ExtensionTok}[1]{{#1}}
131 \newcommand{\PreprocessorTok}[1]{\textcolor[rgb
]{0.74,
0.48,
0.00}{{#1}}}
132 \newcommand{\AttributeTok}[1]{\textcolor[rgb
]{0.49,
0.56,
0.16}{{#1}}}
133 \newcommand{\InformationTok}[1]{\textcolor[rgb
]{0.38,
0.63,
0.69}{\textbf{\textit{{#1}}}}}
134 \newcommand{\WarningTok}[1]{\textcolor[rgb
]{0.38,
0.63,
0.69}{\textbf{\textit{{#1}}}}}
137 % Define a nice break command that doesn't care if a line doesn't already
139 \def\br{\hspace*
{\fill} \\*
}
140 % Math Jax compatability definitions
143 % Document parameters
149 % Pygments definitions
152 \def\PY@reset
{\let\PY@it=
\relax \let\PY@bf=
\relax%
153 \let\PY@ul=
\relax \let\PY@tc=
\relax%
154 \let\PY@bc=
\relax \let\PY@ff=
\relax}
155 \def\PY@tok
#1{\csname PY@tok@
#1\endcsname}
156 \def\PY@toks
#1+
{\ifx\relax#1\empty\else%
157 \PY@tok
{#1}\expandafter\PY@toks
\fi}
158 \def\PY@do
#1{\PY@bc
{\PY@tc
{\PY@ul
{%
159 \PY@it
{\PY@bf
{\PY@ff
{#1}}}}}}}
160 \def\PY#1#2{\PY@reset
\PY@toks
#1+
\relax+
\PY@do
{#2}}
162 \expandafter\def\csname PY@tok@w
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.73,
0.73}{#
#1}}}
163 \expandafter\def\csname PY@tok@c
\endcsname{\let\PY@it=
\textit\def\PY@tc#
#1{\textcolor[rgb
]{0.25,
0.50,
0.50}{#
#1}}}
164 \expandafter\def\csname PY@tok@cp
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.74,
0.48,
0.00}{#
#1}}}
165 \expandafter\def\csname PY@tok@k
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.50,
0.00}{#
#1}}}
166 \expandafter\def\csname PY@tok@kp
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.50,
0.00}{#
#1}}}
167 \expandafter\def\csname PY@tok@kt
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.69,
0.00,
0.25}{#
#1}}}
168 \expandafter\def\csname PY@tok@o
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.40,
0.40,
0.40}{#
#1}}}
169 \expandafter\def\csname PY@tok@ow
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.67,
0.13,
1.00}{#
#1}}}
170 \expandafter\def\csname PY@tok@nb
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.50,
0.00}{#
#1}}}
171 \expandafter\def\csname PY@tok@nf
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.00,
1.00}{#
#1}}}
172 \expandafter\def\csname PY@tok@nc
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.00,
1.00}{#
#1}}}
173 \expandafter\def\csname PY@tok@nn
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.00,
1.00}{#
#1}}}
174 \expandafter\def\csname PY@tok@ne
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.82,
0.25,
0.23}{#
#1}}}
175 \expandafter\def\csname PY@tok@nv
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.10,
0.09,
0.49}{#
#1}}}
176 \expandafter\def\csname PY@tok@no
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.53,
0.00,
0.00}{#
#1}}}
177 \expandafter\def\csname PY@tok@nl
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.63,
0.63,
0.00}{#
#1}}}
178 \expandafter\def\csname PY@tok@ni
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.60,
0.60,
0.60}{#
#1}}}
179 \expandafter\def\csname PY@tok@na
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.49,
0.56,
0.16}{#
#1}}}
180 \expandafter\def\csname PY@tok@nt
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.50,
0.00}{#
#1}}}
181 \expandafter\def\csname PY@tok@nd
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.67,
0.13,
1.00}{#
#1}}}
182 \expandafter\def\csname PY@tok@s
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.13,
0.13}{#
#1}}}
183 \expandafter\def\csname PY@tok@sd
\endcsname{\let\PY@it=
\textit\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.13,
0.13}{#
#1}}}
184 \expandafter\def\csname PY@tok@si
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.40,
0.53}{#
#1}}}
185 \expandafter\def\csname PY@tok@se
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.40,
0.13}{#
#1}}}
186 \expandafter\def\csname PY@tok@sr
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.40,
0.53}{#
#1}}}
187 \expandafter\def\csname PY@tok@ss
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.10,
0.09,
0.49}{#
#1}}}
188 \expandafter\def\csname PY@tok@sx
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.50,
0.00}{#
#1}}}
189 \expandafter\def\csname PY@tok@m
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.40,
0.40,
0.40}{#
#1}}}
190 \expandafter\def\csname PY@tok@gh
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.00,
0.50}{#
#1}}}
191 \expandafter\def\csname PY@tok@gu
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.50,
0.00,
0.50}{#
#1}}}
192 \expandafter\def\csname PY@tok@gd
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.63,
0.00,
0.00}{#
#1}}}
193 \expandafter\def\csname PY@tok@gi
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.63,
0.00}{#
#1}}}
194 \expandafter\def\csname PY@tok@gr
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{1.00,
0.00,
0.00}{#
#1}}}
195 \expandafter\def\csname PY@tok@ge
\endcsname{\let\PY@it=
\textit}
196 \expandafter\def\csname PY@tok@gs
\endcsname{\let\PY@bf=
\textbf}
197 \expandafter\def\csname PY@tok@gp
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.00,
0.50}{#
#1}}}
198 \expandafter\def\csname PY@tok@go
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.53,
0.53,
0.53}{#
#1}}}
199 \expandafter\def\csname PY@tok@gt
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.27,
0.87}{#
#1}}}
200 \expandafter\def\csname PY@tok@err
\endcsname{\def\PY@bc#
#1{\setlength{\fboxsep}{0pt
}\fcolorbox[rgb
]{1.00,
0.00,
0.00}{1,
1,
1}{\strut #
#1}}}
201 \expandafter\def\csname PY@tok@kc
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.50,
0.00}{#
#1}}}
202 \expandafter\def\csname PY@tok@kd
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.50,
0.00}{#
#1}}}
203 \expandafter\def\csname PY@tok@kn
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.50,
0.00}{#
#1}}}
204 \expandafter\def\csname PY@tok@kr
\endcsname{\let\PY@bf=
\textbf\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.50,
0.00}{#
#1}}}
205 \expandafter\def\csname PY@tok@bp
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.50,
0.00}{#
#1}}}
206 \expandafter\def\csname PY@tok@fm
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.00,
0.00,
1.00}{#
#1}}}
207 \expandafter\def\csname PY@tok@vc
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.10,
0.09,
0.49}{#
#1}}}
208 \expandafter\def\csname PY@tok@vg
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.10,
0.09,
0.49}{#
#1}}}
209 \expandafter\def\csname PY@tok@vi
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.10,
0.09,
0.49}{#
#1}}}
210 \expandafter\def\csname PY@tok@vm
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.10,
0.09,
0.49}{#
#1}}}
211 \expandafter\def\csname PY@tok@sa
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.13,
0.13}{#
#1}}}
212 \expandafter\def\csname PY@tok@sb
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.13,
0.13}{#
#1}}}
213 \expandafter\def\csname PY@tok@sc
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.13,
0.13}{#
#1}}}
214 \expandafter\def\csname PY@tok@dl
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.13,
0.13}{#
#1}}}
215 \expandafter\def\csname PY@tok@s2
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.13,
0.13}{#
#1}}}
216 \expandafter\def\csname PY@tok@sh
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.13,
0.13}{#
#1}}}
217 \expandafter\def\csname PY@tok@s1
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.73,
0.13,
0.13}{#
#1}}}
218 \expandafter\def\csname PY@tok@mb
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.40,
0.40,
0.40}{#
#1}}}
219 \expandafter\def\csname PY@tok@mf
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.40,
0.40,
0.40}{#
#1}}}
220 \expandafter\def\csname PY@tok@mh
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.40,
0.40,
0.40}{#
#1}}}
221 \expandafter\def\csname PY@tok@mi
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.40,
0.40,
0.40}{#
#1}}}
222 \expandafter\def\csname PY@tok@il
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.40,
0.40,
0.40}{#
#1}}}
223 \expandafter\def\csname PY@tok@mo
\endcsname{\def\PY@tc#
#1{\textcolor[rgb
]{0.40,
0.40,
0.40}{#
#1}}}
224 \expandafter\def\csname PY@tok@ch
\endcsname{\let\PY@it=
\textit\def\PY@tc#
#1{\textcolor[rgb
]{0.25,
0.50,
0.50}{#
#1}}}
225 \expandafter\def\csname PY@tok@cm
\endcsname{\let\PY@it=
\textit\def\PY@tc#
#1{\textcolor[rgb
]{0.25,
0.50,
0.50}{#
#1}}}
226 \expandafter\def\csname PY@tok@cpf
\endcsname{\let\PY@it=
\textit\def\PY@tc#
#1{\textcolor[rgb
]{0.25,
0.50,
0.50}{#
#1}}}
227 \expandafter\def\csname PY@tok@c1
\endcsname{\let\PY@it=
\textit\def\PY@tc#
#1{\textcolor[rgb
]{0.25,
0.50,
0.50}{#
#1}}}
228 \expandafter\def\csname PY@tok@cs
\endcsname{\let\PY@it=
\textit\def\PY@tc#
#1{\textcolor[rgb
]{0.25,
0.50,
0.50}{#
#1}}}
245 % for compatibility with earlier versions
252 % Exact colors from NB
253 \definecolor{incolor
}{rgb
}{0.0,
0.0,
0.5}
254 \definecolor{outcolor
}{rgb
}{0.545,
0.0,
0.0}
259 % Prevent overflowing lines due to hard-to-break entities
261 % Setup hyperref package
263 breaklinks=true,
% so long urls are correctly broken across lines
269 % Slightly bigger margins than the latex defaults
271 \geometry{verbose,tmargin=
1in,bmargin=
1in,lmargin=
1in,rmargin=
1in
}
283 \subsection{Package R "talweg"
}\label{package-r-talweg
}
285 Le package \(-\) Time-series sAmpLes forecasted With ExoGenous variables
286 \(-\) contient le code permettant de (re)lancer les expériences
287 numériques décrites dans cette partie et la suivante. Les fonctions
288 principales sont respectivement *
\textbf{getData()
} pour construire un
289 objet R contenant les données à partir de fichiers CSV (extraits de
290 bases de données). Le format choisi en R est une classe R6 (du package
291 du même nom) exposant en particulier les méthodes
\emph{getSerie(i)
} et
292 \emph{getExo(i)
} qui renvoient respectivement la \(i^
{eme
}\) série de
293 24h et les variables exogènes (mesurées) correspondantes. Voir ?Data
294 pour plus d'information, une fois le package chargé. *
295 \textbf{computeForecast()
} pour calculer des prédictions sur une
296 certaine plage temporelle contenue dans
\emph{data
\textless{}-
297 getData(...)
} *
\textbf{computeError()
} pour évaluer les erreurs
298 commises par différentes méthodes.
300 Le package contient en outre diverses fonctions graphiques
301 \emph{plotXXX()
}, utilisées dans la partie suivante.
303 \begin{Verbatim
}[commandchars=\\\
{\
}]
304 {\color{incolor
}In
[{\color{incolor
}3}]:
} \PY{c+c1
}{\PYZsh{} Chargement de la librairie (après compilation,
\PYZdq{}R CMD INSTALL .
\PYZdq{})
}
305 \PY{k+kn
}{library
}\PY{p
}{(
}talweg
\PY{p
}{)
}
307 \PY{c+c1
}{\PYZsh{} Acquisition des données (depuis les fichiers CSV)
}
308 ts
\PYZus{}data
\PY{o
}{\PYZlt{}\PYZhy{}} read.csv
\PY{p
}{(
}\PY{k+kp
}{system.file
}\PY{p
}{(
}\PY{l+s
}{\PYZdq{}}\PY{l+s
}{extdata
\PYZdq{}}\PY{p
}{,
}\PY{l+s
}{\PYZdq{}}\PY{l+s
}{pm10
\PYZus{}mesures
\PYZus{}H
\PYZus{}loc.csv
\PYZdq{}}\PY{p
}{,
}package
\PY{o
}{=
}\PY{l+s
}{\PYZdq{}}\PY{l+s
}{talweg
\PYZdq{}}\PY{p
}{)
}\PY{p
}{)
}
309 exo
\PYZus{}data
\PY{o
}{\PYZlt{}\PYZhy{}} read.csv
\PY{p
}{(
}\PY{k+kp
}{system.file
}\PY{p
}{(
}\PY{l+s
}{\PYZdq{}}\PY{l+s
}{extdata
\PYZdq{}}\PY{p
}{,
}\PY{l+s
}{\PYZdq{}}\PY{l+s
}{meteo
\PYZus{}extra
\PYZus{}noNAs.csv
\PYZdq{}}\PY{p
}{,
}package
\PY{o
}{=
}\PY{l+s
}{\PYZdq{}}\PY{l+s
}{talweg
\PYZdq{}}\PY{p
}{)
}\PY{p
}{)
}
310 data
\PY{o
}{\PYZlt{}\PYZhy{}} getData
\PY{p
}{(
}ts
\PYZus{}data
\PY{p
}{,
} exo
\PYZus{}data
\PY{p
}{,
} input
\PYZus{}tz
\PY{o
}{=
}\PY{l+s
}{\PYZdq{}}\PY{l+s
}{GMT
\PYZdq{}}\PY{p
}{,
} date
\PYZus{}format
\PY{o
}{=
}\PY{l+s
}{\PYZdq{}}\PY{l+s
}{\PYZpc{}d/
\PYZpc{}m/
\PYZpc{}Y
\PYZpc{}H:
\PYZpc{}M
\PYZdq{}}\PY{p
}{,
}
311 working
\PYZus{}tz
\PY{o
}{=
}\PY{l+s
}{\PYZdq{}}\PY{l+s
}{GMT
\PYZdq{}}\PY{p
}{,
} predict
\PYZus{}at
\PY{o
}{=
}\PY{l+m
}{7}\PY{p
}{,
} limit
\PY{o
}{=
}\PY{l+m
}{120}\PY{p
}{)
}
312 \PY{c+c1
}{\PYZsh{} Plus de détails à la section
1 ci
\PYZhy{}après.
}
314 \PY{c+c1
}{\PYZsh{} Prédiction de
10 courbes (jours
102 à
111)
}
315 pred
\PY{o
}{\PYZlt{}\PYZhy{}} computeForecast
\PY{p
}{(
}data
\PY{p
}{,
} \PY{l+m
}{101}\PY{o
}{:
}\PY{l+m
}{110}\PY{p
}{,
} \PY{l+s
}{\PYZdq{}}\PY{l+s
}{Persistence
\PYZdq{}}\PY{p
}{,
} \PY{l+s
}{\PYZdq{}}\PY{l+s
}{Zero
\PYZdq{}}\PY{p
}{,
} memory
\PY{o
}{=
}\PY{l+m
}{50}\PY{p
}{,
} horizon
\PY{o
}{=
}\PY{l+m
}{12}\PY{p
}{,
} ncores
\PY{o
}{=
}\PY{l+m
}{1}\PY{p
}{)
}
316 \PY{c+c1
}{\PYZsh{} Plus de détails à la section
2 ci
\PYZhy{}après.
}
318 \PY{c+c1
}{\PYZsh{} Calcul des erreurs (sur un horizon arbitraire
\PYZlt{}= horizon de prédiction)
}
319 err
\PY{o
}{\PYZlt{}\PYZhy{}} computeError
\PY{p
}{(
}data
\PY{p
}{,
} pred
\PY{p
}{,
} horizon
\PY{o
}{=
}\PY{l+m
}{6}\PY{p
}{)
}
320 \PY{c+c1
}{\PYZsh{} Plus de détails à la section
3 ci
\PYZhy{}après.
}
322 \PY{c+c1
}{\PYZsh{} Puis voir ?plotError et les autres plot dans le paragraphe
\PYZsq{}seealso
\PYZsq{}}
325 \subsubsection{getData()
}\label{getdata
}
327 Les arguments de cette fonction sont, dans l'ordre :
1.
328 \textbf{ts
\_data} : séries temporelles (fichier CSV avec entête ou
329 data.frame) ; la première colonne contient les heures, la seconde les
330 valeurs.
2.
\textbf{exo
\_data} : variables exogènes (fichier CSV avec
331 entête ou data.frame) ; la première colonne contient les jours, les
332 \(m\) suivantes les variables mesurées pour ce jour, et les \(m\)
333 dernières les variables prédites pour ce même jour. Dans notre cas
334 \(m=
4\) : pression, température, gradient de température, vitesse du
335 vent.
3.
\textbf{input
\_tz} : zone horaire pour ts
\_data (défaut :
336 "GMT").
4.
\textbf{date
\_format} : format des heures dans ts
\_data
337 (défaut : "\%d/\%m/\%Y \%H:\%M", format du fichier transmis par Michel).
338 5.
\textbf{working
\_tz} : zone horaire dans laquelle on souhaite
339 travailler avec les données (défaut : "GMT").
6.
\textbf{predict
\_at} :
340 heure à laquelle s'effectue la prévision \(-\) et donc dernière heure
341 d'un bloc de
24h, relativement à working
\_tz. data
\texttt{\$
}getSerie(
3)
342 renvoit ainsi les
24 valeurs de
8h à
7h pour le \(
3^
{eme
}\) bloc de
24h
343 présent dans le jeu de données.
345 \begin{Verbatim
}[commandchars=\\\
{\
}]
346 {\color{incolor
}In
[{\color{incolor
}11}]:
} \PY{k+kp
}{print
}\PY{p
}{(
}data
\PY{p
}{)
}
347 \PY{c+c1
}{\PYZsh{}?Data
}
350 \begin{Verbatim
}[commandchars=\\\
{\
}]
353 append: function (time, serie, exo, exo
\_hat)
354 clone: function (deep = FALSE)
355 getCenteredSerie: function (index)
356 getCenteredSeries: function (indices)
357 getExo: function (index)
358 getExoHat: function (index)
359 getLevel: function (index)
360 getSerie: function (index)
361 getSeries: function (indices)
363 getStdHorizon: function ()
364 getTime: function (index)
365 removeFirst: function ()
366 removeLast: function ()
372 \subsubsection{computeForecast()
}\label{computeforecast
}
374 Les arguments de cette fonction sont, dans l'ordre :
1.
\textbf{data
} :
375 le jeu de données renvoyé par getData()
2.
\textbf{indices
} : l'ensemble
376 de jours dont on veut prévoir les "lendemains" (prochains blocs de
24h)
377 ; peut être donnée sous forme d'un vecteur de dates ou d'entiers
378 (correspondants aux numéros des jours).
3.
\textbf{forecaster
} : le nom
379 du prédicteur principal à utiliser ; voir ?computeForecast
4.
380 \textbf{pjump
} : le nom du prédicteur de saut d'une série à l'autre ;
381 voir ?computeForecast
5.
\textbf{memory
} : le nombre de jours à prendre
382 en compte dans le passé pour chaque prévision (par défaut : Inf,
383 c'est-à-dire tout l'historique pris en compte).
6.
\textbf{horizon
} : le
384 nombre d'heures à prédire ; par défaut "data
\texttt{\$
}getStdHorizon()",
385 c'est-à-dire le nombre d'heures restantes à partir de l'instant de
386 prévision +
1 jusqu'à minuit (
17 pour predict
\_at=
7 par exemple).
7.
387 \textbf{ncores
} : le nombre de processus parallèles (utiliser
1 pour une
388 exécution séquentielle)
390 \begin{Verbatim
}[commandchars=\\\
{\
}]
391 {\color{incolor
}In
[{\color{incolor
}8}]:
} \PY{k+kp
}{print
}\PY{p
}{(
}pred
\PY{p
}{)
}
392 \PY{c+c1
}{\PYZsh{}?computeForecast
}
395 \begin{Verbatim
}[commandchars=\\\
{\
}]
398 append: function (forecast, params, index
\_in\_data)
399 clone: function (deep = FALSE)
400 getDates: function ()
401 getForecast: function (index)
402 getIndexInData: function (index)
403 getParams: function (index)
405 initialize: function (dates)
407 .dates:
14323 14324 14325 14326 14327 14328 14329 14330 14331 14332
412 \subsubsection{computeError()
}\label{computeerror
}
414 Les arguments de cette fonction sont, dans l'ordre :
1.
\textbf{data
} :
415 le jeu de données renvoyé par getData()
2.
\textbf{pred
} : les
416 prédictions renvoyées par computeForecast()
3.
\textbf{horizon
} : le
417 nombre d'heures à considérer pour le calcul de l'erreur ; doit être
418 inférieur ou égal à l'horizon utilisé pour la prédiction (même valeur
419 par défaut : "data
\texttt{\$
}getStdHorizon()")
421 \begin{Verbatim
}[commandchars=\\\
{\
}]
422 {\color{incolor
}In
[{\color{incolor
}9}]:
} \PY{k+kp
}{summary
}\PY{p
}{(
}err
\PY{p
}{)
}
423 \PY{k+kp
}{summary
}\PY{p
}{(
}err
\PY{o
}{\PYZdl{}}\PY{k+kp
}{abs
}\PY{p
}{)
}
424 \PY{k+kp
}{summary
}\PY{p
}{(
}err
\PY{o
}{\PYZdl{}}MAPE
\PY{p
}{)
}
439 indices
10 -none- numeric
447 indices
10 -none- numeric
451 \subsubsection{Graphiques
}\label{graphiques
}
453 Voir ?plotError : les autres fonctions graphiques sont dans la section
457 ‘plotCurves’, ‘plotPredReal’, ‘plotSimils’, ‘plotFbox’,
458 ‘computeFilaments’, ‘plotFilamentsBox’, ‘plotRelVar’
464 % Add a bibliography block to the postdoc