Stack Exchange
How to account for temporal autocorrelation in ordinal GAM (in R)?
In a model with a categorical (ordered) response, how can autocorrelation of the residuals be taken into account? Apparently, including rho does not work.
m1 <- bam(as.integer(tension) ~ s(breaks),
          family = ocat(R = 3),
          rho = .5,
          data = warpbreaks)
Warning message:
In bam(as.integer(tension) ~ s(breaks), family = ocat(R = 3), rho = 0.5,  :
  AR1 parameter rho unused with generalized model

acf(resid(m1))


If in doubt, read the help file ?bam:

 rho: An AR1 error model can be used for the residuals (based on
     dataframe order), of Gaussian-identity link models. This is
     the AR1 correlation parameter. Standardized residuals
     (approximately uncorrelated under correct model) returned in
     `std.rsd` if non zero. Also usable with other models when
     `discrete=TRUE`, in which case the AR model is applied to the
     working residuals and corresponds to a GEE approximation.


Your example works just fine if you follow the advice of ?bam and use discrete = TRUE:
r$> m1 <- bam(as.integer(tension) ~ s(breaks), 
              family = ocat(R = 3), 
              rho = .5, 
              data = warpbreaks,
              discrete = TRUE)                               
r$> m1                                                                          

Family: Ordered Categorical(-1,0.44) 
Link function: identity 

Formula:
as.integer(tension) ~ s(breaks)

Estimated degrees of freedom:
1  total = 2 

fREML score: 99.23439     
r$> head(m1$std.rsd)                                                            
[1] -1.5059916 -0.8229941 -0.5722550 -1.0413616 -0.3692787 -0.8185466

```


Perfect, I read the help file but missed that particular point, thanks!
