# Example using Tweedie distribution
library(mgcViz)
set.seed(3)
n<-400
## Simulate data...
dat <- gamSim(1,n=n,dist="poisson",scale=.2)
dat$y <- rTweedie(exp(dat$f),p=1.3,phi=.5) ## Tweedie response
## Fit a fixed p Tweedie, with wrong link ...
b <- gam(list(y~s(x0)+s(x1)+s(x2)+s(x3),~1,~1), family=twlss(), data=dat)
plot(ALE(b, "x2", type = "response", oind = 1))
# With manually chosen bins
plot(ALE(b, "x2", type = "response", oind = 1,
bins = c(0.1, 0.25, 0.5, 0.6, 0.9, 0.95, 0.99, 1)))
Run the code above in your browser using DataLab