Hello

I am fitting a GAMM in brms (ver. 2.14.4), including an autoregressive correlation structure in the model. However, post-processing the model is causing me some troubles.

The model looks like this:

```
m1 <- brm(y ~ x + s(Time, by = x, k = 40) + s(Time, by = Plot_id, m = 1, k = 10) +
(1|Block + Plot_id) + ar(time = Time, gr = Plot_id, p = 1, cov = TRUE),
data = mydata,
family = hurdle_gamma())
```

The model appears to converge.

However, using conditional_effects gives an error message:

```
plot(conditional_effects(m1))
```

Error in h(simpleError(msg, call)) :

error in evaluating the argument ‘x’ in selecting a method for function ‘plot’: Can’t find by variable

I thought is could be caused by the “Plot_id” argument being present several places in the model. Thus, I tried to construct a new variable with the same data as “Plot_id”, and used it in the ar-part.

```
mydata$new_id <- mydata$Plot_id
m2 <- brm(y ~ x + s(Time, by = x, k = 40) + s(Time, by = Plot_id, m = 1, k = 10) +
(1|Block + Plot_id) + ar(time = Time, gr = new_id, p = 1, cov = TRUE),
data = mydata,
family = hurdle_gamma())
```

And now plot(conditional_effects(m2)) is working.

However, next I tried the following:

```
pred <- with(mydata,
expand.grid(Time = seq(min(Time), max(Time), length = max(Time)),
x = levels(x),
Block=0,
Plot_id = 0,
new_id = 0))
test <- fitted(m2, newdata = pred, re_formula = NA , summary = TRUE)
```

But it gives this error message:

Error: Time points within groups must be unique.

If I am remowing the ar-correlation structure from the model, everything works, so it seems to be related to this part of the model.

Can someone guide me? What did I do wrong?