I am trying to work out the best possible way to add random effects to my beta regression. I have a data frame consisting of longitude, latitude, seal tag, sea surface temp in kelvin and the mean behavioural position of the seal. I have rescaled mean behavioural position so that the values lie between 0.99 and 0.01. 0.99 relates to 100% transiting behaviour. My residuals are not evenly dispersed and there is non-linearity, due to the spatial autocorrelation of individual seals. So, I have added random effects using latitude, longitude and seal tag, via the "re" smoothing factor in the gam function.
mod1 <- gam(beh_scale4 ~ TempK.Daily + s(Lat, Lon, tag, bs="re"),
family = betar(link='logit'),
data=df)
My residuals look more dispersed, but I am wondering if there is a better way of doing this.
Residuals before random effects:
Residuals after random effects: