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

R语言 RxCEcolInf包 Tune()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-29 21:05:12 | 显示全部楼层 |阅读模式
Tune(RxCEcolInf)
Tune()所属R语言包:RxCEcolInf

                                        Tuning Function for Ecological Inference for Sets of R x C Contingency Tables
                                         调整生态推理的功能集的R X C列联表

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

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

This function tunes the markov chain monte carlo algorithm used to fit a hierarchical model to ecological data in which the underlying contigency tables can have any number of rows or columns. The user supplies the data and may specify hyperprior values. The function's primary output is a vector of multipliers, called rhos, used to adjust the covariance matrix of the multivariate t_4 distribution used to propose new values
此功能调整马尔可夫链蒙特卡罗算法,以适应分层模型的生态数据,其中的基础contigency表可以有任意数量的行或列。用户提供的数据和可以指定hyperprior值。该函数的主要输出是一个矢量乘法器,称为rhos,用来调整用于提出新的值的多元t_4分布的协方差矩阵


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


Tune(fstring, data=NULL, num.runs=12, num.iters=10000,
     rho.vec=rep(0.05, ntables),
     kappa=10, nu=(mu.dim+6), psi=mu.dim,
     mu.vec.0=rep(log((.45/(mu.dim-1))/.55), mu.dim),
     mu.vec.cu=runif(mu.dim, -3, 0),
     nolocalmode=50, sr.probs=NULL, sr.reps=NULL,
     numscans=1, Diri=100, dof=4, debug=1)



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

参数:fstring
String: model formula of contingency tables' column totals versus row totals. Must be in specified format (an R character string and NOT a true R formula). See Details and Examples.
字符串:模型公式的列联表的列的数量与行总计。必须在指定的格式(R字符的字符串,而不是一个真正的R公式)。查看详细信息和例子。


参数:data
Data frame.
数据框。


参数:num.runs
Positive integer:  The number of runs or times (each of num.iters iterations) the tuning algorthm will be implemented.
正整数的数目的运行或次(每的num.iters迭代),将实施调整algorthm,。


参数:num.iters
Positive integer:  The number of iterations in each run of the tuning algorithm.
正整数:在每次运行调整算法的迭代。


参数:rho.vec
Vector of dimension I = number of contigency tables = number of rows in data: initial values of multipliers (usually in (0,1)) to the covariance matrix of the proposal distribution for the draws of the intermediate level parameters.  The purpose of this Tune function is to adjust these values so as to achieve acceptance ratios of between .2 and .5 in the MCMC draws of the THETAs.
矢量尺寸I数= contigency表中的行数data:初始值的乘数(通常是在(0,1))的建议分布的协方差矩阵的画的中间级别的参数。这Tune功能的目的是调整这些值,从而达到接受的比值在0.2和0.5之间的MCMC绘制的THETA的。


参数:kappa
Scalar:  The diagonal of the covariance matrix for the (normal) hyperprior distribution for the mu parameter.
标量:(正常)hyperpriormu参数分布的协方差矩阵的对角线。


参数:nu
Scalar:  The degrees of freedom for the (Inverse-Wishart) hyperprior distriution for the SIGMA parameter.
标量的自由度为SIGMA参数的的(反威沙特)hyperprior distriution的。


参数:psi
Scalar:  The diagonal of the matrix parameter of the (Inverse-Wishart) hyperprior distribution for the SIGMA parameter.
标量:对角线的矩阵参数(逆-威沙特的)hyperprior分布SIGMA参数。


参数:mu.vec.0
Vector:  mean of the (normal) hyperprior distribution for the mu parameter.
向量:指(正常)hyperprior的分布mu参数。


参数:mu.vec.cu
Vector of dimension R*(C-1), where R(C) is the number of rows(columns) in each contigency table:  Optional starting values for mu parameter.
向量的维R*(C-1),其中R(C)的行数(列)在每个contigency表:可选mu参数的初始值。


参数:nolocalmode
Positive integer:  How often an alternative drawing method for the contigency table internal cell counts will be used. Use of default value recommended.
正整数:多久为contigency表内部的单元计数的另一种绘图方法将被使用。使用默认值建议。


参数:sr.probs
Matrix of dimension I x R:  Each value represents the probability of selecting a particular contingency table's row as the row to be calculated deterministically in (product multinomial) proposals for Metropolis draws of the internal cell counts.  For example, if R = 3 and row 2 of position sr.probs = c(.1, .5, .4), then in the third contingency table (correspoding to the third row of data), the proposal algorithm for the interior cell counts will calculate the third contingency table's first row deterministically with probability .1, the second row with probability .5, and the third row with probability .4.  Use of default (generated internally) recommended.
维矩阵IXR:每个值代表的概率,选择一个特定的应变表的行,作为行计算确定性在(产品多项式)都市建议利用内部单元计数。例如,如果R = 3和第2行的位置sr.probs= C(0.1,0.5,0.4),然后在第三列联表(correspodingdata)到第三行,用于室内的单元计数,将计算出的第三应变表的第一行的建议算法确定性的概率为0.1的概率为0.5,,第二行和第三行的概率是0.4。建议使用默认值(内部产生)。


参数:sr.reps
Matrix of dimension I x R:  Each value represents the number of times the (product multinomial proposal) Metropolis algorithm will be attempted when, in drawing the internal cell counts, the proposal for the corresponding contingency table row is to be calculated deterministically.  sr.reps has the same structure as sr.probs, i.e., position [3,1] of sr.reps corresponds to the third contingency table's first row.  Use of default (generated internally) recommended.
矩阵的维IXR:每个值表示的次数(产品多项建议)Metropolis算法将尝试时,在制定内部的单元计数,相应的应急表行的建议是确定性计算。 sr.reps具有相同的结构,[3,1] sr.reps作为sr.probs,即,位置对应于第三列联表的第一行。建议使用默认值(内部产生)。


参数:numscans
Positive integer:  How often the algorithm to draw the contingency table internal cell counts will be implemented before new values of the other parameters are drawn.  Use of default value recommended.
正整数多久实施前的其他参数的新值的算法绘制列联表的内部单元计数绘制。使用默认值建议。


参数:Diri
Positive integer:  How often a product Dirichlet proposal distribution will be used to draw the contingency table row probability vectors (the THETAS).
正整数:往往是一个产品狄利克雷分配提案将被用于绘制列联表行的概率向量(THETAS)。


参数:dof
Positive integer:  The degrees of freedom of the multivariate t proposal distribution used in drawing the contingency table row probability vectors (the THETAS).
正整数:度自由的多元t的分配提案用于绘制列联表行的概率向量(THETAS)的。


参数:debug
Integer:  Akin to verbose in some packages.  If set to 1, certain status information (including rough notification regarding the number of iterations completed) will be written to the screen.
整数:类似于verbose的一些包。如果一定的状态信息(包括粗糙的通知,关于完成的反复数)设置为1,将被写入到屏幕上。


Details

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

Tune is a necessary precursor function to Analyze, the workhorse function in fitting the R x C ecological inference model described in Greiner & Quinn (2009).  The details of this model are discussed in the documentation accompanying Analyze.
Tune是一个必要的先导功能,Analyze,主力在装修的R X C生态推理模型格雷纳奎因(2009)中描述的功能。这个模型的细节进行了讨论,在附带的文档Analyze。

One of the stages of the Gibbs sampler used to fit the Greiner & Quinn ecological inference model involves sampling from the conditional posterior distribution of the vector of probabilities associated with each contingency table (precinct, in voting applications).  There are R separate sets of probabilities (each of which must sum to one) associated with each contingency table.  Each such θ_r undergoes a multidimensional logistic transformation, using the last (right-most) column as the reference category. This results in R transformed  vectors of dimension (C-1); the transformed vectors, denoted omega_r's, are stacked to form a single omega vector corresponding to that contingency table. The omega vectors are assumed to follow (i.i.d.)  a multivariate normal distribution.
的吉布斯采样器,用于符合的格雷纳和奎因生态的推理模型涉及到采样的条件后验分布的向量,概率与每列联表(区,在投票应用程序)的一个阶段。有R两套独立的概率(每一个都必须和为1),与每列联表。每一个这样的θ_r经历了一个多层面的MF改造,使用的最后一个(最右边)的列作为参考类别。这将导致在R转化维向量(C-1);转化的向量,表示omega_r's,被堆叠,以形成一个单一的omega矢量对应于该列联表。欧米茄向量假定服从多元正态分布(IID)。

The posterior distribution of the THETAs/OMEGAs are in non-standard form. To sample from the posterior, the algorithm uses a Metropolis-Hastings step with a multivariate t_4 proposal distribution. The covariance matrix of this multivariate t_4 must be expanded or shrunk to achieve acceptance ratios of between .2 and .5. Tune implements num.runs sets of num.iters iterations of the Gibbs sampler. At the end of each set of iterations, Tune examines the acceptance ratios in each precinct and adjusts a shrinkage factor (a scalar multiplied to the covariance matrix of the t_4 proposal) upwards or downwards. When finished, Tune returns a vector of length I = the number of contingency tables in data, This vector, called rhos, should be fed into the Analyze function. See Examples here
后验分布的THETAs / OMEGAS是在非标准形式。采样后,该算法使用一个大都市的黑斯廷斯步骤与一个多元t_4建议分布。的协方差矩阵的这个多元t_4达到验收的比值在0.2和0.5之间,必须将膨胀或收缩。调整实现num.runs套num.iters的吉布斯采样迭代。迭代结束时的各组中,调整检查在每个区中的接受比率调整的收缩因子(t_4建议)向上或向下的协方差矩阵乘以一个标量。调整完成后,返回的向量长度I=数列联表中data,这个向量,被称为rhos,应送入Analyze功能的。这里的例子


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

A list with the following elements.
一个包含下列元素的列表。


参数:rhos
A vector of length I = number of contingency tables:  each element of the rhos vector is a multiplier used in the proposal distribution of for draws from the conditional posterior of the THETAs, as described above.  Feed this vector into the Analyze function.
长度的向量I=应变表数目:每个元素rhos向量是一个乘法器中使用的建议分布绘制从如上文所述的条件后验THETAs。饲料到Analyze函数向量。


参数:acc.t
Matrix of dimension I x num.runs: Each column of acc.t contains the acceptance fractions for the Metropolis-Hastings algorithm, with a multivariate t_4 proposal distribution, used to draw from the conditional posterior of the THETAs. If Tune has worked properly, all elements of the final column of this matrix should be between .2 and .5.
矩阵的维IXnum.runs:acc.t每一列包含了一个多变量t_4建议分布,接受分数的Metropolis-Hastings算法,用于绘制的条件后的THETA的。 Tune如果正常工作,这个矩阵的最后一列的所有元素应该是在0.2和0.5之间。


参数:acc.Diri
Matrix of dimension I x num.runs:  Each column of acc.t contains the acceptance fractions for the Metropolis-Hastings algorithm, with independent Dirichlet proposals, used to draw from the conditional posterior of the THETAs.  Tune does not alter this algorithm.
矩阵的维IXnum.runs:acc.t每一列包含接受分数的Metropolis-Hastings算法,具有独立的狄利克雷建议,用于绘制的条件后 X>。 THETA不改变这种算法。


参数:vld.NNs
A list of length num.runs: Each element of vld.NNs is a matrix of dimension I by R, with each element of the list corresponding to one of the num.iters sets of iterations run by Tune. To draw from the conditional posterior of the internal cell counts of a contigency table, the Tune function draws R-1 vectors of lenth C from multinomial distributions. In then calculates the counts in the additional row (denote this row as r') deterministically. This procedure can result in negative values in row r', in which case the overall proposal for the interior cell counts is outside the parameter space (and thus invalid). Each matrix of vld.NNs keeps track of the percentage of proposals drawn in this manner that are valid (i.e., not invalid). Each row of such a matrix corresponds to a contingency table. Each column in the matrix corresponds to a row in the a contingency table. Each entry specifies the percentage of multinomial proposals that are valid when the specified contingency table row serves as the r' row. For instance, in position 5,2 of vld.NNs is the fraction of valid proposals for the 5th contingency table when the second contigency table row is the r'th row. A value of “NaN” means that Tune chose to use a different (slower) method of drawing the internal cell counts because it suspected that the multinomial method would behave badly.
的列表的长度num.runs:每个元件的vld.NNs是一个矩阵的维度I由R,与列表中的每个元素对应于其中的num.iters 运行Tune的迭代套。要绘制的内部单元计数的contigency表的条件后,Tune函数绘制R-1向量;长度ç多项式分布。在计算额外的行计数(R)表示该行确定的。此过程可以导致在行r,在这种情况下的整体方案的内部单元计数以外的参数空间(并因此是无效的)的负值。每个矩阵vld.NNs跟踪以这种方式得出的提案,是有效的(即,不无效)的百分比。这样的矩阵的每一行对应于一个应急表。在矩阵中的每一列联表中的行。每个条目指定的百分比是有效的多项建议,在指定的列联表行作为R行。例如,在位置5,2的vld.NNs是当所述第二contigency表行是rth行第五列联表的有效的建议的馏分。 “南”的值意味着Tune选择使用一个不同的(更慢)制定的内部单元计数的方法,因为它怀疑,多项式法的行为严重。


参数:acc.NNs
A list of length num.runs: Same as vld.NNs, except the entries represent the fraction of proposals accepted (instead of the fraction that are in the permissible parameter space).  
条目的列表的长度num.runs:vld.NNs相同,除了表示接受的提案(而不是,在允许的参数空间的馏分)的馏分。


(作者)----------Author(s)----------


D. James Greiner, Paul D. Baines, \& Kevin M.
Quinn



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

“R x C Ecological Inference: Bounds, Correlations, Flexibility, and Transparency of Assumptions.” J.R. Statist. Soc. A

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


## Not run: [#不运行:]
library(RxCEcolInf)
data(stlouis)
Tune.stlouis <- Tune("Bosley, Roberts, Ribaudo, Villa, NoVote ~ bvap, ovap",
                     data = stlouis,
                     num.iters = 10000,
                     num.runs = 15)

## End(Not run)[#(不执行)]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-28 20:55 , Processed in 0.022657 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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