autorun.jags(runjags)
autorun.jags()所属R语言包:runjags
Run a User Specified Bayesian MCMC Model in JAGS with Automatically Calculated Run Length and Convergence Diagnostics
运行用户指定的贝叶斯MCMC模型自动计算运行长度和收敛诊断在JAGS与
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Runs a user specified JAGS (similar to WinBUGS) model from within R, returning a list of the MCMC chain(s) along with convergence diagnostics, autocorrelation diagnostics and monitored variable summaries. Chain convergence over the first run of the simulation is assessed using the Gelman and Rubin's convergence diagnostic. If necessary, the simulation is extended to improve chain convergence (up to a user-specified maximum time limit), before the required sample size of the Markov chain is calculated using the Raftery and Lewis's diagnostic. The simulation is extended to the required sample size dependant on autocorrelation and the number of chains.
运行一个用户指定的模型从在R JAGS(类似于WinBUGS类),返回一个列表的MCMC链(),沿与的收敛诊断,自相关的诊断和监视的变量摘要。链融合在第一次运行的模拟评估使用Gelman和鲁宾的收敛诊断。如果有必要,模拟延伸提高链的融合(到用户指定的最大时间限制),然后计算所需的样本量的马尔可夫链拉夫特里和刘易斯的诊断。模拟延伸至所需的样本大小依赖于自相关和链的数目。
This function is provided as an educational tool only, and is not a replacement for manually assessing convergence and Monte Carlo error for real-world applications. For more complex models, the use of run.jags directly with manual assessment of necessary run length is recommended. JAGS is called using the lower level function run.jags.
此功能只能作为一种教育工具,而不是手动评估收敛蒙特卡洛误差为真实世界的应用程序的替代品。对于更复杂的模型,使用run.jags直接与必要的游程长度的手动评估建议。 JAGS被称为使用较低级别的功能run.jags。
用法----------Usage----------
autorun.jags(model=stop("No model supplied"),
monitor = stop("No monitored variables supplied"),
data=NA, n.chains=2, inits = replicate(n.chains, NA),
startburnin = 5000, startsample = 10000,
psrf.target = 1.05, normalise.mcmc = TRUE,
check.stochastic = TRUE, raftery.options = list(),
crash.retry = 1, plots = TRUE, thin.sample = TRUE,
jags = findjags(), silent.jags = FALSE,
interactive=TRUE, max.time=Inf,
adaptive=list(type="burnin", length=200), modules=c(""),
factories=c(""), thin = 1, monitor.deviance = FALSE,
monitor.pd = FALSE, monitor.pd.i = FALSE,
monitor.popt = FALSE, keep.jags.files = FALSE, tempdir=TRUE,
method=if(.Platform$OS.type=='unix' & .Platform$GUI!="AQUA" &
Sys.info()['user']!='nobody') 'interruptible' else 'simple',
batch.jags=silent.jags)
参数----------Arguments----------
参数:model
a character string of the model in the JAGS language. No default.
模型在JAGS语言的字符串。无默认值。
参数:monitor
a character vector of the names of variables to monitor. For all models, specifying 'deviance' as a monitored variable will calculate the model deviance, and 'dic' will calculate the Deviance Information Criterion (implies monitor.deviance etc, and requires more than 1 chain. No default.
字符向量的变量名进行监控。对于所有型号,指定为被监视的变量的“越轨行为”,将计算模型偏差,“DIC”,将计算出的越轨行为标准(意味着monitor.deviance等,并要求超过1链。无默认值。
参数:data
either a named list or a character string in the R dump format containing the data. If left as NA, the model will be run without external data.
命名列表或一个字符串中的R转储文件格式,其中包含的数据。如果离开NA,该模型将运行,无需外部数据。
参数:n.chains
the number of chains to use with the simulation. More chains will improve the sensitivity of the convergence diagnostic, but will cause the simulation to run more slowly. The minimum (and default) number of chains is 2.
链的数目,使用与模拟。更多的链将改善的收敛诊断的灵敏度,但将导致仿真运行更慢。最小(默认)链数为2。
参数:inits
either a character vector with length equal to the number of chains the model will be run using, or a list of named lists representing names and corresponding values of inits for each chain. If a vector, each element of the vector must be a character string in the R dump format representing the initial values for that chain, or NA. If not all initialising variables are specified, the unspecified variables are sampled from the prior distribution by JAGS. Values left as NA result in all initial values for that chain being sampled from the prior distribution. The special variables '.RNG.seed', '.RNG.name', and '.RNG.state' are allowed for explicit control over random number generators in JAGS. Default NA.
长度等于链的数目可以是字符向量模型将使用运行,或命名列表代表每个链的初始化设置的名称和相应的值的列表。如果一个矢量,该矢量的每个元素必须是一个字符串在的R转储格式表示的初始值,该供应链,或NA。如果不是所有的初始化变量指定,未指定的变量进行采样,从先验分布JAGS。值,NA的结果,在所有的初始值链采样的先验分布。特殊的变量。RNG.seed,。RNG.name“,和”。RNG.state允许随机数生成器在JAGS明确的控制。默认情况下不适用。
参数:startburnin
the number of initial updates to discard before sampling. Only used on the initial run before checking convergence. Default 5000 iterations.
初始更新丢弃在取样前的数目。只用在初始运行前检查收敛。缺省值5000迭代。
参数:startsample
the number of samples on which to assess convergence. More samples will give a better chance of allowing the chain to converge, but will take longer to achieve. Also controls the length of the pilot chain used to assess the required sampling length. The minimum is 4000 samples, which is the minimum required number of samples for a model with no autocorrelation and good convergence. Default 10000 iterations.
的数目的样本,其上,以评估收敛。更多的样本将提供一个更好的机会,让链收敛,但需要更长的时间来实现。还控制用于评估所需的取样长度的导频链的长度。最小的是4000个样本,这是没有自相关的模型和良好的收敛所需的最低样本数。缺省值10000迭代。
参数:psrf.target
the value of the point estimate for the potential scale reduction factor of the Gelman Rubin statistic below which the chains are deemed to have converged (must be greater than 1). Default 1.05.
格尔曼·鲁宾统计的潜在规模折减系数的点估计值,低于该链被视为融合(必须大于1)。默认值是1.05。
参数:normalise.mcmc
the Gelman Rubin statistic is based on the assumption that the posterior distribution of monitored variables is roughly normal. For very skewed posterior distributions, it may help to log/logit transform the posterior before calculating the Gelman Rubin statistic. If normalise.mcmc == TRUE, the normality of the untransformed and log/logit transformed posteriors are compared for each monitored variable and the least skewed is used to calculate the Gelman Rubin statistic (this may take some time for large numbers of monitored variables). If FALSE, the data are left untransformed (this may give problems calculating the statistic in extreme cases). Default TRUE.
格尔曼鲁宾统计是根据的假设上,被监视的变量的后验分布大约是正常。对于非常倾斜的后验分布,它可能会帮助,登录/罗吉特改造后,然后再计算格尔曼·鲁宾统计。如果normalise.mcmc == TRUE,未转换和log/罗吉特转化的后验概率的常态,每个被监视的变量相比,至少歪斜是用来计算格尔曼·鲁宾统计(这可能需要一些时间,大量的监视变量) 。如果为FALSE,数据被留下未转化的(这可能会在极端的情况下,计算的统计量的问题)。默认为true。
参数:check.stochastic
non-stochastic monitored variables will cause errors when calculating the Gelman-Rubin statistic, if check.stochastic==TRUE then all monitored variables will be checked to ensure they are stochastic beforehand. This has a computational cost, and can be bypassed if check.stochastic==FALSE. Default TRUE.
非随机监视的变量时,将导致错误计算的格尔曼鲁宾统计,如果check.stochastic == TRUE,那么所有被监视的变量进行检查,以确保它们是随机的事先。这有一个计算成本,并且可以被旁路如果check.stochastic == FALSE。默认为true。
参数:raftery.options
a named list which is passed as additional arguments to raftery.diag. Default none (default arguments to raftery.diag are used).
一个命名列表传递其他参数raftery.diag的。默认没有(默认参数到raftery.diag),。
参数:crash.retry
the number of times to re-attempt a simulation if the model returns an error. Default 1 retry (simulation will be aborted after the second crash).
的次数重新尝试仿真模型如果返回一个错误。默认重试(模拟将被中止后,第二次碰撞)。
参数:plots
should traceplots and density plots be produced for each monitored variable? If TRUE, the returned list will include elements 'trace' and 'density' which consist of a list of lattice objects. The alternative is to use plot(results\$mcmc) to look at the density and traceplots for each variable using the traditional graphics system. Default TRUE.
traceplots和密度图应该为每个受监控的变量?如果是TRUE,返回的列表将包含元素的“跟踪”和“密度”,其中包括格对象的列表。另一种方法是使用plot(结果\ $ MCMC)看在的密度和traceplots,为每个变量使用传统的图形系统。默认为true。
参数:thin.sample
option to thin the final MCMC chain(s) before calculating summary statistics and returning the chains. Thinning very long chains allows summary statistics to be calculated more quickly. If TRUE, the chain is thinned to as close to a minimum of startsample iterations as possible (i.e. using a thinning interval of floor(chain.length/thin.sample) since the value must be an integer) and any excess iterations discarded to ensure the chain length matches thin.sample. If FALSE the chains are not thinned. A positive integer can also be specified as the desired chain length after thinning; the chains will be thinned to as close to this minimum value as possible. Default TRUE (thinned chains of length startsample returned). This option does NOT carry out thinning in JAGS, therefore R must have enough available memory to hold the chains BEFORE thinning. To avoid this problem use the 'thin' option instead.
选项薄最后MCMC链(S),然后再计算汇总统计和返回的枷锁。疏除很长的链,可以更快速地汇总统计数据来计算。如果是TRUE,链减薄到尽可能接近一个最少的startsample迭代(即使用间伐间隔的的地板(chain.length / thin.sample),因为该值必须为整数),并丢弃任何多余的迭代,以确保的链长度相匹配thin.sample的的。如果为FALSE链不薄。一个正整数,也可以被指定为所需链长的减薄后的链将被减薄到尽可能靠近该最小值。默认为true(薄链的长度startsample的返回)。此选项不携带了减薄中的JAGS,因此R疏伐前,必须有足够的可用内存来存放的枷锁。为了避免此问题,请使用“薄”选项。
参数:jags
the system call or path for activating JAGS. Default calls findjags() to attempt to locate JAGS on your system.
用于激活JAGS的系统调用或路径。默认调用findjags()到试图找到JAGS,在您的系统上。
参数:silent.jags
should the JAGS output be suppressed? (logical) If TRUE, no indication of the progress of individual models is supplied. Default FALSE.
的JAGS输出被抑制? (逻辑)如果为true,没有迹象显示个别型号的进展提供。默认为false。
参数:interactive
option to allow the simulation to be interactive, in which case the user is asked if the simulation should be extended when run length and convergence calculations are performed and the extended simulation will take more than 1 minute. The function will wait for a response before extending the simulations. If FALSE, the simulation will be run until the chains have converged or until the next extension would extend the simulation beyond 'max.time'. Default FALSE.
选项以允许模拟互动,在这种情况下,用户会被要求如果模拟运行长度和收敛计算时,应延长和扩展的模拟将超过1分钟。该函数将等待响应,然后再扩展模拟。如果为FALSE,将模拟运行,直到链融合或下延,直到将扩大模拟超越“max.time”。默认为false。
参数:max.time
the maximum time for which the function is allowed to extend the chains to improve convergence, as a character string including units or as an integer in which case units are taken as seconds. Ignored if interactive==TRUE. If the function thinks that the next simulation extension to improve convergence will result in a total time of greater than max.time, the extension is aborted. The time per iteration is estimated from the first simulation. Acceptable units include 'seconds', 'minutes', 'hours', 'days', 'weeks', or the first letter(s) of each. Default "1hr".
该函数被允许的最大时间延长链提高收敛性,作为一个字符串包括单位或为一个整数,在这种情况下,单位是秒为单位采取。如果忽略互动== TRUE。如果函数认为下一个模拟扩展改善收敛将导致在总的时间是大于max.time,分机被中止。每次迭代的时间,预计从第一次模拟。可接受的单位包括秒,分钟,小时,天,周,或每个的第一个字母(S)。默认的“1小时”。
参数:adaptive
a list of advanced options controlling the length of the adaptive mode of each simulation. Extended simulations do not require an adaptive phase, but JAGS prints a warning if one is not performed. Reduce the length of the adpative phase for very time consuming models. 'type' must be one of 'adaptive' or 'burnin'.
控制每次模拟的自适应模式的长度的高级选项的列表。扩展的模拟并不需要一个适应期,但JAGS打印一个警告,如果不执行的。长度减少的adpative阶段非常耗费时间的模型。 “类型”必须是“自适应”或“燃尽的。
参数:modules
external modules to be loaded into JAGS. More than 1 module can be used. Default none.
被加载到JAGS外部模块。模块可用于超过1。默认没有。
参数:factories
factory modules to be loaded into JAGS. More than 1 factory can be used. Entried should be in the format '"<facname>" <status>, type(<factype>)', for example: factories='"mix::TemperedMix" off, type(sampler)'. Default none.
工厂模块要被装入到JAGS。工厂可用于超过1。 Entried应该是在格式“<facname>”<状态>,的类型(<factype>)“,例如:工厂=的”混合:: TemperedMix“关,类型(取样)”。默认没有。
参数:thin
the thinning interval to be used in JAGS. Increasing the thinning interval may reduce autocorrelation, and therefore reduce the number of samples required, but will increase the time required to run the simulation. Using this option thinning is performed directly in JAGS, rather than on an existing MCMC object as with thin.sample. Default 1.
中要使用JAGS变薄间隔。增加变薄间隔可能减少自相关,并因此减少了所需的样本数,但会增加所需要的时间来运行仿真。进行使用此选项变薄是直接在JAGS而非现有MCMC对象作为与thin.sample。默认值1。
参数:monitor.deviance
option to monitor the total deviance of the model using the DIC module in JAGS. If TRUE, an additional monitor called 'deviance' is added to the MCMC objects returned, representing the deviance of the model for each iteration and each chain. This option requires JAGS version 2 or greater. For more information see the JAGS user manual. Default FALSE.
总偏差的模型中使用的DIC模块JAGS选项来监控。如果是TRUE,称为越轨被添加到一个附加的监视器的MCMC返回的对象,表示为每次迭代的模型和每个链越轨。此选项需要JAGS版本2或更高。欲了解更多信息,请参阅用户手册的JAGS。默认为false。
参数:monitor.pd
option to monitor the total effective number of parameters in the model using the DIC module for JAGS. If TRUE, a 'pd' element is returned representing the total effective number of parameters at each iteration. This option requires JAGS version 2 or greater and at least 2 chains. For more information see the JAGS user manual. Default FALSE.
选项来监控模型中使用的DIC模块JAGS总有效数中的参数。如果是TRUE,PD元素返回的参数在每次迭代总有效数。此选项需要JAGS版本为2或更大和至少2个链。欲了解更多信息,请参阅用户手册的JAGS。默认为false。
参数:monitor.pd.i
option to monitor the contribution of each parameter towards the total effective number of parameters using the DIC module for JAGS. If TRUE, a 'pd.i' element is returned representing the mean value for each parameter. This option requires JAGS version 2 or greater and at least 2 chains. For more information see the JAGS user manual. Default FALSE.
选项来监控各参数对总有效数的参数使用DIC模块JAGS的贡献。如果是TRUE,pd.i元素被表示为每个参数的平均值返回。此选项需要JAGS版本为2或更大和至少2个链。欲了解更多信息,请参阅用户手册的JAGS。默认为false。
参数:monitor.popt
option to monitor the optimism of the expected deviance using the DIC module for JAGS. If TRUE, a 'popt' element is returned representing the mean value for each parameter. This option requires JAGS version 2 or greater and at least 2 chains. For more information see the JAGS user manual. Default FALSE.
选项监控乐观的预期偏差DIC模块JAGS。如果设置为TRUE,返回一个POPT元素表示为每个参数的平均值。此选项需要JAGS版本为2或更大和至少2个链。欲了解更多信息,请参阅用户手册的JAGS。默认为false。
参数:keep.jags.files
option to keep the folder with files needed to call JAGS, rather than deleting it. May be useful for attempting to bug fix models. Since autorun.jags typically makes several calls to JAGS, all folders are kept - the order in which the folders were used can be ascertained from the creation dates of the files. Default FALSE.
选择保持文件的文件夹,需要调用,而不是删除它JAGS。可能是有益的尝试错误修正模型。由于autorun.jags通常使多次打检测给JAGS,所有的文件夹都保持 - 在该文件夹的顺序,可确定该文件的创建日期。默认为false。
参数:tempdir
option to use the temporary directory as specified by the system rather than creating files in the working directory. If keep.jags.files==TRUE then the folder is copied to the working directory after the job has finished (with a unique folder name based on 'runjagsfiles'). Any files created in the temporary directory are removed when the function exits for any reason. Default TRUE.
选项使用指定的临时目录,而不是建立在工作目录中的文件系统。如果keep.jags.files == TRUE,然后将文件夹复制到工作目录后的工作已经完成了一个独特的文件夹名称根据“runjagsfiles”。在临时目录中创建的任何文件被删除,退出函数时的任何理由。默认为true。
参数:method
the method with which to call JAGS; one of 'simple', 'interruptible' or 'parallel'. The former runs JAGS as a foreground process (the default behaviour for runjags < 0.9.6), 'interruptible' allows the JAGS process to be terminated immediately using the interrupt signal 'control-c' (terminal/console versions of R only), and 'parallel' runs each chain as a separate process on a separate core. Note that the latter uses separate JAGS instances to speed up execution of models with multiple chains (at the expense of using more RAM), but cannot be used with monitor.pd, monitor.pd.i or monitor.popt. Each chain is specified using a different random number generator (.RNG.name) for up to 4 chains (the number of different RNG available in JAGS), unless .RNG.name is specified in the initial values. Because each chain uses a separate JAGS instance, JAGS has no way of ensuring independence between multiple chains using the same random number generator (as would normally be done when calling a single JAGS instance with multiple chains). Using more than 4 chains with the 'parallel' method without the use of new RNG factories may therefore produce dependence between chains, and is not recommended (a warning is given if trying to do so). Only the 'simple' method is available for Windows. On machines running Mac OS X and with access to an Apple Xgrid cluster, the method may be a list with an element 'xgrid.method="simple"' (see xgrid.run.jags for more information). Default 'interruptible' on terminal/console versions of R, or 'simple' on GUI versions of R or when running over xgrid (methods other than 'simple' require the use of 'ps' which is not available when running jobs as 'nobody' via xgrid).
打检测JAGS的方法,一个简单,中断或水货。前者运行JAGS作为一个前台进程(runjags <0.9.6的默认行为),“中断”允许的JAGS过程将立即终止使用的中断信号的控制C(仅R的终端/主机版本) ,水货运行的每一条链作为一个单独的进程在一个单独的核心。请注意,后者使用单独JAGS的实例来加快执行速度的模型与多个链(在使用更多的RAM的费用),但不能用于与monitor.pd,monitor.pd.i或monitor.popt。每个链指定使用一个不同的随机数发生器(。RNG.name)最多至4个链(的RNG在JAGS提供不同数量的),,除非。RNG.name指定在初始值。因为每个链使用一个单独的JAGS实例,JAGS有没有办法确保多个链,使用相同的随机数发生器(如时,通常会通过调用一个单一JAGS实例与多个链)之间的独立性。使用超过4链水货的方法,而无需使用新的RNG工厂可能会因此产生依赖关系链,不推荐(警告如果试图这样做)。只有“简单”的方法,是适用于Windows。机器上运行Mac OS X和一个苹果利用Xgrid聚类,该方法可能是一个列表元素xgrid.method =“简单”(见xgrid.run.jags的详细信息)。终端/主机版本的R默认的中断“,或”简单“的GUI版本的R或运行时超过XGRID(需要使用其他方法比”简单“的”PS“,这是不是正在运行的作业时,”人“通过XGRID)。
参数:batch.jags
option to call JAGS in batch mode, rather than using input redirection. On JAGS >= 3.0.0, this suppresses output of the status which may be useful in some situations. Default TRUE if silent.jags is TRUE, or FALSE otherwise.
选项打检测JAGS在批处理模式下,而不是使用输入重定向。论JAGS> = 3.0.0,这抑制输出的状态,在某些情况下,这可能是有用的。默认为true,如果silent.jags是TRUE,否则返回FALSE。
Details
详细信息----------Details----------
This function runs the specified model until the point estimate of the potential scale reduction factor of the Gelman-Rubin statistic for each monitored parameter is less than psrf.target (default 1.05). This is intended to make sure that the chains have converged before sampling from them (although this does not guarantee convergence so manual checking of traceplots is recommended). If convergence is not achieved within the time limit, then the function returns pilot.mcmc rather than mcmc, which will always be of length startsample since it is the unconverged mcmc object returned from the last run of the model. This chain is not suitable for making inference from, so a different name is used to avoid confusion. If convergence is achieved, the Raftery and Lewis's diagnostic is used to calculate the required number of samples based on the most heavily autocorrelated monitored variable. The chains are then extended to increase the sample size of each variable as necessary (so that sufficient samples are obtained from the COMBINED chains to satisfy the Raftery and Lewis's diagnostic) before being summarised and returned. Heavily autocorrelated models with large numbers of monitored variables may result in a required sample size larger than the available memory in R. If this is the case, try using the thin option to reduce autocorrelation (and therefore the required sample size) or monitor less variables.
这个函数运行指定的模型,直到格尔曼鲁宾统计的潜在规模折减系数为每个受监控的参数的点估计是少比psrf.target(默认值1.05)。这是为了确保的链都融合在取样之前,(虽然这并不能保证收敛,所以手动检查traceplots的建议)。如果不收敛的时限内实现,那么,函数返回pilot.mcmc的的,而不是MCMC,这将永远是的长度startsample以来的unconverged MCMC返回的对象从上次运行的模式。推断这条链是不适合的,所以使用了不同的名称,以避免混淆。如果实现了收敛,拉夫特里和刘易斯的诊断是用来计算所需的样本数的基础上最严重的自相关监视的变量。链再延伸到每个变量的样本规模,增加必要的(以便有足够的样本是从组合链,以满足的拉夫特里和刘易斯的诊断),然后总结,并返回。重自相关监视的变量有大量的模型可能会导致在所需的样本大小大于可用内存R.如果是这样的话,尽量使用薄的选项,以减少自相关(因此所需的样本量),或监视少的变量。
值----------Value----------
A list including the following elements:
一个列表,其中包括下列内容:
<table summary="R valueblock"> <tr valign="top"><td>mcmc</td> <td> an MCMC list of MCMC objects representing the chains. Each MCMC object represents the value of each monitored variable (including the deviance, if specified) for that chain at each iteration. Renamed pilot.mcmc if the simulation is aborted before convergence or before the required sampling length is achieved</td></tr>
<table summary="R valueblock"> <tr valign="top"> <TD>mcmc</ TD> <TD> MCMC列表中的的MCMC对象代表的链。每个的MCMC对象代表每个被监视的变量(包括越轨行为,如果指定的话),在每次迭代链的价值。如果模拟被中止前收敛或之前所要求的采样长度达到更名为pilot.mcmc </ TD> </ TR>
<tr valign="top"><td>end.state</td> <td> the end state of the last simulation extension performed. Can be used as initial values to extend the simulation further if required</td></tr>
<tr valign="top"> <TD>end.state</ TD> <TD>的最终状态进行最后的模拟扩展。作为初始值,可用于进一步扩大模拟如果需要的话</ TD> </ TR>
<tr valign="top"><td>req.samples</td> <td> the minimum sample size required for the Markov chain as calculated using the Raftery and Lewis's diagnostic. This sample size is dependent on the thinning interval in JAGS</td></tr>
<tr valign="top"> <TD> req.samples </ TD> <TD>拉夫特里和刘易斯的诊断计算马尔可夫链所需的最小样本量。此样本的大小是依赖于间伐间隔JAGS </ TD> </ TR>
<tr valign="top"><td>samples.to.conv</td> <td> the number of sampled iterations discarded due to poor convergence. The total number of iterations performed for the simulation is equal to req.samples + req.burnin + samples.to.conv (unless the simulation was aborted before reaching the required sampling length)</td></tr>
<tr valign="top"> <TD> samples.to.conv </ TD> <TD>丢弃的采样迭代由于衔接不畅。用于模拟执行的迭代的总数等于req.samples + req.burnin + samples.to.conv(除非被中止仿真之前达到所需的采样长度)</ TD> </ TR>
<tr valign="top"><td>thin</td> <td> the thinning interval in JAGS used for the chains.</td></tr>
<tr valign="top"> <TD> thin</ TD> <TD>的间伐间隔在JAGS使用的枷锁。</ TD> </ TR>
<tr valign="top"><td>summary</td> <td> the summary statistics for the monitored variables from the combined chains. Renamed pilot.summary if pilot.only==TRUE or if the simulation is aborted before the required sampling length is achieved</td></tr>
<tr valign="top"> <TD>summary</ TD> <TD>合并链被监视的变量的摘要统计信息。更名为pilot.summary pilot.only == TRUE或模拟所需的采样长度达到之前中止</ TD> </ TR>
<tr valign="top"><td>HPD</td> <td> the 95% highest posterior density and median value of each monitored variable from the combined chains.</td></tr>
<tr valign="top"> <TD> HPD </ TD> <TD> 95%的最高后验概率密度和每个被监视的变量中值的组合链。</ TD> </ TR>
<tr valign="top"><td>psrf</td> <td> the Gelman Rubin statistic for the monitored variables (similar to output of gelman.diag())</td></tr>
<tr valign="top"> <TD> psrf </ TD> <TD>格尔曼·鲁宾统计被监视的变量(类似的输出gelman.diag())</ TD> </ TR>
<tr valign="top"><td>autocorr</td> <td> the autocorrelation diagnostic for the monitored variables (output of autocorr.diag())</td></tr>
<tr valign="top"> <TD> autocorr </ TD> <TD>的自相关诊断为被监视的变量(输出的autocorr.diag())</ TD> </ TR>
<tr valign="top"><td>trace</td> <td> a list of lattice objects representing traceplots for each monitored variable, of class 'plotindpages'. Calling each individual element will result in the traceplot for that variable being shown, calling the entire list will result in all traceplots being shown in new windows (which may cause problems with your R session if there are several monitored variables). To override the individual window plotting behaviour (to combine plots and/or save the plots to a file), either change the class of each object using for(i in 1:nvar(results$mcmc)) class(results$trace[[i]]) <- 'trellis' and then combine using the c.trellis method in the latticeExtra package, or simply re-generate the plots using the raw mcmc output. Not produced if plots==FALSE.</td></tr>
<tr valign="top"> <TD>trace</ TD> <td>一个列表格对象,为每个受监控的变量,traceplots类的plotindpages“。调用每个元素正在显示该变量的traceplot,将导致调用的完整列表,将导致在新的Windows(R会话可能会产生问题,如果有几个监视的变量)显示所有traceplots。要覆盖各个窗口绘制的行为(结合图和/或保存到一个文件中的图),可以更改类的每个对象(我在1 nvar的(结果$ MCMC))类(结果$跟踪[ ]])< - “网格”,然后使用c.trellis在latticeExtra包的方法相结合,或简单地重新使用的原料MCMC输出生成的图。不生产,如果图== FALSE。</ TD> </ TR>
<tr valign="top"><td>density</td> <td> a list of lattice objects representing density plots for each monitored variable, of class 'plotindpages'. Calling each individual element will result in the density plot for that variable being shown, calling the entire list will result in all density plots being shown in new windows (which may cause problems with your R session if there are several monitored variables). To override the individual window plotting behaviour (to combine plots and/or save the plots to a file), either change the class of each object using for(i in 1:nvar(results$mcmc)) class(results$density[[i]]) <- 'trellis' and then combine using the c.trellis method in the latticeExtra package, or simply re-generate the plots using the raw mcmc output. Not produced if plots==FALSE.</td></tr>
<tr valign="top"> <TD> density</ TD> <TD>密度图中每个被监视的变量,类的plotindpages“格对象的列表。调用每个元素将导致该变量的密度图的显示,呼叫将导致整个列表密度图显示在新的Windows(R会话可能会产生问题,如果有几个监视的变量)。要覆盖各个窗口绘制的行为(结合图和/或保存到一个文件中的图),可以更改每个对象类的使用(I:1 nvar的(结果$ MCMC))类($密度[ ]])< - “网格”,然后使用c.trellis在latticeExtra包的方法相结合,或简单地重新使用的原料MCMC输出生成的图。不生产,如果图== FALSE。</ TD> </ TR>
<tr valign="top"><td>pd</td> <td> the total effective number of parameters in the model calculated using the DIC module for JAGS. Returned only if monitor.pd=TRUE is supplied to the function (or if 'dic' is specified as a monitored variable).</td></tr>
<tr valign="top"> <TD>pd</ TD> <TD>总有效使用DIC模块JAGS计算模型中的参数数目。仅返回如果monitor.pd = TRUE,被提供给的函数(或如果“DIC”被指定为被监视的变量)。</ TD> </ TR>
<tr valign="top"><td>pd.i</td> <td> the contribution of each parameter towards the total effective number of parameters calculated using the DIC module for JAGS. Returned only if monitor.pd.i=TRUE is supplied to the function.</td></tr>
<tr valign="top"> <TD> pd.i </ TD> <TD>对总有效使用DIC模块JAGS计算的参数,每个参数的贡献。 ,只返回,如果monitor.pd.i = TRUE提供的功能。</ TD> </ TR>
<tr valign="top"><td>popt</td> <td> the optimism of the expected deviance calculated using the DIC module for JAGS. Returned only if monitor.popt=TRUE is supplied to the function (or if 'dic' is specified as a monitored variable).</td></tr>
<tr valign="top"> <TD> popt </ TD> <TD>乐观的预期偏差的计算使用DIC模块JAGS。仅返回如果monitor.popt = TRUE,被提供给的函数(或如果“DIC”被指定为被监视的变量)。</ TD> </ TR>
<tr valign="top"><td>dic</td> <td> The Deviance Information Criterion (DIC) model fit statistics. Returned only if 'dic' is specified as a monitored variable. The default print method displays the DIC calculated using both pd (dic) and popt (ped), using the deviance from the combined chains and for each individual chain. Separate values for the mean pd, sum popt and mean deviance is also listed. For more information on the types of DIC calculated, see the JAGS manual. </td></tr>
<tr valign="top"> <TD> dic </ TD> <TD>越轨信息准则(DIC)模型拟合统计。 “DIC”如果只返回被指定为被监视的变量。的默认打印方法,显示计算使用概率pd(DIC)和POPT(PED认证),使用偏差从合并的链和为每个单独的链的DIC。还列出了独立的平均PD,POPT总和和平均偏差值。对于DIC计算的类型的更多信息,请参阅JAGS手册。 </ TD> </ TR>
</table>
</ TABLE>
(作者)----------Author(s)----------
Matthew Denwood <a href="mailto:matthew.denwood@glasgow.ac.uk">matthew.denwood@glasgow.ac.uk</a>
参见----------See Also----------
run.jags,
run.jags,
autorun.jagsfile,
autorun.jagsfile,
combine.mcmc,
combine.mcmc,
raftery.diag,
raftery.diag,
gelman.diag,
gelman.diag,
autocorr.diag
autocorr.diag
实例----------Examples----------
# run a model to calculate the intercept and slope of the expression [运行模型计算的截距和斜率的表达]
# y = m x + c, assuming normal observation errors for y:[为y = mx + C,假设正常观测误差为y:]
## Not run: [#不运行:]
# Simulate the data[模拟数据]
x <- 1:100
y <- rnorm(length(x), 2*x + 10, 1)
# Model in the JAGS format[模型的JAGS格式]
model <- "model {
for(i in 1 : N){
Y[i] ~ dnorm(true.y[i], precision);
true.y[i] <- (m * X[i]) + c;
}
m ~ dunif(-1000,1000);
c ~ dunif(-1000,1000);
precision ~ dexp(1);
}"
# Convert the data to a named list[将数据转换为命名列表]
data <- list(X=x, Y=y, N=length(x))
# Run the model[运行模型]
results <- autorun.jags(model=model, monitor=c("m", "c", "precision"),
data=data)
# Analyse traceplots of the results to assess convergence:[分析的结果,以评估收敛的traceplots:]
results$trace
# Summary of monitored variables:[监视变量的摘要:]
results$summary
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|