找回密码
 注册
查看: 299|回复: 0

R语言 SamplerCompare包 simulation.result()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-29 21:34:44 | 显示全部楼层 |阅读模式
simulation.result(SamplerCompare)
simulation.result()所属R语言包:SamplerCompare

                                        Summarize one MCMC chain
                                         总结一个MCMC链

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Summarize one MCMC chain in the format used by compare.samplers
总结MCMC链中使用的格式由compare.samplers


用法----------Usage----------


                  evals=NULL, grads=NULL, tuning=NULL, cpu=NULL,
                  burn.in=0.2, y=NULL,
                  sampler.expr=sprintf("plain('%s')", sampler.name),



参数----------Arguments----------

参数:target.dist
A distribution object of the sort generated by make.dist representing the distribution sampled from.  This is used to obtain the dimension and name of the distribution; the log density function does not need to be specified.
分布对象的排序所产生的make.dist代表分布采样。这是用来获得的尺寸和分布的名称;log密度函数并不需要被指定。


参数:sampler.name
The name of the sampler that generated this simulation.  If generated by SamplerCompare, this would usually be the <VAR>name</VAR> attribute of the sampler function.
生成此模拟采样的名称。如果所产生的SamplerCompare,这通常会是在<VAR>的名称</ VAR>属性的采样功能。


参数:X
A matrix (or object that can be coerced to a matrix) containing the simulation results.  It should have one row per iteration and one column for each component of the state space. Corresponds to the <VAR>X</VAR> element of the list returned by a sampler.
矩阵(或对象可以强制转换为一个矩阵)的模拟结果。它应该有一个迭代每行和一列的每个组件的状态空间。对应的<VAR> X </ VAR>元素的取样返回的列表。


参数:evals
The total number of log density evaluations used in the simulation; corresponds to the <VAR>evals</VAR> element of the list returned by a sampler.
总数在模拟中使用的log密度评价;对应<VAR>资料评估</变更>元素的列表由一个采样返回。


参数:grads
The total number of log density gradient evaluations used in the simulation; corresponds to the <VAR>grads</VAR> element of the list returned by a sampler.
在模拟中使用的记录密度梯度评价的总数;对应的<VAR>梯度</ VAR>采样器所返回的列表元素。


参数:tuning
The scalar tuning parameter passed to the sampler.
标量调整参数传递给采样。


参数:cpu
The processor time used to generate the simulation in seconds.
使用的处理器时间,以秒为单位来生成仿真。


参数:burn.in
Initial fraction of <VAR>X</VAR> to discard before computing autocorrelation times.
初始部分的<VAR> X </ VAR>放弃之前计算的自相关时间。


参数:y
A vector with the same number of elements as <VAR>X</VAR> has rows containing the log densities at the states represented by those rows.
一种向量,与相同数量的元素作为<VAR> X </ VAR>包含log密度的状态所表示的那些行的行。


参数:sampler.expr
The name of the sampler that generated this simulation in plotmath format.  If generated by SamplerCompare, this would usually be the <VAR>name.expression</VAR> attribute of the sampler function.
采样,生成此模拟在plotmath格式的名称。如果所产生的SamplerCompare,这通常会是在<VAR>的name.expression </ VAR>属性的采样功能。


参数:aborted
A logical scalar indicating whether the simulation was prematurely aborted.
一个逻辑标量是否模拟过早中止。


Details

详细信息----------Details----------

This function summarizes a simulation into a single-row data frame by computing the autocorrelation time of its slowest-mixing component and, if possible, the autocorrelation time of the log density and the error in the sample mean.  The   autocorrelation time of the slowest-mixing component can always be estimated, but is more accurate if the true mean is specified in <VAR>target.dist</VAR>. The autocorrelation time of the log density can be estimated if either the log density function is specified in <VAR>target.dist</VAR> or an explicit vector of log densities is passed as <VAR>y</VAR>.  The error in the sample mean can be computed if the mean is specified in <VAR>target.dist</VAR>.
此功能总结了模拟成单排的数据框通过计算的自相关时,其最慢的混合成分,并且如果可能的话,log密度和样品中的误差的自相关时间平均值。最慢的混合组分的自相关时,总是可以被估计,但是更准确的,如果真实平均值中指定<VAR> target.dist </ VAR>。自相关时间的记录密度可估计如果记录密度函数中指定<VAR>的,target.dist </ VAR>或明确的记录密度是通过为向量<VAR> Y </ VAR>。如果平均中指定<VAR> target.dist样本平均值中的错误,可以计算</ VAR>。

This function is intended to be called once per simulation for a variety of simulations.  The results are to be combined with rbind and can be visualized with comparison.plot.  While the <VAR>evals</VAR> and <VAR>tuning</VAR> arguments are optional, the result cannot be used with comparison.plot if it is not set. simulation.result is normally called internally by compare.samplers but is exported so that simulations run in external systems such as JAGS can be analyzed with SamplerCompare.  See the &ldquo;Examples&rdquo; section for an example of this usage.
此功能的目的是将每一次调用各种模拟仿真。要结合rbind结果,并可以可视化与comparison.plot。虽然<VAR>评估版</ VAR>和<VAR>调整</ VAR>参数是可选的,结果不能用comparison.plot,如果没有设置。 simulation.result通常称为内部compare.samplers但出口,外部系统(如JAGS)运行在模拟可以分析SamplerCompare。这种用法的例子,请参见“示例”部分。


值----------Value----------

A single-row data frame of the format returned by compare.samplers.
单排数据框的格式返回compare.samplers。


参考文献----------References----------

Journal of Statistical Software 43(12):1-10.

参见----------See Also----------

compare.samplers, comparison.plot, &ldquo;Introduction to SamplerCompare&rdquo; (vignette)
compare.samplers,comparison.plot,的“介绍SamplerCompare”(暗角)


实例----------Examples----------


# An example generated with the following JAGS model:[产生一个例子与以下JAGS模型:]
#[]
# model {[模型{]
#   mu[1] &lt;- 0[亩[1] < -  0]
#   mu[2] &lt;- 0[亩[2] < -  0]
#   Sigma[1,1] &lt;- 1[适马[1,1] < -  1]
#   Sigma[2,2] &lt;- 1[适马[2,2] < -  1]
#   Sigma[1,2] &lt;- 0.7[适马[1,2] < -  0.7]
#   Sigma[2,1] &lt;- 0.7[Sigma公司[2,1] < -  0.7]
#   x ~ dmnorm(mu, inverse(Sigma))[X~dmnorm(逆万亩,(Sigma公司))]
# }[}]
#[]
# and the following JAGS script:[以下JAGS脚本:]
#[]
# model in "mv.7.model"[模型在“mv.7.model”]
# compile, nchains(1)[编译,nchains(1)]
# initialize[初始化]
# update 1000[更新1000]
# monitor x[显示器x]
# update 10000[更新10000]
# coda *[结尾*]

# Load data written by JAGS[数据加载写的JAGS]

library(coda)
X <- read.coda('CODAchain1.txt', 'CODAindex.txt')

# Dummy distribution object.[虚拟分配的对象。]

N2.dist <- make.dist(2, '2D Normal, cor=0.7', mean=c(0,0))

# Compute simulation result.  evals and tuning are hacks; they[计算仿真结果。评估和调整是黑客,他们]
# are undefined with Gibbs sampling.  JAGS can do its own burn-in,[Gibbs抽样是不确定的。 JAGS可以做自己的老化,]
# so set burn.in to zero.[所以设置burn.in零。]

sim.result <- simulation.result(N2.dist, 'JAGS', X,
                                evals=nrow(X)*ncol(X), tuning=1,
                                burn.in=0)


转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-29 03:56 , Processed in 0.037056 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表