if (FALSE) {
data(redstart)
m1 <- pva(redstart, gompertz("none"), 2, n.iter=1000)
m2 <- pva(redstart, gompertz("poisson"), 2, n.iter=1000)
m3 <- pva(redstart, gompertz("normal"), 2, n.iter=1000)
p <- generateLatent(m2, n.chains=1, n.iter=10000)
pva.llr(m1, m2, p)
model.select(m1, m2)
model.select(m1, m3)
model.select(m2, m3)
m1x <- pva(redstart, ricker("none"), 2, n.iter=1000)
m2x <- pva(redstart, ricker("poisson"), 2, n.iter=1000)
m3x <- pva(redstart, ricker("normal"), 2, n.iter=1000)
model.select(m1, m1x)
model.select(m2, m2x)
model.select(m3, m3x)
## missing data situation
data(paurelia)
m1z <- pva(paurelia, ricker("none"), 2, n.iter=1000)
m2z <- pva(paurelia, ricker("poisson"), 2, n.iter=1000)
m3z <- pva(paurelia, ricker("normal"), 2, n.iter=1000)
#model.select(m1z, m2z) # not yet implemented
#model.select(m1z, m3z) # not yet implemented
model.select(m2z, m3z)
## Analysis of song sparrow data in Nadeem and Lele (2012)
## use about 100 clones to get MLE's repoted in the paper.
data(songsparrow)
m1z <- pva(songsparrow,
thetalogistic_D("normal",fixed=c(sigma2.d=0.66)),
n.clones=5, n.adapt=3000, n.iter=1000)
m2z <- pva(songsparrow,
thetalogistic_D("normal",fixed=c(theta=1, sigma2.d=0.66)),
n.clones=5, n.adapt=3000,n.iter=1000)
m3z <- pva(songsparrow,
thetalogistic_D("none",fixed=c(sigma2.d=0.66)),
n.clones=5, n.adapt=3000,n.iter=1000)
m4z <- pva(songsparrow,
thetalogistic_D("none",fixed=c(theta=1,sigma2.d=0.66)),
n.clones=5, n.adapt=3000,n.iter=1000)
model.select(m2z, m1z)
model.select(m3z, m1z)
model.select(m4z, m1z)
## profile likelihood
m <- pva(redstart, gompertz("normal"), 5, n.iter=5000)
p <- generateLatent(m, n.chains=1, n.iter=10000)
m1 <- pva(redstart, gompertz("normal",
fixed=c(sigma=0.4)), 5, n.iter=5000)
## etc for many sigma values
pva.llr(m1, m, p) # calculate log LR for each
## finally, fit smoother to points and plot
}
Run the code above in your browser using DataLab