# Nonparametric logistic regression
fit <- vgam(agaaus ~ s(altitude, df = 2), binomialff, data = hunua)
plot(fit, se = TRUE)
# Bivariate logistic model with artificial data
nn <- 300
bdata <- data.frame(x1 = runif(nn), x2 = runif(nn))
bdata <- transform(bdata,
y1 = rbinom(nn, size = 1, prob = logit(sin(2 * x2), inverse = TRUE)),
y2 = rbinom(nn, size = 1, prob = logit(sin(2 * x2), inverse = TRUE)))
fit <- vgam(cbind(y1, y2) ~ x1 + s(x2, 3), trace = TRUE,
binom2.or(exchangeable = TRUE ~ s(x2, 3)), data = bdata)
coef(fit, matrix = TRUE) # Hard to interpret
plot(fit, se = TRUE, which.term = 2, scol = "blue")
Run the code above in your browser using DataLab