Hi David,
since the predictor expression in inlabru in principle can be any R expression, it's difficult to cover all possible models in the examples, especially those that are essentially current research problems (in terms of how well the iterative method and the resulting posterior approximation behaves, etc).
But with your additional details, here's how one can do it in your case:
alpha_fun can be used to specify a specific prior distribution, yes. Since you say alpha is known to be strictly positive, that just means you need a strictly possible transformation there.
For example, say you want an exponential distribution for alpha. Then qexp(pnorm(u),rate=...) has an exponential distribution with given rate parameter, if u is N(0,1). Replace qexp() with the quantile function for whatever prior distribution you want for alpha.
Below I'll assume X is a SpatialGridDataFrame where the first data column is the covariate.
alpha_fun <- function(u) {
qexp(pnorm(u), rate=prior_rate)
}
comp <- ~ - 1 + Xbeta(X, model = "linear") +
alpha_internal(1, model="linear", mean.linear=0, prec.linear=1) +
U(coordinates, model=spde)
form <- coordinates ~ abs(Xbeta)^alpha_fun(alpha_internal) + U
The model above defines eta = |X*beta|^alpha + U. The absolute value is just there to guard against X*beta becoming negative, which would break when alpha becomes a non-integer.
In order for the iterative method to work, you need to initialise the beta coefficient (so the derivatives aren't zero in the first iteration):
fit <- bru(components = comp, like(model="cp", data=..., samplers=...), options=list(bru_initial=list(Xbeta=1)))
Note: The alpha_fun definition can be made more numerically robust by using branching for pos/neg u, and log.p and lower.tail arguments to qexp and pnorm. I plan to add automated helpers for this to inlabru soon, since it's such a common thing to want to do.
Finn