I want to create a model with a periodic component, and the phase parameter is tricky. If I declare it as a standard parameter for a non-linear model, for example with using only `prior(uniform(-3.14159265359,3.14159265359),lb=-3.14159265359,ub=3.14159265359,nlpar="c")`

I get convergence problems due to the circularity.

To solve this, I want to use the `unit_vector`

type from stan and add it using `stanvar()`

, but can’t get it to work. Here is what I tried :

```
prior1 <- prior(normal(0,5),nlpar="a")+
prior(normal(0,5),nlpar="b")+
prior(uniform(-3.14159265359,3.14159265359),lb=-3.14159265359,ub=3.14159265359,nlpar="c")+
prior(normal(0,20),nlpar="d")
stanvars <- stanvar(scode = "unit_vector[2] v;",block = "parameters") +
stanvar(scode = "real<lower = -pi(), upper = pi()> c = atan2(v[2], v[1]);",
block = "tparameters",name="c")
fitRTh <-brm(bf( rt~ b * sin(h + c )+ d,
b~1+(1|id),c~1,d~1+(1|id),
nl=TRUE,family=shifted_lognormal()),
data = t, prior=prior1, iter=2000, cores=4, stanvars=stanvars)
```

If I do this my stanvar parameter `c`

is not used by the model, which I can verify using `make_stancode`

. If I omit `c~1`

from the `bf()`

argument list I get an error and so do I if I remove `c`

from the priors. Is there any solution to this befor fully writing the model in stan ?