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

R语言 RMark包 mark.wrapper.parallel()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-26 23:44:16 | 显示全部楼层 |阅读模式
mark.wrapper.parallel(RMark)
mark.wrapper.parallel()所属R语言包:RMark

                                        Constructs and runs in parallel a set of MARK models from a dataframe of parameter
                                         从一个数据框的参数构造并运行在平行的一组MARK型号

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

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

This is a convenience function that uses a dataframe of parameter specifications created by create.model.list and it constructs and runs each model and names the models by concatenating each of the parameter specification names separated by a period.  The results are returned as a marklist with a model.table constructed by collect.models.
这是一个方便的功能,使用一个数据框的参数规格的create.model.list的,它的构造和运行每个型号和名称的模型,通过连接每一个句点分隔的名称参数规格。返回结果作为与collect.models构建一个model.table,一个marklist。


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


  mark.wrapper.parallel(model.list, silent = FALSE,
    use.initial = FALSE, initial = NULL, parallel = TRUE,
    cpus = 2, ...)



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

参数:model.list
a dataframe of parameter specification names in the calling frame
在调用帧一个数据框的参数规范的英文名称


参数:silent
if TRUE, errors that are encountered are suppressed
如果为TRUE,所遇到的错误被抑制


参数:use.initial
if TRUE, initial values are constructed for new models using completed models that have already been run in the set
如果为TRUE,初始值是建造完成的模型已经运行在设定的新车型


参数:initial
vector, mark model or marklist for defining initial values
矢量,标志的模型或marklist为定义的初始值


参数:parallel
if TRUE, runs models in parallel on multiple cpus
如果为TRUE,在多个CPU上并行运行模型


参数:cpus
number of cpus to use in parallel
并联使用的CPU数量


参数:...
arguments to be passed to mark. These must be specified as argument=value pairs.
参数被传递到mark。必须指定这些参数=值对。


Details

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

The model names in model.list must be in the frame of the function that calls run.models. If model.list=NULL or the MARK models are collected from the frame of the calling function (the parent). If type is specified only the models of that type (e.g., "CJS") are run. In each case the models are run and saved in the parent frame. To fully understand, how this function works and its limitations, see create.model.list.
在model.list的机型名称必须的函数调用run.models的的框架。如果model.list=NULL或MARK模型收集调用函数(父)的框架。如果type指定该类型的模型(例如,“CJS”)运行。在每一种情况下,模型的运行和保存在父框架中。要充分了解,这个函数是如何工作的,它的局限性,create.model.list。

If use.initial=TRUE, prior to running a model it looks for the first model that has already been run (if any) for each parameter formula and constructs an initial vector from that previous run. For example, if you provided 5 models for p and 3 for Phi in a CJS model, as soon as the first model for p is run, in the subsequent 2 models with different Phi models, the initial values for p are assigned based on the run with the first Phi model.  At the outset this seemed like a good idea to speed up execution times, but from the one set of examples I ran where several parameters were at boundaries, the results were discouraging because the models converged to a sub-optimal likelihood value than the runs using the default initial values.  I've left sthis option in but set its default value to FALSE.
如果use.initial=TRUE,运行之前,它看起来的第一款车型,已经运行(如果有的话)的每个参数公式,并构建了一个initial向量,以前运行的一个模型。例如,如果提供了5种型号的p和3披CJS模型中,尽快的p的第一模型运行时,在随后的2款与不同披模型,对于p的初始值的基础上,分配运行披模型。在开始,这似乎是一个好主意,加快执行时间,但是从一组例子,我跑了几个参数的边界处,结果令人沮丧,因为这些模型融合到一个次优的似然值比运行时使用默认的初始值。我已经离开sthis的选项,但是,它的默认值设置为FALSE。

A possibly more useful argument is the argument initial.  Previously, you could use initial=model as part of the ... arguments and it would use the estimates from that model to assign initial values for any model in the set. Now I've defined initial as a specific argument and it can be used as above or you can also use it to specify a marklist of previously run models. When you do that, the code will lookup each new model to be run in the set of models specified by initial and if it finds one with the matching name then it will use the estimates for any matching parameters as initial values in the same way as initial=model does. The model name is based on concatenating the names of each of the parameter specification objects.  To make this useful, you'll want to adapt to an approach that I've started to use of naming the objects something like p.1,p.2 etc rather than naming them something like p.dot, p.time as done in many of the examples.  I've found that using numeric approach is much less typing and cumbersome rather than trying to reflect the formula in the name. By default, the formula is shown in the model selection results table, so it was a bit redundant.  Now where I see this being the most benefit. Individual covariate models tend to run rather slowly. So one approach is to run the sequence of models (eg results stored in initial_marklist), including the set of formulas with all of the variables other than individual covariates.  Then run another set with the same numbering scheme, but adding the individual covariates to the formula and using initial=initial_marklist That will work if each parameter specification has the same name (eg., p.1=list(formula=~time) and then p.1=list(formula=~time+an_indiv_covariate)).  All of the initial values will be assigned for the previous run except for any added parameters (eg. an_indiv_covariate) which will start with a 0 initial value.
一个可能有用的参数是参数initial。在此之前,你可以使用initial=model的一部分。...从该模型的估计参数,它会使用,分配初始值的集合中的任何模型。现在,我已经定义了initial作为一种特定的参数,它可以被用作以上的,或者你也可以用它来指定一个marklist以前运行的模型。当你这样做时,代码会查找每一个新的模式来运行在指定的initial,如果它找到一个相匹配的名字,然后它会使用任何匹配的参数作为初始值估计的模型集相同的方式initial=model。的型号名称是根据串联每个参数规范对象的名称。为了使这个有用的,你要适应的做法,我已经开始使用命名对象类似第1页,第2页等,而不是命名类似p.dot,p.time所做的那样在许多实施例。我发现,用数字的方法要少得多打字和繁琐的,而不是试图以反映公式中的名称。默认情况下,该公式模型中的选择结果表所示,所以这是一个有点多余。现在,我看到这是最大的利益。个人的协变量的模型往往会运行比较缓慢。因此,一种方法是运行序列模型(如结果存储在initial_marklist),包括一套公式,所有的变量不是个别的变量。然后运行另一组具有相同编号的计划,但将个人变项的公式和使用initial=initial_marklist这将工作,如果每个参数的规范具有相同的名称(例如,第1页=列表(公式=~时间),然后第1页=列表(公式=~时间+ an_indiv_covariate))。所有的初始值将被分配为以前的运行除了任何增值参数(如an_indiv_covariate)的这将与0的初始值开始。


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

marklist - list of mark models that were run and a model.table of results
marklist  - 标记模式,运行和结果一个model.table的列表


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



Eldar Rakhimberdiev




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

collect.models, mark, create.model.list
collect.models,mark,create.model.list


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


do.MSOccupancy=function()
{
#  Get the data[获取数据]
        data(NicholsMSOccupancy)
# Define the models; default of Psi1=~1 and Psi2=~1 is assumed[定义模型默认的PSI1~1 PSI2假定=~1]
# p varies by time but p1t=p2t[p不同的时间,但P1T = P2T]
        p1.p2equal.by.time=list(formula=~time,share=TRUE)
# time-invariant p p1t=p2t=p1=p2[时间不变p P1T = P2T = P1 = P2]
        p1.p2equal.dot=list(formula=~1,share=TRUE)
#time-invariant p1 not = p2[时间不变P1 = P2]
        p1.p2.different.dot=list(p1=list(formula=~1,share=FALSE),p2=list(formula=~1))
# time-varying p1t and p2t[随时间变化的P1T和P2T]
        p1.p2.different.time=list(p1=list(formula=~time,share=FALSE),p2=list(formula=~time))
#  delta2 model with one rate for times 1-2 and another for times 3-5;[DELTA2模型,1次1-2次3-5率;]
# delta2 defined below[DELTA2定义见下文]
        Delta.delta2=list(formula=~delta2)
        Delta.dot=list(formula=~1)  # constant delta[不变Delta]
        Delta.time=list(formula=~time) # time-varying delta[随时间变化的Delta]
# Process the data for the MSOccupancy model[过程中,数据的MSOccupancy模型]
        NicholsMS.proc=process.data(NicholsMSOccupancy,model="MSOccupancy")
# Create the default design data[创建默认的设计数据]
        NicholsMS.ddl=make.design.data(NicholsMS.proc)
# Add a field for the Delta design data called delta2.  It is a factor variable[添加一个字段称为DELTA2Delta的设计数据。它是一个因素变量]
# with 2 levels: times 1-2, and times 3-5.[2级:次1-2,3-5倍。]
        NicholsMS.ddl=add.design.data(NicholsMS.proc,NicholsMS.ddl,"Delta",
                        type="time",bins=c(0,2,5),name="delta2")
# Create a list using the 4 p modls and 3 delta models (12 models total)[创建一个列表使用4 P modls和3δ模型(共12个型号)]
        cml=create.model.list("MSOccupancy")
# Fit each model in the list and return the results[适合每个模型在列表中,并返回结果]
        return(mark.wrapper.parallel(cml,data=NicholsMS.proc,ddl=NicholsMS.ddl,cpus=2,parallel=TRUE))
}
xx=do.MSOccupancy()

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-23 20:42 , Processed in 0.028805 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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