Hi guys,
I am new to stan, there are a lot of problems when I ran the code below, I have no idea what is wrong.
Could you please help with this? Thanks a lot
modelString1 = "
parameters {
real<lower=0> theta;
real<lower=0> sigma;
}
model {
theta ~ normal (0.5,0.1) ;
sigma ~ normal (1, 0.3) ;
}
generated quantities {
real<lower=1,upper=100> n ;
real<lower=0,upper=1> poweraj ;
real<lower=0,upper=1> pcrit;
n= 2 * pow((.84 +1.96) * sigma / theta, 2);
poweraj= Phi( sqrt(31.5)* theta/sigma -1.96 );
pcrit= 1- poweraj>=0.7;
}
"
#initsList = list( theta = 0.5, sigma = 1*0.9+0.1)
writeLines( modelString1 , con="TEMPmodel.stan" )
stanModel <- stan(
file = "TEMPmodel.stan",
chains = 4,
warmup = 5000,
iter = 25000,
control = list(adapt_delta = 0.99)
)
[[1]]
Stan model 'TEMPmodel' does not contain samples.
[[2]]
Stan model 'TEMPmodel' does not contain samples.
[[3]]
Stan model 'TEMPmodel' does not contain samples.
Warning messages:
In .local(object, ...) :
some chains had errors; consider specifying chains = 1 to debug