- Operating System: Windows 10
- brms Version: 2.3.0

I am using brm to fit a generalized nonlinear model where one of the nonlinear parameters is a linear predictor. I’d like to have estimates of the linear predictor, but I’m having trouble figuring out which function and with what arguments can be used to extract the estimates of the linear predictor. I’ve supplied an example from the documentation where the linear predictor is eta which is a function of a continuous covariate. What function can I use to compute eta?

```
inv_logit <- function(x) 1 / (1 + exp(-x))
ability <- rnorm(300)
p <- 0.33 + 0.67 * inv_logit(ability)
answer <- ifelse(runif(300, 0, 1) < p, 1, 0)
dat_ir <- data.frame(ability, answer)
fit_ir3 <- brm(
bf(answer ~ guess + (1 - guess) * inv_logit(eta),
eta ~ 0 + ability, guess ~ 1, nl = TRUE),
data = dat_ir, family = bernoulli("identity"),
prior = c(
prior(normal(0, 5), nlpar = "eta"),
prior(beta(1, 1), nlpar = "guess", lb = 0, ub = 1)
)
)
```

likely `posterior_linpred.brmsfit`

I tried that. I don’t believe it does what I want it to with the default arguments. If you have a suggestion for what arguments I should change, that would be appreciated.

I am afraid that dpar won’t work for non-linear parameters. Let me make that possible real quick. I keep you updated.

After installing the latest github version of brms from https://github.com/paul-buerkner/brms, you may use the new `nlpar`

argument of `posterior_linpred.brmsfit`

for your purpose :-)

2 Likes

Thanks, Paul. I’m running the updated code now, but I’m experiencing substantial slow down in the MCMC. It should be done already (it finished before in 15 minutes), but is only 20% finished and I’ve been running it for a half hour. I need to upgrade my version of R before can be sure there is a problem. Any guesses as to why there might be a slowdown otherwise?

It may be bad luck in the chains. Try out `inits = 0`

in the call to brm and, for testing purpuses, run a single chain.

Or it is a problem similar to https://github.com/paul-buerkner/brms/issues/500? In this case, @bgoodri may be able to help you better than I can.

Edit: You don’t need to refit the model, you may also just use the old model.

I killed the process and restarted it. After restarting, it finished running in a time I would consider normal. So I think you’re right, I was just unlucky. I wasn’t happy with the result using my data, so I tested it on the working example in my original post and it did what I want, so I consider this issue resolved.

Also, I checked your help file for the fitted and posterior_linpred.brmsfit functions, and noticed you added nlpar to the fitted function, but not the posterior_linpred function. The code works fine for both, but the help file is incomplete.

Thanks! The doc should be fixed now!