Академический Документы
Профессиональный Документы
Культура Документы
com/blog/2015/07/30/gam/
1 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
2 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
3 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
4 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
set.seed(3)
x <- seq(0,2*pi,0.1)
z <- sin(x)
y <- z + rnorm(mean=0, sd=0.5*sd(z), n=length(x))
d <- cbind.data.frame(x,y,z)
5 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
6 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
7 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
8 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
9 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
library(mgcv)
library(ggplot2)
# fake data
n <- 50
sig <- 2
dat <- gamSim(1,n=n,scale=sig)
10 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
# predict
newdf <- gamSim(1,n=n,scale=sig)
f <- predict(b1, newdata=newdf)
# loess smoothers with the gam package (restart R before loading gam)
library(gam)
b4 <- gam::gam(y ~ lo(x1, span=0.6) + lo(x2, span=0.6) + x3, data = dat)
summary(b4)
11 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
12 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
13 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
14 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
15 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
16 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
17 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
18 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
19 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
20 of 21 13/09/2018, 18:50
GAM: The Predictive Modeling Silver Bullet | Stitch Fix Technology ... https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
21 of 21 13/09/2018, 18:50