我現在正在學習斯坦,想要實現一個簡單的混合模型。 在參考手冊(斯坦參考-2.14.0)已經有一個解決方案: data {
int<lower=1> K; // number of mixture components
int<lower=1> N; // number of data points
real y[N]; // observations
}
para
我理解統計中變量的定義。假設我想生成的混合物的二元數據如下: 0.3正常(1,3)+ 0.7正常(2,5) 使用以下代碼: N <- 100000
#Sample N random uniforms U
U <- runif(N)
#Variable to store the samples from the mixture distribution
ra