I’m fairly new and I thought I understood how to specify my priors but it seems like I must be doing it wrong.
I’m trying to use input data to specify the SD of a normal. I’m aware I could just transform it as I do with eff2
below. But it seems like my inputted SD is not doing anything and it’s being sampled as eff ~ normal(0, 1);
if I had to guess:
data{
real musd; // prior sd for eff
}
parameters{
real eff;
}
transformed parameters{
real eff2 = musd*eff;
}
model {
print("musd",musd);
eff ~ normal(0,musd);
}
Running it:
effs = list()
for (sdval in c(.001,.01,.1,1,1000)){
hsam <- sampling(huh, data = list(musd =sdval),
chains = 1,
cores = 1,
iter = 1,
algorithm = 'Fixed_param',
seed = 1234)
hd <- rstan::extract(hsam)
effs[[as.character(sdval)]] = c(hd$eff, hd$eff2)
}
I get:
> effs
$`0.001`
[1] -0.7987086944 -0.0007987087
$`0.01`
[1] -0.798708694 -0.007987087
$`0.1`
[1] -0.79870869 -0.07987087
$`1`
[1] -0.7987087 -0.7987087
$`1000`
[1] -0.7987087 -798.7086944
Thank you!