Skip to content

Commit

Permalink
begin bookdown conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
m-clark committed Jan 13, 2018
1 parent 6904b9b commit dbe86cd
Show file tree
Hide file tree
Showing 88 changed files with 8,050 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
.Rhistory
.RData
.Ruserdata
*_book
*_cache
*GAM_cache
*GAM_files
*.DS_Store
File renamed without changes.
21 changes: 21 additions & 0 deletions 00_preface.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Preface

The following provides a brief introduction to generalized additive models and some thoughts on getting started within the R environment. It doesn't assume much more than a basic exposure to regression, and maybe a general idea of R though not necessarily any particular expertise. The presentation is of a very applied nature, and such that the topics build upon the familiar and generalize to the less so, with the hope that one can bring the concepts they are comfortable with to the new material. The audience in mind is a researcher with typical applied science training.
As this document is more conceptual, a basic familiarity with R is all that is needed to follow the code, though there is much to be gained from simple web browsing on R if one needs it. And while it wasn't the intention starting out, this document could be seen as a vignette for the <span class="pack">mgcv</span> package, which is highly recommended.


This document was created with [Rstudio](http://rstudio.org/) and rmarkdown. <span class="marginnote">Last modified `r Sys.Date()`. Original draft August, 2012.</span>


Color guide:

- <span class="emph">important term</span>
- [link]()
- <span class="pack">package</span>
- <span class="func">function</span>
- <span class="objclass">object or class</span>

R Info: **`r sessionInfo()$R.version$version.string` `r sessionInfo()$R.version$nickname`**


File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions 05_conclusion.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Conclusion

Generalized additive models are a conceptually straightforward tool that allows one to incorporate nonlinear predictor effects into their otherwise linear models. In addition, they allow one to keep within the linear and generalized linear modeling frameworks with which one is already familiar, while providing new avenues of model exploration and possibly improved results. As was demonstrated, it is easy enough with just a modicum of familiarity to pull them off within the R environment, and as such, it is hoped that this document provides the means to do so.
4 changes: 4 additions & 0 deletions appendix.Rmd → 06_appendix.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,7 @@ plot_ly(x=sort(Income), y=fitted(lmMod)[order(Income)], name='unpenalized', widt
Having seen the innards of the process of building additive models, hopefully this will instill a little more insight and confidence using the technique.
# References
3 changes: 0 additions & 3 deletions GAM_cache/html/__globals

This file was deleted.

3 changes: 0 additions & 3 deletions GAM_cache/html/__objects

This file was deleted.

15 changes: 0 additions & 15 deletions GAM_cache/html/__packages

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file removed GAM_files/figure-html/contour-1.png
Binary file not shown.
Binary file removed GAM_files/figure-html/contour-2.png
Binary file not shown.
Binary file removed GAM_files/figure-html/gam_check-1.png
Binary file not shown.
Binary file not shown.
Binary file removed GAM_files/figure-html/mod_gam2_plot-1.png
Binary file not shown.
Binary file removed GAM_files/figure-html/mod_gam3_plot-1.png
Binary file not shown.
Binary file removed GAM_files/figure-html/plot_mod_gam1-1.png
Binary file not shown.
5 changes: 5 additions & 0 deletions _bookdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
book_filename: "gam"
language:
ui:
chapter_name: "Chapter "
output_dir: "docs"
3 changes: 3 additions & 0 deletions _build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')"
16 changes: 16 additions & 0 deletions _deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -e

[ -z "${GITHUB_PAT}" ] && exit 0
[ "${TRAVIS_BRANCH}" != "master" ] && exit 0

git config --global user.email "[email protected]"
git config --global user.name "Michael Clark"

git clone -b gh-pages https://${GITHUB_PAT}@github.com/${TRAVIS_REPO_SLUG}.git book-output
cd book-output
cp -r ../_book/* ./
git add --all *
git commit -m"Update the book" || true
git push origin gh-pages
21 changes: 21 additions & 0 deletions _output.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
bookdown::gitbook:
css: [css/standard_html.css, css/book.css]
font-import: https://fonts.googleapis.com/css?family=Roboto|Open+Sans
font-family: 'Roboto'
config:
toc:
before: |
<li><a href="https://m-clark.github.io/"><span style="font-size:125%; font-variant:small-caps; font-style:italic; color:#0085A1; font-family:Roboto">Generalized Additive Models</span></a></li>
after: |
<li><a href="https://m-clark.github.io/"><img src="img/mc.png" style="width:50%; padding:0px 0; display:block; margin: 0 auto;" alt="MC logo"></a></li>
<li><a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="width:50%; border-width:0; display:block; margin: 0 auto;" src="img/ccbysa.png" /></a></li>
# <li><a href="https://m-clark.github.io" target="blank" style="font-size:150%; font-variant:small-caps; color:#1f65b7; margin: 0 auto;">Michael Clark</a></li><br><br>
edit:
link: https://github.com/m-clark/generalized-additive-models/
highlight: pygments
# bookdown::pdf_book:
# includes:
# in_header: preamble.tex
# latex_engine: xelatex
# citation_package: natbib
# bookdown::epub_book: default
150 changes: 150 additions & 0 deletions css/book.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
@import url("https://fonts.googleapis.com/css?family=Roboto");

.book {
background-color: #fffff8;
}

.section {
background-color: #fffff8;
}

.book .book-body .page-wrapper .page-inner section.normal {
display: block;
background-color: #fffff8;
color: #585858;
padding: 5px 15px;
font-family: Roboto;
word-wrap: break-word;
overflow: hidden;
line-height: 1.7;
text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-moz-text-size-adjust: 100%;
}


.book .book-body .page-wrapper .page-inner section.normal a {
color: #3D68FF; /*1B4D9E #4183c4; changed for contrast and complement*/
text-decoration: none;
background: 0 0;
}

.book .book-body .page-wrapper .page-inner section.normal a:hover {
color: #3D68FF; /*1B4D9E #4183c4; changed for contrast and complement*/
text-decoration: none;
text-shadow: 0 0 1px #3D68FF;
background: 0 0;
}

.body-inner {
background-color: #fffff8;
}

.book .book-body .page-wrapper {
position: relative;
outline: 0;
background-color: #fffff8;
}

.book .book-body .page-wrapper .page-inner {
max-width: 900px;
margin: 0 auto;
padding: 20px 0 40px;
}

.book .book-header {
overflow: visible;
height: 48px; /* adjust to match title space*/
padding: 0 8px;
z-index: 2;
font-family: Roboto sans-serif;
font-size: .85em;
color: #7e888b;
background-color: #fffff8;
/* background: 0 0; */
}

.book-body.fixed {
background-color: #fffff8;
}


.book.with-summary .book-header.fixed {
background-color: #fffff8;
}

i {
background-color: #fffff8;
}

.book .book-summary {
position: absolute;
font-family: "Open Sans", Roboto, sans-serif;
top: 0;
left: -300px;
bottom: 0;
z-index: 1;
width: 300px;
color: #364149; /**/
background: #eaf5fb; /*#d9edf7#bdcadb #3572D9 #fafafa*/
border-right: 1px solid rgba(0,0,0,.07);
-webkit-transition: left 250ms ease;
-moz-transition: left 250ms ease;
-o-transition: left 250ms ease;
transition: left 250ms ease;
}

/* nav/menu area */
.book .book-summary ul.summary li a, .book .book-summary ul.summary li span {
display: block;
padding: 10px 15px;
border-bottom: none;
color: #364149; /**/
background: 0 0;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
position: relative;
}


.book .book-summary ul.summary li a:hover, .book .book-summary ul.summary li.active>a {
color: #0085A1; /* #990024 #6197D5*/
}


.book .book-body .page-wrapper .page-inner section.normal pre {
overflow: auto;
word-wrap: normal;
margin: 0 0 1.275em;
padding: .85em 1em;
background: #fafafa;
}


.book .book-body .page-wrapper .page-inner section.normal code, .book .book-body .page-wrapper .page-inner section.normal pre {
font-family: 'Roboto Mono',Consolas,"Liberation Mono",Menlo,Courier,monospace;
direction: ltr;
border: none;
color: inherit;
}

.book .book-body .page-wrapper .page-inner section.normal .note {
background-color: #fafafa;
/*background-image: url('../img/R.ico');*/
font-size: 80% ;
margin: auto;
font-weight: 500;
max-width: 75%;
border-width: 10px;
border-color: #bfbfbf;
box-shadow: 10px 10px 5px #EBEBEB; /*#888888*/
padding: 1em;
}


.img-note {
vertical-align: central;
width: 2em;
}
Loading

0 comments on commit dbe86cd

Please sign in to comment.