有没有办法从 stan 的偏态正态分布中提取?如果没有,有没有办法从正态分布中提取然后转换为偏斜正态分布?
更新
我y~skew_normal(mu, sigma, alpha)
在 stan 手册中找到了,但是当我使用参数对例如 1000 个值进行采样时
mu=1,
sigma=10,
alpha=-1000
我也得到了一些-inf
价值观。任何想法为什么?
更新 2
我的testing.stan
data{
real mu;
real sigma;
real alpha;
}
model{
}
generated quantities{
real temp;
temp = skew_normal_rng( mu, sigma, alpha);
}
然后是我的testing.R
文件
sdata <- list(
mu=1,
sigma=10,
alpha=-1000
)
model <- stan_model("stan code//testing.stan")
system.time(
samples <- sampling(model,data=sdata,seed=42,
chain=1,algorithm="Fixed_param",
iter=10000,thin=1,control=list(max_treedepth=9)
)
)
object <- rstan::extract(samples)
# hist(object$temp,breaks=100)
# plot(density(object$temp))
# mean(is.finite(object$temp))
# sum(!is.finite(object$temp))
sort(object$temp)
运行后sort(object$temp)
我得到一些-inf
值。