I’m exploring different link functions for cumulative ordinal models in brms. The model runs fine using the default “logit” link, but when I use a “probit”, “probit_approx”, or “cloglog” link I get the error:
Rejecting initial value:
Log probability evaluates to log(0), i.e. negative infinity.
Stan can’t start sampling from this initial value.
The underlying Stan code is identical except for the link functions and it seems like an initial value that evaluates to -Inf under a probit or cloglog link would also evaluate to -Inf using the logit link. Below is a toy example trying the same cumulative ordinal model with 4 different link functions. Any ideas on what is causing the error or how to fix it? (Setting inits=“0” sometimes resolves the issue for the probit model, but not the probit_approx or cloglog models.)
set-up data
library(dplyr)
library(brms)generate.data ← function(seed=1, n=200, p=0.5, alpha=0, beta=c(1, -0.5), sigma=1){
set.seed(seed)
z1 ← sample(c(0,1), size=n, replace=TRUE, prob=c(1-p, p))
z2 ← rnorm(n, 0, 1)
y ← rnorm(n, alpha+beta[1]*z1 + beta[2]*z2, sigma)
data ← data.frame(y=y, z1=z1, z2=z2)
return(data)
}dat10levs ← generate.data(seed=45232,n=100) %>% mutate(y=cut_number(y,10))
model using logit link
fit_logit ← brm(as.numeric(y) ~ z1+z2, data=dat10levs, family=cumulative(“logit”),
chains=1, iter=1000, seed=5, refresh=0)
Compiling the C++ model
Start samplingGradient evaluation took 8.5e-05 seconds
1000 transitions using 10 leapfrog steps per transition would take 0.85 seconds.
Adjust your expectations accordingly!Elapsed Time: 0.355146 seconds (Warm-up)
0.306718 seconds (Sampling)
0.661864 seconds (Total)
model using probit link
fit_probit ← brm(as.numeric(y) ~ z1+z2, data=dat10levs, family=cumulative(“probit”),
chains=1, iter=1000, seed=5, refresh=0)
Compiling the C++ model
Start samplingRejecting initial value:
Log probability evaluates to log(0), i.e. negative infinity.
Stan can’t start sampling from this initial value.Gradient evaluation took 0.000419 seconds
1000 transitions using 10 leapfrog steps per transition would take 4.19 seconds.
Adjust your expectations accordingly!Elapsed Time: 1.7464 seconds (Warm-up)
1.67224 seconds (Sampling)
3.41865 seconds (Total)
model using approximate probit link
fit_probit_app ← brm(as.numeric(y) ~ z1+z2, data=dat10levs, family=cumulative(“probit_approx”),
chains=1, iter=1000, seed=5, refresh=0)
Compiling the C++ model
Start samplingRejecting initial value:
Log probability evaluates to log(0), i.e. negative infinity.
Stan can’t start sampling from this initial value.… (error repeats ~20 times)
Gradient evaluation took 0.000234 seconds
1000 transitions using 10 leapfrog steps per transition would take 2.34 seconds.
Adjust your expectations accordingly!Elapsed Time: 0.928907 seconds (Warm-up)
0.872934 seconds (Sampling)
1.80184 seconds (Total)
model using complementary log-log link
fit_cloglog ← brm(as.numeric(y) ~ z1+z2, data=dat10levs, family=cumulative(“cloglog”),
chains=1, iter=1000, seed=5, refresh=0)
Compiling the C++ model
Start samplingRejecting initial value:
Log probability evaluates to log(0), i.e. negative infinity.
Stan can’t start sampling from this initial value.… (error repeats until 100 attempts)
Initialization between (-2, 2) failed after 100 attempts.
Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.
[1] “Error in sampler$call_sampler(args_list[[i]]) : Initialization failed.”
error occurred during calling the sampler; sampling not done
- Operating System: Linux (Ubuntu 16.04)
- brms Version: 2.3.0