sppnames <- c( "afarensis","africanus",
"habilis","boisei",
"rudolfensis","ergaster","sapiens")
brainvolcc <- c( 438 , 452 , 612, 521, 752, 871, 1350 )
masskg <- c( 37.0 , 35.5 , 34.5 , 41.5 , 55.5 , 61.0 , 53.5 )
d <- data.frame( species=sppnames,
brain=brainvolcc,
mass=masskg )
We have explained nothing!
We have perfectly explained this sample
Prediction: 806.8141456, Observe: 515
Deviance: 8.526583810^{4}
- Regularization means shrinking the prior towards 0
- Means data has to work harder to overcome prior
- Good way to shrink weak effects with little data, which are often spurious
- But, requires significant tuning
Slope here of 1.95
\[AIC = Deviance + 2K\]
\[DIC = 2 \bar{D} - 2 p_D\]
\[DIC = 2 \bar{D} - 2 p_D\]
Disadvantage that inaprporpiate to use with lagged (spatial or temporal) predictors
We can calculate:
\[w_{i} = \frac{e^{\Delta_{i}/2 }}{\displaystyle \sum^R_{r=1} e^{\Delta_{i}/2 }}\]
Where \(w_{i}\) is the relative support for model i making the best prediction compared to other models in the set being considered.
Model weights summed together = 1
data(milk)
d <- milk[ complete.cases(milk) , ]
d$neocortex <- d$neocortex.perc / 100
a.start <- mean(d$kcal.per.g)
sigma.start <- log(sd(d$kcal.per.g))
#null
m6.11 <- map(
alist(
kcal.per.g ~ dnorm( a , exp(log.sigma) )
) ,
data=d , start=list(a=a.start,log.sigma=sigma.start) )
#neocortex only
m6.12 <- map(
alist(
kcal.per.g ~ dnorm( mu , exp(log.sigma) ) ,
mu <- a + bn*neocortex
) ,
data=d , start=list(a=a.start,bn=0,log.sigma=sigma.start) )
# log(mass) only
m6.13 <- map(
alist(
kcal.per.g ~ dnorm( mu , exp(log.sigma) ) ,
mu <- a + bm*log(mass)
) ,
data=d , start=list(a=a.start,bm=0,log.sigma=sigma.start) )
# neocortex + log(mass)
m6.14 <- map(
alist(
kcal.per.g ~ dnorm( mu , exp(log.sigma) ) ,
mu <- a + bn*neocortex + bm*log(mass)
) ,
data=d , start=list(a=a.start,bn=0,bm=0,log.sigma=sigma.start) )
WAIC( m6.14 )
[ 100 / 1000 ]
[ 200 / 1000 ]
[ 300 / 1000 ]
[ 400 / 1000 ]
[ 500 / 1000 ]
[ 600 / 1000 ]
[ 700 / 1000 ]
[ 800 / 1000 ]
[ 900 / 1000 ]
[ 1000 / 1000 ]
[1] -15.08076
attr(,"lppd")
[1] 12.33633
attr(,"pWAIC")
[1] 4.795952
attr(,"se")
[1] 7.68153
milk.models <- compare( m6.11 , m6.12 , m6.13 , m6.14 )
milk.models
WAIC pWAIC dWAIC weight SE dSE
m6.14 -14.5 5.1 0.0 0.91 7.61 NA
m6.13 -8.3 2.8 6.2 0.04 5.53 5.34
m6.11 -8.0 1.9 6.5 0.04 4.68 7.24
m6.12 -6.0 3.0 8.5 0.01 4.28 7.51
plot(milk.models, cex=1.5)
Remember, m6.14
has a 97% WAIC model weight
ctab <- coeftab( m6.11 , m6.12 , m6.13 , m6.14)
ctab
m6.11 m6.12 m6.13 m6.14
a 0.66 0.35 0.71 -1.09
log.sigma -1.79 -1.80 -1.85 -2.16
bn NA 0.45 NA 2.79
bm NA NA -0.03 -0.10
nobs 17 17 17 17
Remember, m6.14
has a 97% WAIC model weight
plot(ctab)
milk.ensemble <- ensemble( m6.11, m6.12,
m6.13 ,m6.14 , data=d.predict )
mu_ensemble <- apply( milk.ensemble$link , 2 , mean )
mu.PI_fit <- apply( milk.ensemble$link , 2 , PI )