I am using the code below to fit a gamma GAMM introducing a variance structure that informs the model that variance of the response variable is much larger in one of the levels of the factor coast than in the other. I am using the gamma distribution to ensure strictly positive fitted values, but I am getting the following error message:
model <- gamm(abundance ~ s(exposure)+s(depth),
random = list(coast =~ 1),
family=Gamma(link="log"),
weights = varIdent(form =~ 1|coast),
data=census, method="REML")
Error in gamm(abundance ~ s(exposure) + s(depth), random = list(coast = ~1), :
weights must be like glm weights for generalized case
I am assuming the syntax to specify the variance structure needs to change, but I don't know how. Does anyone out there know how to improve this code to avoid the error message?
Very grateful!