错误消息 [英] BUGS error messages

查看:213
本文介绍了错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是WinBUGS/OpenBUGS的新手,调试代码时遇到困难.

I am new to WinBUGS/OpenBUGS and having difficulty debugging my code.

有人知道用简单的英语列出的BUGS模型的潜在错误消息及其含义吗?

Does anyone know of a list of potential error messages for BUGS models and their meanings in plain English?

推荐答案

WinBUGS 手册列出了一些常见错误.我根据自己的经验添加了一些其他说明:

The WinBUGS manual has a list of some common error. I have added some additional notes from my own experience:

  • 预期的变量名称表示不适当的变量名称.在提供数据时,有时会出现此错误,可能是使用1.02e04而不是1.02E04.

  • expected variable name indicates an inappropriate variable name. I occasionally get this error in providing the data, might have used 1.02e04 instead of 1.02E04.

未定义的变量-数据文件中的变量必须在模型中定义(只需将它们作为常量或含糊的先验放入即可).如果报告逻辑节点未定义,则问题可能出在右侧"节点上.当我从模型中删除变量但从数据中删除变量或丢失数据中的逗号时,偶尔会出现此错误.

undefined variable - variables in a data file must be defined in a model (just put them in as constants or with vague priors). If a logical node is reported undefined, the problem may be with a node on the 'right hand side'. I occasionally get this error when I have removed a variable from the model but not from the data or missed a comma in the data.

无效或意外的令牌已扫描-检查Doodle中的逻辑节点的值字段是否已完成.

invalid or unexpected token scanned - check that the value field of a logical node in a Doodle has been completed.

索引超出范围-通常表示循环索引超出了矢量的大小(或矩阵尺寸);但是,如果在注释行的开头省略了#,有时会出现

index out of range - usually indicates that a loop-index goes beyond the size of a vector (or matrix dimension); sometimes, however, appears if the # has been omitted from the beginning of a comment line

概率回归中的线性预测变量太大表示数值溢出.请参见下面的陷阱未定义的实际结果"的可能解决方案.

linear predictor in probit regression too large indicates numerical overflow. See possible solutions below for Trap 'undefined real result'.

逻辑表达式过于复杂-逻辑节点是根据太多的参数/常量或太多的运算符来定义的:尝试引入更多的逻辑节点来代表整体计算的一部分;例如,a1 + a2 + a3 + b1 + b2 + b3可以写为A + B,其中A和B分别是较简单的逻辑表达式a1 + a2 + a3和b1 + b2 + b3.请注意,应通过对参数和协变量进行向量化",然后使用inprod(.,.)函数

logical expression too complex - a logical node is defined in terms of too many parameters/constants or too many operators: try introducing further logical nodes to represent parts of the overall calculation; for example, a1 + a2 + a3 + b1 + b2 + b3 could be written as A + B where A and B are the simpler logical expressions a1 + a2 + a3 and b1 + b2 + b3, respectively. Note that linear predictors with many terms should be formulated by 'vectorizing' parameters and covariates and by then using the inprod(.,.) function

无法选择更新方法表示已违反程序限制

您可能还会在开始或MCMC期间遇到陷阱. BUGS手册列出了以下常见陷阱(我总是得到前两个陷阱,而从未遇到后两个陷阱):

You might also hit a trap at the start or during the MCMC. The BUGS manual list the following common traps (I always get the first two, never met the last two):

  • 未定义的实际结果表示数值溢出.可能的原因包括:

  • undefined real result indicates numerical overflow. Possible reasons include:

  • 从模糊"的先验分布生成的初始值在数值上可能是极端的-请指定适当的初始值;
  • 数值上不可能的值,例如非正数的对数-例如,检查在进行Poisson建模时没有给出零期望;
  • 抽样中的数字困难.可能的解决方案包括:
  • 更好的初始值;
  • 信息量更高的先验-仍然可以使用统一的先验,但其范围限于合理的值;
  • 更好的参数设置可改善正交性;
  • 将协变量标准化为均值0和标准差1.
  • 如果所有初始值都相等,则可能发生
  • .Probit模型特别容易受到此问题的影响,即生成未定义的实际结果.如果概率是随机节点,则可能有助于合理分配其分布范围,例如

  • initial values generated from a 'vague' prior distribution may be numerically extreme - specify appropriate initial values;
  • numerically impossible values such as log of a non-positive number - check, for example, that no zero expectations have been given when Poisson modelling;
  • numerical difficulties in sampling. Possible solutions include:
  • better initial values;
  • more informative priors - uniform priors might still be used but with their range restricted to plausible values;
  • better parameterisation to improve orthogonality;
  • standardisation of covariates to have mean 0 and standard deviation 1.
  • can happen if all initial values are equal.Probit models are particularly susceptible to this problem, i.e. generating undefined real results. If a probit is a stochastic node, it may help to put reasonable bounds on its distribution, e.g.

  probit(p[i]) <- delta[i]
  delta[i] ~ dnorm(mu[i], tau)I(-5, 5)

有时可以通过单击更新按钮来逃脱此陷阱.等效构造

This trap can sometimes be escaped from by simply clicking on the update button. The equivalent construction

  p[i] <- phi(delta[i])

可能会更宽容.

索引数组超出范围 可能的原因包括:

  • 试图分配超出数组声明长度的值;
  • 如果逻辑表达式太长而无法评估,则将其分解为较小的部分.

堆栈溢出.

NIL取消引用(读取)在某些情况下会在进行不适当的转换(例如将数组转换为标量)时发生.

NIL dereference (read) can occur at compilation in some circumstances when an inappropriate transformation is made, for example an array into a scalar.

陷阱消息表示用于对数凹面分布的无导数自适应拒绝算法的数值问题.一种可能是更改为切片"采样

Trap messages referring to DFreeARS indicate numerical problems with the derivative-free adaptive rejection algorithm used for log-concave distributions. One possibility is to change to "Slice" sampling

这篇关于错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆