I want to omit the constituent parameters beta_ord
and beta_unord
from the output, but want to retain the matrix of parameters beta
that contains the former. For some reason, despite the sampling argument indicating that only those are supposed to be omitted, beta
is also omitted from the output. I wasn’t able to replicate this issue in a toy example.
$pars
[1] "beta_un" "beta_ord" "gamma" "delta" "lambda"
sampling_args <- set_sampling_args(
object = stanfit,
pars = pars,
include = FALSE,
user_dots = list(...),
user_adapt_delta = adapt_delta,
data = standata,
show_messages = FALSE)
stanfit <- do.call(rstan::sampling, sampling_args)
the relevant Stan code
parameters {
// Discrete state model
simplex[K] pi1[N]; // initial state probabilities
simplex[K] A[N_, K]; // tvtp coefficient (only initialization)
// Continuous observation model
ordered[K] phi; // observation AR
vector[Mx_d_] alpha; // continuous observation model coefficients
// ordering
vector[K] beta_un[Mx_e_un];
ordered[K] beta_ord[Mx_e_ord];
real<lower=0> sigma; // observation standard deviations
}
transformed parameters {
vector[K] logalpha[T, N];
// create beta matrix from components
matrix[Mx_e_, K] beta;
{
int count_ordered = 1;
int count_unordered = 1;
for (m in 1:Mx_e_){
if (order_x_e[m]) {
beta[m] = beta_ord[count_ordered]'; count_ordered += 1;
} else {
beta[m] = beta_un[count_unordered]'; count_unordered += 1;
}
}
}