Are transformed parameters included in the search space for optimizations?

optimization

#1

Here is a simplified version of the regression model that I’m working on:

data {
   int N;
   vector[N] x;
   vector[N] y;
}
parameters {
   real<lower=0> shape;
   real<lower=0> a;
   real<lower=0> b;
}
transformed parameters {
   vector[N] mu = a + b * x;
   vector[N] rate = shape ./ mu;
}
model {
   y ~ gamma(shape, rate);
}

Below is the rstan code. First, generate fake data:

set.seed(1)
a <- 3
b <- 7
shape <- 20
x <- runif(1000, min = 0, max = 10)
mu <- a + b * x
rate <- shape / mu
y <- rgamma(1000, shape = shape, rate = rate)

Use Stan to get maximum-likelihood estimates of parameters:

stanmodel <- stan_model('stan_discourse_question.stan')
standata <- list(N = length(x), x = x, y = y)
mle <- optimizing(stanmodel, data = standata)

Print out the results:

str(mle)
# List of 3
# $ par        : Named num [1:2003] 18.48 2.92 6.98 21.44 28.88 ...
# ..- attr(*, "names")= chr [1:2003] "shape" "a" "b" "mu[1]" ...
# $ value      : num -3367
# $ return_code: int 0

mle$par[1:20]
# shape         a         b     mu[1]     mu[2]     mu[3]     mu[4]     mu[5]     mu[6]     mu[7]     mu[8]     mu[9]    mu[10]    mu[11]
# 18.476546  2.915327  6.976342 21.438120 28.875964 42.879538 66.275011 16.985349 65.590066 68.819107 49.014843 46.804476  7.225748 17.284818
# mu[12]    mu[13]    mu[14]    mu[15]    mu[16]    mu[17]
# 15.232530 50.844392 29.711717 56.622099 37.636530 52.978850

The estimated parameters include the estimates for the vectors mu and rate. Are the mu and rate vectors included in the search space for the optimization? I suspect that they’re not, since the transformed parameters are simple functions of the parameters and the data, but I want to double check that the search space for my model is not substantially increased by including transformed parameters.


#2

No