I am running an ordinal regression model with brms
and cmdstanr
as a backend.
An Horseshoe prior ( set_prior(horseshoe(), class = "b")
) makes the model compile, but then the command interrupts without computation.
A naive lasso (as in Betancourt’s Sparse regression) set_prior("double_exponential(0, 1)", class="b")
works.
Can you post complete code so I can replicate? Thanks!
I am trying to create a reproducible example. Stay tuned please.
@rok_cesnovar Here I am:
require(foreign)
data = read.dta("https://stats.idre.ucla.edu/stat/data/ologit.dta")
data$apply = factor(data$apply, levels=c("unlikely", "somewhat likely", "very likely"), ordered=TRUE)
model = brm(backend = "cmdstanr", formula=apply ~ pared + public + gpa, data = data, family= cumulative(), chains = 1) #works
model_horse = brm(backend = "cmdstanr", formula=apply ~ pared + public + gpa, data = data, family= cumulative(), chains = 1, prior = set_prior("horseshoe()", class = "b"))
The code compiles… but then exits without creating the model_horse
object.
Thanks for your time
Ok, this is related to https://github.com/stan-dev/stanc3/issues/393 which is fixed for the latest version of cmdstan.
The code failed to compile with :
Semantic error in '/tmp/Rtmpp443NJ/model-fdba70fe2956.stan', line 109, column 12 to column 31:
-------------------------------------------------
107: vector[N] mu = Xc * b;
108: // priors including all constants
109: target += std_normal_lpdf(zb);
^
110: target += student_t_lpdf(hs_local | hs_df, 0, 1)
111: - rows(hs_local) * log(0.5);
-------------------------------------------------
Probabilty functions with suffixes _lpdf, _lpmf, _lcdf, and _lccdf, require a vertical bar (|) between the first two arguments.
For now, you can use the release candidate. See how to install here: Cmdstan 2.24 release candidate now available
After Monday this will be what will install with install_cmdstan by default.
With the release candidate I am able to run this.
2 Likes