【发布时间】:2020-06-25 14:24:47
【问题描述】:
我对 Stan 还很陌生,并且通过了manual (version 2.23)。对我来说新的是不允许隐藏变量:您不能使用已在全局(即在 for 循环之外)定义的局部变量(例如在 for 循环中)(chapter 7.9, Local Variable Declarations)。
用户定义的函数也一样吗?即,您可以在用户定义的函数中声明与其他变量同名且已在函数外部声明的变量吗?在我们的例子中,我们有
functions{
real[] my_function (x) {
real init[K*2] = some_declaration_involving_x
return(some_other_value_involving_init[])
}
}
transformed data {
real init[K*6] = some_other_declaration; // initial values
}
transformed parameters {
yet_another_variable = my_function(some_variable)
}
【问题讨论】: