diff --git a/StanCourseVLB/StanCourse.Rproj b/StanCourseVLB/StanCourse.Rproj new file mode 100644 index 0000000..8f85a0f --- /dev/null +++ b/StanCourseVLB/StanCourse.Rproj @@ -0,0 +1,13 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: knitr +LaTeX: pdfLaTeX diff --git a/StanCourseVLB/libs/remark-css/default-fonts.css b/StanCourseVLB/libs/remark-css/default-fonts.css new file mode 100644 index 0000000..8d035fa --- /dev/null +++ b/StanCourseVLB/libs/remark-css/default-fonts.css @@ -0,0 +1,10 @@ +@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); +@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic); +@import url(https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700); + +body { font-family: 'Droid Serif', 'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC', serif; } +h1, h2, h3 { + font-family: 'Yanone Kaffeesatz'; + font-weight: normal; +} +.remark-code, .remark-inline-code { font-family: 'Source Code Pro', 'Lucida Console', Monaco, monospace; } diff --git a/StanCourseVLB/libs/remark-css/default.css b/StanCourseVLB/libs/remark-css/default.css new file mode 100644 index 0000000..cb9fc34 --- /dev/null +++ b/StanCourseVLB/libs/remark-css/default.css @@ -0,0 +1,72 @@ +a, a > code { + color: rgb(249, 38, 114); + text-decoration: none; +} +.footnote { + position: absolute; + bottom: 3em; + padding-right: 4em; + font-size: 90%; +} +.remark-code-line-highlighted { background-color: #ffff88; } + +.inverse { + background-color: #272822; + color: #d6d6d6; + text-shadow: 0 0 20px #333; +} +.inverse h1, .inverse h2, .inverse h3 { + color: #f3f3f3; +} +/* Two-column layout */ +.left-column { + color: #777; + width: 20%; + height: 92%; + float: left; +} +.left-column h2:last-of-type, .left-column h3:last-child { + color: #000; +} +.right-column { + width: 75%; + float: right; + padding-top: 1em; +} +.pull-left { + float: left; + width: 47%; +} +.pull-right { + float: right; + width: 47%; +} +.pull-right ~ * { + clear: both; +} +img, video, iframe { + max-width: 100%; +} +blockquote { + border-left: solid 5px lightgray; + padding-left: 1em; +} +.remark-slide table { + margin: auto; + border-top: 1px solid #666; + border-bottom: 1px solid #666; +} +.remark-slide table thead th { border-bottom: 1px solid #ddd; } +th, td { padding: 5px; } +.remark-slide thead, .remark-slide tfoot, .remark-slide tr:nth-child(even) { background: #eee } + +@page { margin: 0; } +@media print { + .remark-slide-scaler { + width: 100% !important; + height: 100% !important; + transform: scale(1) !important; + top: 0 !important; + left: 0 !important; + } +} diff --git a/StanCourseVLB/photos/bullshark_acousticarray.jpg b/StanCourseVLB/photos/bullshark_acousticarray.jpg new file mode 100644 index 0000000..4aedd6c Binary files /dev/null and b/StanCourseVLB/photos/bullshark_acousticarray.jpg differ diff --git a/StanCourseVLB/photos/cabopulmosearch.png b/StanCourseVLB/photos/cabopulmosearch.png new file mode 100644 index 0000000..04ea814 Binary files /dev/null and b/StanCourseVLB/photos/cabopulmosearch.png differ diff --git a/StanCourseVLB/photos/pelagioskakunja.png b/StanCourseVLB/photos/pelagioskakunja.png new file mode 100644 index 0000000..dadfb9c Binary files /dev/null and b/StanCourseVLB/photos/pelagioskakunja.png differ diff --git a/StanCourseVLB/stanhour3.Rmd b/StanCourseVLB/stanhour3.Rmd new file mode 100644 index 0000000..faf4085 --- /dev/null +++ b/StanCourseVLB/stanhour3.Rmd @@ -0,0 +1,572 @@ +--- +title: "Stan @ ISEC 2020" +subtitle: "" +author: "The Crew" +date: "20 June 2020" +output: + xaringan::moon_reader: + css: xaringan-themer.css + lib_dir: libs + nature: + highlightStyle: solarized-light + highlightLines: true + countIncrementalSlides: false +--- +class: inverse, center, middle + +```{r setup, include=FALSE} +options(htmltools.dir.version = FALSE) + +library(ggplot2) + +``` + +```{r xaringan-themer, include=FALSE, warning=FALSE} +library(xaringanthemer) +style_solarized_light() +``` + +# Building a Logistic Regression Model + + +--- +## Cabo Pulmo, Baja California Sur, México + +.center[![cabo pulmo](photos/cabopulmosearch.png)] + +--- +## Pelagios Kakunjá -- Bull Shark Data + +Frida Lara -- http://migramar.org/hi/en/lara/ + +James Ketchum -- https://www.pelagioskakunja.org/james-ketchum + +.center[![pelagios](photos/pelagioskakunja.png)] + +https://www.pelagioskakunja.org/ + + +--- +## Presence/Absence Data from an Acoustic Array + +.pull-left[ +$Y$ can takes on the value of `1` when the shark is detected, and `0` when it is not. + +Observation Process: + + +$$ +Y \sim Bernoulli(p) +$$ + +Prior: + +$$ +p \sim unif(0, 1) +$$ +$$ +p \sim beta(1, 1) +$$ +] + +.pull-right[ +Photo by Miguel Grau Gómez: + +```{r, echo=FALSE, out.width ="70%"} +knitr::include_graphics("photos/bullshark_acousticarray.jpg") +``` +] + +--- +## Stan Code + +```{stan, output.var = "ex1", eval=F} + +data{ + int TT; + int y[TT]; +} + +parameters{ + real p; +} + + +model{ + + p ~ uniform(0, 1); + //p ~ beta(1,1); + + y ~ bernoulli(p); +} + +``` + +.footnote[Order doesn't matter in the model code.] + + +--- +class: center +### Priors over the interval (0,1): + +Combinations: + +( $\nu_1 = 1, \nu_2=1$ ), ( $\nu_1=2, \nu_2=1$ ) , ( $\alpha=1, \beta=2$ ) + +( $\alpha=10, \beta=1$ ), ( $\alpha=1, \beta=10$ ), ( $\alpha=10, \beta=10$ ) + +```{r, echo=FALSE, fig.height=5} + +cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7") + +alpha = c(1, 2, 1, 10, 1, 10) +beta = c(1, 1, 2, 1, 10, 10) +x01 <- data.frame(x=c(0, 1)) + +betaplot <- ggplot(x01, aes(x)) + +for(g in 1:6) + betaplot <- betaplot + + stat_function(fun=dbeta, args=list(shape1=alpha[g], shape2=beta[g]), color=cbPalette[g], size=1) + +betaplot + theme_minimal() + ylab("f(x)") + +``` + + +--- +### Is the probability constant over time? + +$Y$ can takes on the value of `1` when the shark is detected, and `0` when it is not. + + +$$ +Y_t \sim Bernoulli(p_t) +$$ + +$$ +logit(p_t) = f(t) +$$ + Commonly, $f(t)$ is expressed as a linear function of parameters and covariate values. + +$$ +f(t) = \beta_0 + \beta_1 x_t +$$ + +Priors: + +$$\beta_0 \sim N(m_{\beta_0}, sd_{\beta_0}) \qquad \beta_1 \sim N(0, sd_{\beta_1})$$ + +.footnote[ $f(t)$ can also be a smooth non-linear function! -- `brms`, `rstanarm`] + + +--- +### Stan Code + +Changes: allowing for time-varying covariates + + +```{stan, output.var = "ex2", eval=F} + +data{ + int TT; + int y[TT]; + + int ncov; + matrix[TT, ncov + 1] x; +} + +parameters{ + vector[ncov + 1] beta; +} + + +model{ + + beta ~ normal(0, 0.5); + + y ~ bernoulli_logit(x*beta); +} + +``` + + +--- +## Accounting for individual size/sex differences + +We may expect and want to account for differences across size and sex. + +$$f(t) = \beta_0 (sex, size) + \beta_1 * x_t$$ + + + + +$$\beta_0 (sex, size) = \alpha_0 + \alpha_1 *male + \alpha_2 *(size - baselinesize)$$ + +Where we have: + + + +$$ +male = 1 \quad \text{if shark is male (has claspers); zero o.w.} +$$ + +$$ +baselinesize: \text{ e.g. size at which the sharks reach maturity, here approx. 220 cm } +$$ + +--- +## Stan Code + +Changes: removing intercept term $\beta_0$ and allowing it to reflect baseline differences across sharks. Change `x` to no longer contain a column of ones. + +.pull-left[ +```{stan, output.var = "ex2", eval=F} + +data{ + ... + int ncov; + matrix[TT, ncov] x; + + vector[TT] bsize; + int sex[TT]; +} + +parameters{ + vector[ncov] beta; + vector[3] alpha; +} +``` +] + + +.pull-right[ +```{stan, output.var="ex21", eval=F} + +model{ + alpha[1] ~ normal(0, 0.5); + alpha[2] ~ normal(0, 0.5); + //values range from -40 to 40 + alpha[3] ~ normal(0, 0.1); + beta ~ normal(0, 0.5); + y ~ bernoulli_logit(alpha[1] + + alpha[2]*sex + + alpha[3]*bsize + + x*beta); +} + +``` +] + +--- +class: inverse, middle +# Missing Discrete-Valued Covariates +## (or categorical covariates) + +--- +class: middle, center +### Marginalizing over discrete-valued covariates/categorical covariates + + +`Law of Total Probability` + +$$P(Y) = \sum_{n=1}^N P(Y|X = x_n)P(X=x_n)$$ + +--- +### Marginalizing in the shark example +Sex $\in$ {female, male} $\rightarrow$ {0, 1} + + +We go from this: + +$$ +Y_t \sim Bernoulli(p_t) +$$ + + +To: + +$$ +Y_t \sim \pi Bernoulli(p_t(female)) + (1-\pi)Bernoulli(p_t(male)) +$$ +$\pi \in (0, 1)$ + +$$p_t(female) = \beta_0(female, size) + \beta_1x_t$$ + +$$p_t(male) = \beta_0(male, size) + \beta_1x_t$$ + + +Where $\pi$ represents the probability that the shark is female. + +--- +## Stan Code +Changes: need to identify the observations from the shark that is missing a value for sex. + +```{stan, output.var="ex3", eval=F} +data{ + int TT; + int y[TT]; + + //vector with 1 if sex is missing + int sexmissing[TT]; + int ncov; + matrix[TT, ncov] x; + + vector bsize[TT]; + vector sex[TT]; +} + +parameters{ + vector[ncov] beta; + vector[3] alpha; +} +``` + + +--- +## Stan Code +Changes: need to identify the observations from the shark that is missing a value for sex. + +```{stan, output.var="ex31", eval=F} +model{ + ... + for(t in 1:TT){ + if(sexmissing[t] == 1){ + target += log_mix(pi, + bernoulli_logit_lpmf(y[t] | alpha[1] + + alpha[3]*bsize + + x[t]*beta), + bernoulli_logit_lpmf(y[t] | alpha[1] + + alpha[2] + + alpha[3]*bsize[t] + + x[t]*beta)); + } else { + y[t] ~ bernoulli_logit(alpha[1] + + alpha[2]*sex[t] + alpha[3]*bsize[t] + + x[t]*beta); + } + } +} +``` + + +--- +class: inverse + +## A very not profound overview of a hierarchical model but definitely an example of one + + +--- +## More differences across individuals + +A simple hierarchical model: + +$$Y_{jt} \sim Bernoulli(p_{jt})$$ + + + +$$logit(p_{jt}) = \beta_0 (sex, size) + \beta_{j1} * x_t$$ + + +$$\beta_{j1} \sim N(\mu, \sigma)$$ +$$\mu \sim N(m_{\mu}, s_{\mu}) \quad \sigma \sim N^+(m_{\sigma}, s_{\sigma})$$ +Why might this be important to include? Aside from the differences across individuals related to their sex and size (related to maturity), the sharks may not all have the same temporal patterns. Some may arrive before others, leave a bit later, and understanding individual variation plays an important role in their conservation. + +--- +## Stan Code + +Changes: have an index for individual shark and $\beta_1$ is now a hierarchical term in the model + + +```{stan, output.var = "ex4", eval=F} +data{ + ... + int no.sharks; + vector[TT] sharkid; +} + +parameters{ + ... + vector[no.sharks] beta; + real betamu; + real betasig; +} +``` + +--- +## Stan Code + +Changes: have an index for individual shark and $\beta_1$ is now a hierarchical term in the model + + +```{stan, output.var="ex41", eval=F} +model{ + alpha[1] ~ normal(0, 0.5); + alpha[2] ~ normal(0, 0.5); + //values range from -40 to 40 + alpha[3] ~ normal(0, 0.1); + + betamu ~ normal(0, 0.1); + betasig ~ normal(0, 0.1); + + for(n in no.sharks){ + beta[n] ~ normal(betamu, betasig); + } + + for(t in 1:TT){ + y[t] ~ bernoulli_logit(alpha[1] + alpha[2]*sex[t] + + alpha[3]*bsize[t] + x[t]*beta[sharkid[t]]); + } +} + +``` + +--- +class: inverse +# Model Assessment: + +# To Describe, Explain or Predict? + + + + +--- +### Describe(/Explain): + +- Use full data set to fit model +- Evaluate posterior predictive checks +- For logistic regression, `binned residuals for discrete data` + + +Bayesian Data Analysis: http://www.stat.columbia.edu/~gelman/book/ (pg 157-158) + +Galit Shmueli's: To Explain or Predict? https://www.stat.berkeley.edu/~aldous/157/Papers/shmueli.pdf + +--- +class: inverse +## Predict: `projpred` + +### Projection predictive variable selection + + +```{r, eval=F} +library(rstanarm) +library(projpred) +library(ggplot2) +library(bayesplot) +theme_set(theme_classic()) +``` + +https://mc-stan.org/projpred/articles/quickstart.html + +--- +### projpred + +Back to the fixed effects for a minute: + +```{r, eval=F} +n <- 337 +D <- 27 +p0 <- 2 # prior guess for the number of relevant variables +tau0 <- p0/(D-p0) * 1/sqrt(n) +# regularized horseshoe prior +prior_coeff <- hs(global_scale = tau0, slab_scale = 1) + + +logregcov.horseshoe <- stan_glm(formula = Presence~., + family = binomial(link="logit"), + data = sharkfun, + prior = hs(global_scale = 0.03049858, + slab_scale = 1)) + +logregcov.defaultpriors <- stan_glm(formula = Presence~., + family = binomial(link="logit"), + data = sharkfun) + +logregcov.n01 <- stan_glm(formula = Presence~., + family = binomial(link="logit"), + data = sharkfun, + prior = normal(0,1)) + + +``` + +--- +### projpred (cont.) + +K-fold Cross-Validation: + +```{r, eval=F} +cvs.horseshoe <- cv_varsel(logregcov.horseshoe, + method='forward', + cv_method='kfold', K=5) + +cvplot.horseshoe <- varsel_plot(cvs.horseshoe, + stats=c('elpd, acc')) + + theme_minimal() + theme(text=element_text(size=15), + legend.position = "none") + + ggtitle("Classification Accuracy (5-fold CV)") + +``` + +--- +### What you can get from projpred: + +-- Out-of-sample and In-sample accuracies + +```{r, eval=F} + +## out of sample predictive accuracies +cvplot.horseshoe + +``` + + +-- Suggested size of the models + +```{r, eval=F} +## suggested size +suggest_size(cvs) +``` + + +-- Order of the variables +```{r, eval=F} +vs <- varsel(logregcov.horseshoe, method='forward') +vs$vind +varsel_plot(vs, stats=c('elpd', 'acc'), deltas=F) + +#---------- + +cvs.horseshoe$vind +``` + +--- +### Other: Occupancy Models + + +Observation process: + +$$Y \sim Bernoulli(Zp)$$ +Latent process: + +$$Z \sim Bernoulli(\psi)$$ + + +$Z$ -- True occupancy + +$p$ -- Detection probability + +Not logistic regression as usually thought of, but similar structure and can easily put into Stan as well. Can extend to Binomial/Poisson structures. + + +--- +class: inverse, center +### Last Slide for Now + +Check out: https://stanecology.github.io + +![](https://media.giphy.com/media/IoP0PvbbSWGAM/giphy.gif) + + diff --git a/StanCourseVLB/stanhour3.html b/StanCourseVLB/stanhour3.html new file mode 100644 index 0000000..09ca044 --- /dev/null +++ b/StanCourseVLB/stanhour3.html @@ -0,0 +1,649 @@ + + + + Stan @ ISEC 2020 + + + + + + + + + + + + + + + + + + diff --git a/StanCourseVLB/stanhour3_files/figure-html/cars-1.svg b/StanCourseVLB/stanhour3_files/figure-html/cars-1.svg new file mode 100644 index 0000000..c9fa140 --- /dev/null +++ b/StanCourseVLB/stanhour3_files/figure-html/cars-1.svg @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StanCourseVLB/stanhour3_files/figure-html/unnamed-chunk-2-1.png b/StanCourseVLB/stanhour3_files/figure-html/unnamed-chunk-2-1.png new file mode 100644 index 0000000..e8b10b0 Binary files /dev/null and b/StanCourseVLB/stanhour3_files/figure-html/unnamed-chunk-2-1.png differ diff --git a/StanCourseVLB/stanhour3_files/figure-html/unnamed-chunk-3-1.png b/StanCourseVLB/stanhour3_files/figure-html/unnamed-chunk-3-1.png new file mode 100644 index 0000000..6804bcf Binary files /dev/null and b/StanCourseVLB/stanhour3_files/figure-html/unnamed-chunk-3-1.png differ diff --git a/StanCourseVLB/xaringan-themer.css b/StanCourseVLB/xaringan-themer.css new file mode 100644 index 0000000..83b8c8f --- /dev/null +++ b/StanCourseVLB/xaringan-themer.css @@ -0,0 +1,233 @@ +/* ------------------------------------------------------- + * + * !! This file was generated by xaringanthemer !! + * + * Changes made to this file directly will be overwritten + * if you used xaringanthemer in your xaringan slides Rmd + * + * Issues or likes? + * - https://github.com/gadenbuie/xaringanthemer + * - https://www.garrickadenbuie.com + * + * Need help? Try: + * - vignette(package = "xaringanthemer") + * - ?xaringanthemer::style_xaringan + * - xaringan wiki: https://github.com/yihui/xaringan/wiki + * - remarkjs wiki: https://github.com/gnab/remark/wiki + * + * Version: 0.3.0 + * + * ------------------------------------------------------- */ +@import url(https://fonts.googleapis.com/css?family=Noto+Sans:400,400i,700,700i&display=swap); +@import url(https://fonts.googleapis.com/css?family=Cabin:600,600i&display=swap); +@import url(https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700&display=swap); + + +:root { + /* Fonts */ + --text-font-family: 'Noto Sans'; + --text-font-is-google: 1; + --text-font-family-fallback: -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, Ubuntu, roboto, noto, segoe ui, arial; + --text-font-base: sans-serif; + --header-font-family: Cabin; + --header-font-is-google: 1; + --code-font-family: 'Source Code Pro'; + --code-font-is-google: 1; + --base-font-size: 20px; + --text-font-size: 1rem; + --code-font-size: 0.9rem; + --code-inline-font-size: 1em; + --header-h1-font-size: 2.75rem; + --header-h2-font-size: 2.25rem; + --header-h3-font-size: 1.75rem; + + /* Colors */ + --text-color: #657b83; + --header-color: #dc322f; + --background-color: #fdf6e3; + --link-color: #b58900; + --text-bold-color: #d33682; + --code-highlight-color: #268bd240; + --inverse-text-color: #fdf6e3; + --inverse-background-color: #002b36; + --inverse-header-color: #fdf6e3; + --title-slide-background-color: #002b36; + --title-slide-text-color: #fdf6e3; + --header-background-color: #dc322f; + --header-background-text-color: #fdf6e3; +} + +html { + font-size: var(--base-font-size); +} + +body { + font-family: var(--text-font-family), var(--text-font-family-fallback), var(--text-font-base); + font-weight: normal; + color: var(--text-color); +} +h1, h2, h3 { + font-family: var(--header-font-family); + font-weight: 600; + color: var(--header-color); +} +.remark-slide-content { + background-color: var(--background-color); + font-size: 1rem; + padding: 16px 64px 16px 64px; + width: 100%; + height: 100%; +} +.remark-slide-content h1 { + font-size: var(--header-h1-font-size); +} +.remark-slide-content h2 { + font-size: var(--header-h2-font-size); +} +.remark-slide-content h3 { + font-size: var(--header-h3-font-size); +} +.remark-code, .remark-inline-code { + font-family: var(--code-font-family), Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; +} +.remark-code { + font-size: var(--code-font-size); +} +.remark-inline-code { + font-size: var(--code-inline-font-size); + color: #6c71c4; +} +.remark-slide-number { + color: #93a1a1; + opacity: 1; + font-size: 0.9em; +} +strong { color: var(--text-bold-color); } +a, a > code { + color: var(--link-color); + text-decoration: none; +} +.footnote { + position: absolute; + bottom: 60px; + padding-right: 4em; + font-size: 0.9em; +} +.remark-code-line-highlighted { + background-color: var(--code-highlight-color); +} +.inverse { + background-color: var(--inverse-background-color); + color: var(--inverse-text-color); + +} +.inverse h1, .inverse h2, .inverse h3 { + color: var(--inverse-header-color); +} +.title-slide, .title-slide h1, .title-slide h2, .title-slide h3 { + color: var(--title-slide-text-color); +} +.title-slide { + background-color: var(--title-slide-background-color); +} +.title-slide .remark-slide-number { + display: none; +} +/* Two-column layout */ +.left-column { + width: 20%; + height: 92%; + float: left; +} +.left-column h2, .left-column h3 { + color: #93a1a1; +} +.left-column h2:last-of-type, .left-column h3:last-child { + color: #586e75; +} +.right-column { + width: 75%; + float: right; + padding-top: 1em; +} +.pull-left { + float: left; + width: 47%; +} +.pull-right { + float: right; + width: 47%; +} +.pull-right ~ * { + clear: both; +} +img, video, iframe { + max-width: 100%; +} +blockquote { + border-left: solid 5px #cb4b16; + padding-left: 1em; +} +.remark-slide table { + margin: auto; + border-top: 1px solid #839496; + border-bottom: 1px solid #839496; +} +.remark-slide table thead th { + border-bottom: 1px solid #839496; +} +th, td { + padding: 5px; +} +.remark-slide thead, .remark-slide tfoot, .remark-slide tr:nth-child(even) { + background: #eee8d5; +} +table.dataTable tbody { + background-color: var(--background-color); + color: var(--text-color); +} +table.dataTable.display tbody tr.odd { + background-color: var(--background-color); +} +table.dataTable.display tbody tr.even { + background-color: #eee8d5; +} +table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover { + background-color: rgba(255, 255, 255, 0.5); +} +.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_processing, .dataTables_wrapper .dataTables_paginate { + color: var(--text-color); +} +.dataTables_wrapper .dataTables_paginate .paginate_button { + color: var(--text-color) !important; +} + +/* Slide Header Background for h1 elements */ +.remark-slide-content.header_background > h1 { + display: block; + position: absolute; + top: 0; + left: 0; + width: 100%; + background: var(--header-background-color); + color: var(--header-background-text-color); + padding: 2rem 64px 1.5rem 64px; + margin-top: 0; + box-sizing: border-box; +} +.remark-slide-content.header_background { + padding-top: 7rem; +} + +@page { margin: 0; } +@media print { + .remark-slide-scaler { + width: 100% !important; + height: 100% !important; + transform: scale(1) !important; + top: 0 !important; + left: 0 !important; + } +} + +