I have made the stan code for the regularized horseshoe prior:

// Regularized horseshoe by Piironen, Juho and Vehtari, Aki

// Paper: Sparsity information and regularization in the horseshoe and other shrinkage priors

// code is from https://betanalpha.github.io/assets/case_studies/bayes_sparse_regression.html

data {

int<lower=1> n; // Number of data

int<lower=1> p; // Number of covariates

matrix[n, p] X; // n-by-p design matrix

real y[n]; // n dimensional responses

real<lower=0> nu; //hyper-parameter

real<lower=0> s_sq; //hyper-parameter

}

transformed data {

real<lower=0> c_sq_shape = 0.5 * nu;

real<lower=0> c_sq_scale = 0.5 * nu / s_sq;

}

parameters {

vector[p] beta;

vector<lower=0>[p] lambda;

real<lower=0> c_sq;

real<lower=0> tau;

real<lower=0> sigma;

}

transformed parameters {

vector<lower=0>[p] lambda_tilde ;

lambda_tilde = sqrt( c_sq * square(lambda) ./ (c_sq + square(tau) * square(lambda)) );

}

model {

lambda ~ cauchy(0, 1);

tau ~ cauchy(0, 1);

c_sq ~ inv_gamma(c_sq_shape, c_sq_scale);

beta ~ normal(0, tau * lambda_tilde);

y ~ normal(X * beta, sigma);

}

If I run this, then automatically, reg_horseshoe.rds file is generated.

I don’t know why this rds file is generated.

Interesting thing is that for other stan file, it does not generate rds file.