# Nonparametric proportional odds model
pneumo = transform(pneumo, let=log(exposure.time))
vgam(cbind(normal,mild,severe) ~ s(let), cumulative(par=TRUE), pneumo)
# Nonparametric logistic regression
fit = vgam(agaaus ~ s(altitude, df=2), binomialff, hunua)
plot(fit, se=TRUE)
# Fit two species simultaneously
fit2 = vgam(cbind(agaaus, kniexc) ~ s(altitude, df=c(2,3)),
binomialff(mv=TRUE), hunua)
coef(fit2, mat=TRUE) # Not really interpretable
plot(fit2, se=TRUE, overlay=TRUE, lcol=1:2, scol=1:2)
ooo = with(hunua, order(altitude))
with(hunua, matplot(altitude[ooo], fitted(fit2)[ooo,], type="l", lwd=2,
xlab="Altitude (m)", ylab="Probability of presence", las=1,
main="Two plant species' response curves", ylim=c(0,.8)))
with(hunua, rug(altitude))
Run the code above in your browser using DataLab