mirror of
https://github.com/eddelbuettel/binb
synced 2024-12-22 12:39:58 +01:00
Merge pull request #20 from robjhyndman/master
Improvements to Monash template
This commit is contained in:
commit
27f4e05882
@ -4,10 +4,8 @@ title: Monash
|
|||||||
date: \today
|
date: \today
|
||||||
titlefontsize: 22pt
|
titlefontsize: 22pt
|
||||||
fontsize: 12pt
|
fontsize: 12pt
|
||||||
colortheme: monashblue
|
|
||||||
toc: true
|
toc: true
|
||||||
tocheader: Time series graphics
|
tocheader: Time series graphics
|
||||||
tighttoc: true
|
|
||||||
output:
|
output:
|
||||||
binb::monash:
|
binb::monash:
|
||||||
fig_height: 4.5
|
fig_height: 4.5
|
||||||
|
Binary file not shown.
147
inst/monashDemo/monashOptions.Rmd
Normal file
147
inst/monashDemo/monashOptions.Rmd
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
---
|
||||||
|
# Version of Monash demo to show off some available options
|
||||||
|
author: Rob J Hyndman
|
||||||
|
title: Monash
|
||||||
|
date: \today
|
||||||
|
titlefontsize: 22pt
|
||||||
|
titlecolor: burntorange
|
||||||
|
fontsize: 12pt
|
||||||
|
classoption: aspectratio=169
|
||||||
|
titlepage: title16x9.png
|
||||||
|
toc: true
|
||||||
|
tocheader: Time series graphics
|
||||||
|
output:
|
||||||
|
binb::monash:
|
||||||
|
colortheme: monashblue
|
||||||
|
keep_tex: yes
|
||||||
|
fig_height: 3.3
|
||||||
|
fig_width: 8
|
||||||
|
header-includes:
|
||||||
|
- \usepackage{booktabs}
|
||||||
|
- \tabcolsep=0.12cm
|
||||||
|
- \definecolor{burntorange}{rgb}{0.8, 0.33, 0.0}
|
||||||
|
---
|
||||||
|
|
||||||
|
```{r setup, include=FALSE}
|
||||||
|
knitr::opts_chunk$set(echo = TRUE)
|
||||||
|
library(forecast)
|
||||||
|
library(ggplot2)
|
||||||
|
options(width=50)
|
||||||
|
```
|
||||||
|
|
||||||
|
# Time plots
|
||||||
|
|
||||||
|
## Time plots
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
autoplot(USAccDeaths) +
|
||||||
|
ylab("Total deaths") + xlab("Year")
|
||||||
|
```
|
||||||
|
|
||||||
|
# Seasonal plots
|
||||||
|
|
||||||
|
## Seasonal plots
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
ggseasonplot(USAccDeaths, year.labels=TRUE,
|
||||||
|
year.labels.left=TRUE) + ylab("Total deaths")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Seasonal plots
|
||||||
|
|
||||||
|
* Data plotted against the individual "seasons" in which the data were observed. (In this case a "season" is a month.)
|
||||||
|
* Something like a time plot except that the data from each season are overlapped.
|
||||||
|
* Enables the underlying seasonal pattern to be seen more clearly, and also allows any substantial departures from the seasonal pattern to be easily identified.
|
||||||
|
* In R: `ggseasonplot()`
|
||||||
|
|
||||||
|
# Seasonal polar plots
|
||||||
|
|
||||||
|
## Seasonal polar plots
|
||||||
|
|
||||||
|
```{r, out.width="6.2cm"}
|
||||||
|
ggseasonplot(USAccDeaths, year.labels=TRUE,
|
||||||
|
polar=TRUE) + ylab("Total deaths")
|
||||||
|
```
|
||||||
|
|
||||||
|
\only<2>{
|
||||||
|
\begin{textblock}{4}(8,4)
|
||||||
|
\begin{alertblock}{}
|
||||||
|
Only change is to switch to polar coordinates.
|
||||||
|
\end{alertblock}
|
||||||
|
\end{textblock}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Seasonal subseries plots
|
||||||
|
|
||||||
|
## Seasonal subseries plots
|
||||||
|
|
||||||
|
```{r, echo=TRUE}
|
||||||
|
ggsubseriesplot(USAccDeaths) +
|
||||||
|
ylab("Total deaths")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Seasonal subseries plots
|
||||||
|
|
||||||
|
* Data for each season collected together in time plot as separate time series.
|
||||||
|
* Enables the underlying seasonal pattern to be seen clearly, and changes in seasonality over time to be visualized.
|
||||||
|
* In R: `ggsubseriesplot()`
|
||||||
|
|
||||||
|
|
||||||
|
# Lag plots and autocorrelation
|
||||||
|
|
||||||
|
## Lagged scatterplots
|
||||||
|
|
||||||
|
```{r, fig.height=4.5, out.width="45%"}
|
||||||
|
gglagplot(USAccDeaths/1000, lags=9)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Lagged scatterplots
|
||||||
|
|
||||||
|
```{r, fig.height=4.5, out.width="45%"}
|
||||||
|
gglagplot(USAccDeaths/1000, lags=9, do.lines=FALSE)
|
||||||
|
```
|
||||||
|
|
||||||
|
\only<2>{
|
||||||
|
\begin{textblock}{6.8}(8.3,3)
|
||||||
|
\begin{block}{}
|
||||||
|
\begin{itemize}\tightlist
|
||||||
|
\item Each graph shows $y_t$ plotted against $y_{t-k}$ for different values of $k$.
|
||||||
|
\item Autocorrelations are correlations associated with these scatterplots.
|
||||||
|
\end{itemize}
|
||||||
|
\end{block}
|
||||||
|
\end{textblock}
|
||||||
|
}
|
||||||
|
|
||||||
|
## Autocorrelation
|
||||||
|
|
||||||
|
We denote the sample autocovariance at lag $k$ by $c_k$ and the sample autocorrelation at lag $k$ by $r_k$. Then define
|
||||||
|
|
||||||
|
\begin{block}{}
|
||||||
|
\begin{align*}
|
||||||
|
c_k &= \frac{1}{T}\sum_{t=k+1}^T (y_t-\bar{y})(y_{t-k}-\bar{y}) \\[0.cm]
|
||||||
|
\text{and}\qquad
|
||||||
|
r_{k} &= c_k/c_0
|
||||||
|
\end{align*}
|
||||||
|
\end{block}\pause\small
|
||||||
|
|
||||||
|
* $r_1$ indicates how successive values of $y$ relate to each other
|
||||||
|
* $r_2$ indicates how $y$ values two periods apart relate to each other
|
||||||
|
* $r_k$ is \textit{almost} the same as the sample correlation between $y_t$ and $y_{t-k}$.
|
||||||
|
|
||||||
|
## Autocorrelation
|
||||||
|
|
||||||
|
Results for first 9 lags for `USAccDeaths` data:
|
||||||
|
|
||||||
|
|
||||||
|
```{r, echo=FALSE, results='asis'}
|
||||||
|
USAccDeathsacf <- matrix(acf(c(USAccDeaths), lag.max=9,
|
||||||
|
plot=FALSE)$acf[-1,,1], nrow=1)
|
||||||
|
colnames(USAccDeathsacf) <- paste("$r_",1:9,"$",sep="")
|
||||||
|
knitr::kable(USAccDeathsacf, booktabs=TRUE,
|
||||||
|
align="c", digits=3,
|
||||||
|
format.args=list(nsmall=3))
|
||||||
|
```
|
||||||
|
|
||||||
|
```{r USAccDeathsacf, fig.height=2}
|
||||||
|
ggAcf(USAccDeaths)
|
||||||
|
```
|
BIN
inst/monashDemo/monashOptions.pdf
Normal file
BIN
inst/monashDemo/monashOptions.pdf
Normal file
Binary file not shown.
BIN
inst/monashDemo/title16x9.png
Normal file
BIN
inst/monashDemo/title16x9.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 414 KiB |
@ -78,6 +78,17 @@ $if(titlefontsize)$
|
|||||||
\setbeamerfont{title}{series=\bfseries,parent=structure,size=\fontsize{$titlefontsize$}{32}}
|
\setbeamerfont{title}{series=\bfseries,parent=structure,size=\fontsize{$titlefontsize$}{32}}
|
||||||
$endif$
|
$endif$
|
||||||
|
|
||||||
|
% Title page
|
||||||
|
\setbeamertemplate{title page}
|
||||||
|
{\placefig{-0.01}{-0.01}{width=1.01\paperwidth,height=1.01\paperheight}{$if(titlepage)$$titlepage$$else$titlepage$endif$}
|
||||||
|
\begin{textblock}{7.5}(1,2.8)\usebeamerfont{title}
|
||||||
|
{\color{$if(titlecolor)$$titlecolor$$else$white$endif$}\raggedright\par\inserttitle}
|
||||||
|
\end{textblock}
|
||||||
|
\begin{textblock}{7.5}(1,7)
|
||||||
|
{\color{$if(titlecolor)$$titlecolor$$else$white$endif$}\raggedright{\insertauthor}\mbox{}\\[0.2cm]
|
||||||
|
\insertdate}
|
||||||
|
\end{textblock}}
|
||||||
|
|
||||||
$if(mainfont)$
|
$if(mainfont)$
|
||||||
\usefonttheme{serif} % use mainfont rather than sansfont for slide text
|
\usefonttheme{serif} % use mainfont rather than sansfont for slide text
|
||||||
$endif$
|
$endif$
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
%% Font theme for use with Monash beamer theme
|
%% Font theme for use with Monash beamer theme
|
||||||
%% Created by Rob J Hyndman. 8 October 2018
|
%% Created by Rob J Hyndman. 8 October 2018
|
||||||
|
|
||||||
\usepackage[lf,t]{carlito}
|
\IfFileExists{carlito.sty}{\usepackage[lf,t]{carlito}}{\usepackage{bera}}
|
||||||
%\usepackage{bera}
|
|
||||||
|
|
||||||
% Lets make descriptions and alerts bold
|
% Lets make descriptions and alerts bold
|
||||||
\setbeamerfont{description item}{series=\bfseries}
|
\setbeamerfont{description item}{series=\bfseries}
|
||||||
|
@ -57,18 +57,6 @@
|
|||||||
\setlength{\TPVertModule}{1cm}
|
\setlength{\TPVertModule}{1cm}
|
||||||
\def\placefig#1#2#3#4{\begin{textblock}{.1}(#1,#2)\rlap{\includegraphics[#3]{#4}}\end{textblock}}
|
\def\placefig#1#2#3#4{\begin{textblock}{.1}(#1,#2)\rlap{\includegraphics[#3]{#4}}\end{textblock}}
|
||||||
|
|
||||||
% Monash title page
|
|
||||||
% For binb, one can alter the font size by setting eg 'titlefontsize: 20pt' in the YAML header
|
|
||||||
\setbeamerfont{title}{series=\bfseries,parent=structure,size=\fontsize{24}{32}}
|
|
||||||
\setbeamertemplate{title page}
|
|
||||||
{\placefig{-0.01}{-0.01}{width=1.01\paperwidth,height=1.01\paperheight}{titlepage}
|
|
||||||
\begin{textblock}{7.5}(1,2.8)\usebeamerfont{title}
|
|
||||||
{\color{white}\raggedright\par\inserttitle}
|
|
||||||
\end{textblock}
|
|
||||||
\begin{textblock}{7.5}(1,7)
|
|
||||||
{\color{white}\raggedright{\insertauthor}\mbox{}\\[0.2cm]
|
|
||||||
\insertdate}
|
|
||||||
\end{textblock}}
|
|
||||||
|
|
||||||
% Reduce vertical space around displayed equations
|
% Reduce vertical space around displayed equations
|
||||||
\preto\frame{%
|
\preto\frame{%
|
||||||
|
Loading…
x
Reference in New Issue
Block a user