I'm running a gam in R and this error message keeps popping-up. I've loaded all the necessary packages, made the model less complex, changed the method - nothing seems to work. Has anyone had this problem before and found a solution?
library("gratia")
library("mgcv")
m3 <- bam(occur ~ s(temp) +
# sal +
s(DO) +
sed_depth +
# water_depth +
ave_sav +
s(prop_sg) +
# prop_ma +
Season +
TimeOfDay +
s(ToD) +
s(DoY, bs = 'cc') +
CYR.std +
# Spatial variation
s(Longitude, Latitude, bs = 'tp') +
s(fSite, bs = "re") +
data = toad,
method = 'fREML',
# knots = knots,
# nthreads = 4,
discrete = TRUE,
family = binomial(link = "logit"),
select = TRUE,
gamma = 1.5)
draw(m3,
select = c(1,2),
scale = "fixed")
Error:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘draw’ for signature ‘"bam"’
This seems to have just been a case of another package with the same function name of 'draw' stopping gratia from doing its thing. I re-loaded everything and it works now.