In exploring non-linear regression in brms I tried to fit a particular function to the data:
x <- seq(1,64)/64
prior1 <- prior(normal(1, 3), nlpar = "alpha") + prior(normal(1, 1.5), nlpar = "beta")
form = bf(y ~ alpha * ( (( beta*x + .5) %% 1 ) - .5) , alpha + beta ~ 1, nl = TRUE)
fit1 <- brm(formula = form, data = Df, prior = prior1)
However, I get an error from the compiler about the modulo operator.
How to use the modulo operator in a brms formula?
33: for (n in 1:N) {
34: // compute non-linear predictor values
35: mu[n] = nlp_alpha[n] * (((nlp_beta[n] * C_1[n] + 0.5) % % 1) - 0.5);
^
36: }