Hi, I am working on a project, and I wanted to see if I could recover the parameters of a simulated data. I would like to recover pref and chi from the simulated data below. However, I get completely unreasonable estimates, and I get many warnings about max tree depth being too low and that the adapt_delta parameter should be higher. I increased the max tree depth and the adapt_delta control parameters, but nothing seemed to work. I would really appreciate any suggestions! (Oddly, this same model does give me very accurate parameter estimates in jags).

#stan - precip model

#precip model #NO LOG TRANSFORM

zref = 150

#chi = 0.000250

chi = 0.000250

#station elevation

zsta=rlnorm(1000, meanlog = 6, sd=.5)

x = zsta - zref

#reference value for precipitation

pref = 2

err = rnorm(1000, 0, .01)

y = pref*((1+chi*(x)) / (1 - chi*(x))) + err

N = length(y)

hist(y)

precipdata = as.data.frame(cbind(y,x))

#stan model

"

data {

int <lower=1> N;

vector [N] y;

vector [N] x;

}

parameters {

real <lower=0> sigma;

real chi;

real <lower=0> pref;

}

model {

vector [N] denom;

for (i in 1:N) denom[i] = 1 / (1 - chi*x[i]);
y ~ normal(pref * (1 + chi*x) .* denom, sigma);

sigma ~ normal(0, 10);

chi ~ normal(0, .0001);

pref ~ uniform(0, 10);

}

"

fileName <- "stanprecip.txt"

stan_code2 <- readChar(fileName, file.info(fileName)$size)

cat(stan_code2)stanprecip.txt (391 Bytes)

# data for Stan

precipList <- list(N = N, y = precipdata$y, x = precipdata$x)

# sample from posterior

precipstan <- stan(model_code = stan_code2, data = precipList,

chains = 3, iter = 30000, warmup = 500, thin = 10)