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

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

[复制链接]
发表于 2012-9-26 23:40:22 | 显示全部楼层 |阅读模式
dipper(RMark)
dipper()所属R语言包:RMark

                                        Dipper capture-recapture data
                                         北斗星捕获 - 再捕获数据

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

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

A capture-recapture data set on European dippers from France that accompanies MARK as an example analysis using the CJS and POPAN models.  The dipper data set was orginally described as an example by Lebreton et al (1992).
一个捕获 - 再捕获来自法国的欧洲杓,伴随着MARK使用CJS和POPAN模型的一个实例分析的数据集。勒布雷顿等人(1992),北斗星的数据集开始是作为一个例子说明。


格式----------Format----------

A data frame with 294 observations on the following 2 variables.
294以下两个变量的观察数据框。




ch a character vector containing the encounter history of
CH字符向量的遭遇史上的

  


sex the sex of the bird: a factor with levels
性的性别鸟的因素与水平


Details

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

This is a data set that accompanies program MARK as an example for CJS and POPAN analyses.  The data can be stratified using sex as a grouping variable.  The functions run.dipper, run.dipper.alternate, run.dipper.popan defined below in the examples mimic the models used in the dbf file that accompanies MARK. Note that the models used in the MARK example use PIM coding with the sin link function which is often better at identifying the number of estimable parameters. The approach used in the R code uses design matrices and cannot use the sin link and is less capable at counting parameters.  These differences are illustrated by comparing the results of run.dipper and run.dipper.alternate which fit the same set of "CJS" models.  The latter fits the models with constraints on some parameters to achieve identifiability and the former does not. Although it does not influence the selection of the best model it does infleunce parameter counts and AIC ordering of some of the less competitive models. In using design matrices it is best to constrain parameters that are confounded (e.g., last occasion parameters in Phi(t)p(t) CJS model) when possible to achieve more reliable counts of the number of estimable parameters.  See adjust.parameter.count for more dicussion on this point.
这是一个数据集的CJS和POPAN分析的一个例子,伴随着计划MARK。这些数据可以分层为一组变量的使用性。的功能run.dipper,run.dipper.alternate,run.dipper.popan定义见下文的例子模仿,伴随着MARK dbf文件中使用的模型。请注意,使用的模型标记示例使用PIM编码的罪链接功能,这是在确定难能可贵参数的数量往往更好。所采用的方法在R代码使用设计矩阵,不能使用的罪恶链接和能力较差,在计算参数。这些差异说明比较的结果run.dipper和run.dipper.alternate适用相同的一组“CJS”的模式。后者对某些参数的限制,实现可识别性和不适合的模型。虽然它不影响选择的最佳模式,它infleunce的参数计数及AIC订购的一些竞争力较弱的车型。在使用设计矩阵,它是最好的到约束所混淆的参数(例如,上次在Phi(T)P(t)的CJS模型参数)时,能够实现更可靠的计数可估计参数的数目。见adjust.parameter.count的更多讨论时,在这一点上。

Note that the covariate "sex" defined in dipper has values "Male" and "Female".  It cannot be used directly in a formula for MARK without using it do define groups because MARK.EXE will be unable to read in a covariate with non-numeric values.  By using groups="sex" in the call the process.data a factor "sex" field is created that can be used in the formula. Alternatively, a new covariate could be defined in the data with say values 0 for Female and 1 for Male and this could be used without defining groups because it is numeric.  This can be done easily by translating the values of the coded variables to a numeric variable. Factor variables are numbered 1..k for k levels in alphabetic order.  Since Female < Male in alphabetic order then it is level 1 and Male is level 2.  So the following will create a numeric sex covariate.
请注意,在瓢协“性”的定义值“男”和“女”。它不能直接使用的公式MARK不使用它做定义组,因为MARK.EXE将是无法读取的协与非数字值。通过使用groups="sex"在呼叫中process.data创建的一个因素的“性别”域,可以在公式中使用。另外,一个新的协变量可以被定义为0的值的数据说,女,1男,这可以用于没有定义组,因为它是数字。这可以很容易地通过翻译编码的变量的值的一个数字变量。因子变量的编号为1 .. k为按字母顺序排列的K水平。由于女<男按字母顺序排列,然后是1级和男性是2级。因此,下面将创建一个数字性的协变量。


源----------Source----------

Lebreton, J.-D., K. P. Burnham, J. Clobert, and D. R. Anderson. 1992. Modeling survival and testing biological hypotheses using marked animals: case studies and recent advances. Ecol. Monogr. 62:67-118.
勒布雷顿,J.-D.,KP,J. Clobert,伯纳姆和安德森博士。 1992年。建模的生存和测试生物假说使用标记的动物:情况研究和最新进展。生态学报。 Monogr。 62:67-118。


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



data(dipper)
dipper.model=mark(dipper)
run.dipper=function()
{
#[]
# Process data[过程数据]
#[]
dipper.processed=process.data(dipper,groups=("sex"))
#[]
# Create default design data[创建默认的设计数据]
#[]
dipper.ddl=make.design.data(dipper.processed)
#[]
# Add Flood covariates for Phi and p that have different values[加入洪水的协变量披和p有不同的价值观]
#[]
dipper.ddl$Phi$Flood=0
dipper.ddl$Phi$Flood[dipper.ddl$Phi$time==2 | dipper.ddl$Phi$time==3]=1
dipper.ddl$p$Flood=0
dipper.ddl$p$Flood[dipper.ddl$p$time==3]=1
#[]
#  Define range of models for Phi[定义范围内的车型披]
#[]
Phidot=list(formula=~1)
Phitime=list(formula=~time)
Phisex=list(formula=~sex)
Phisextime=list(formula=~sex+time)
Phisex.time=list(formula=~sex*time)
PhiFlood=list(formula=~Flood)
#[]
#  Define range of models for p[定义范围内的车型为p]
#[]
pdot=list(formula=~1)
ptime=list(formula=~time)
psex=list(formula=~sex)
psextime=list(formula=~sex+time)
psex.time=list(formula=~sex*time)
pFlood=list(formula=~Flood)
#[]
# Run assortment of models[运行模型的分类]
#[]
dipper.phidot.pdot          =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phidot,p=pdot))
dipper.phidot.pFlood              =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phidot,p=pFlood))
dipper.phidot.psex                =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phidot,p=psex))
dipper.phidot.ptime               =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phidot,p=ptime))
dipper.phidot.psex.time                =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phidot,p=psex.time))
dipper.phitime.ptime              =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phitime, p=ptime))
dipper.phitime.pdot               =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phitime,p=pdot))
dipper.phitime.psex                =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phitime,p=psex))
dipper.phitime.psex.time        =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phitime,p=psex.time))
dipper.phiFlood.pFlood            =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=PhiFlood, p=pFlood))
dipper.phisex.pdot                =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phisex,p=pdot))
dipper.phisex.psex                =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phisex,p=psex))
dipper.phisex.psex.time                =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phisex,p=psex.time))
dipper.phisex.ptime               =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phisex,p=ptime))
dipper.phisextime.psextime        =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phisextime,p=psextime))
dipper.phisex.time.psex.time        =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phisex.time,p=psex.time))
dipper.phisex.time.psex         =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phisex.time,p=psex))
dipper.phisex.time.pdot                =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phisex.time,p=pdot))
dipper.phisex.time.ptime        =mark(dipper.processed,dipper.ddl,
                 model.parameters=list(Phi=Phisex.time,p=ptime))
#[]
# Return model table and list of models[回归模型的表格和列表的车型]
#[]
return(collect.models() )
}

dipper.results=run.dipper()

run.dipper.alternate=function()
{
#[]
# Process data[过程数据]
#[]
dipper.processed=process.data(dipper,groups=("sex"))
#[]
# Create default design data[创建默认的设计数据]
#[]
dipper.ddl=make.design.data(dipper.processed)
#[]
# Add Flood covariates for Phi and p that have different values[加入洪水的协变量披和p有不同的价值观]
#[]
dipper.ddl$Phi$Flood=0
dipper.ddl$Phi$Flood[dipper.ddl$Phi$time==2 | dipper.ddl$Phi$time==3]=1
dipper.ddl$p$Flood=0
dipper.ddl$p$Flood[dipper.ddl$p$time==3]=1
#[]
#  Define range of models for Phi[定义范围内的车型披]
#[]
Phidot=list(formula=~1)
Phitime=list(formula=~time)
Phitimec=list(formula=~time,fixed=list(time=6,value=1))
Phisex=list(formula=~sex)
Phisextime=list(formula=~sex+time)
Phisex.time=list(formula=~sex*time)
PhiFlood=list(formula=~Flood)
#[]
#  Define range of models for p[定义范围内的车型为p]
#[]
pdot=list(formula=~1)
ptime=list(formula=~time)
ptimec=list(formula=~time,fixed=list(time=7,value=1))
psex=list(formula=~sex)
psextime=list(formula=~sex+time)
psex.time=list(formula=~sex*time)
psex.timec=list(formula=~sex*time,fixed=list(time=7,value=1))
pFlood=list(formula=~Flood)
#[]
# Run assortment of models[运行模型的分类]
#[]
dipper.phidot.pdot          =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phidot,p=pdot))
dipper.phidot.pFlood              =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phidot,p=pFlood))
dipper.phidot.psex                =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phidot,p=psex))
dipper.phidot.ptime               =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phidot,p=ptime))
dipper.phidot.psex.time                =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phidot,p=psex.time))
dipper.phitime.ptimec              =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phitime, p=ptimec))
dipper.phitime.pdot               =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phitime,p=pdot))
dipper.phitime.psex                =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phitime,p=psex))
dipper.phitimec.psex.time        =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phitimec,p=psex.time))
dipper.phiFlood.pFlood            =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=PhiFlood, p=pFlood))
dipper.phisex.pdot                =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phisex,p=pdot))
dipper.phisex.psex                =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phisex,p=psex))
dipper.phisex.psex.time                =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phisex,p=psex.time))
dipper.phisex.ptime               =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phisex,p=ptime))
dipper.phisextime.psextime        =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phisextime,p=psextime),adjust=FALSE)
dipper.phisex.time.psex.timec        =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phisex.time,p=psex.timec))
dipper.phisex.time.psex         =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phisex.time,p=psex))
dipper.phisex.time.pdot                =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phisex.time,p=pdot))
dipper.phisex.time.ptimec        =mark(dipper.processed,dipper.ddl,
                  model.parameters=list(Phi=Phisex.time,p=ptimec))
#[]
# Return model table and list of models[回归模型的表格和列表的车型]
#[]
return(collect.models() )
}
dipper.results.alternate=run.dipper.alternate()
#[]
# Merge two sets of models into a single model list and include the[合并到一个单一的模式列表,其中包括两套模型]
# initial model as a demo for merge.mark[初始模型演示merge.mark]
#[]
dipper.cjs=merge.mark(dipper.results,dipper.results.alternate,dipper.model)
dipper.cjs
#[]
# next delete some of the models to show how this is done with remove.mark[下删除一些模型显示如何做到这一点与remove.mark]
#[]
dipper.cjs=remove.mark(dipper.cjs,c(2,4,9))
dipper.cjs

run.dipper.popan=function()
{
#[]
# Process data[过程数据]
#[]
dipper.processed=process.data(dipper,model="POPAN",group="sex")
#[]
# Create default design data[创建默认的设计数据]
#[]
dipper.ddl=make.design.data(dipper.processed)
#[]
# Add Flood covariates for Phi and p that have different values[加入洪水的协变量披和p有不同的价值观]
#[]
dipper.ddl$Phi$Flood=0
dipper.ddl$Phi$Flood[dipper.ddl$Phi$time==2 | dipper.ddl$Phi$time==3]=1
dipper.ddl$p$Flood=0
dipper.ddl$p$Flood[dipper.ddl$p$time==3]=1
#[]
#  Define range of models for Phi[定义范围内的车型披]
#[]
Phidot=list(formula=~1)
Phitime=list(formula=~time)
Phisex=list(formula=~sex)
Phisextime=list(formula=~sex+time)
Phisex.time=list(formula=~sex*time)
PhiFlood=list(formula=~Flood)
#[]
#  Define range of models for p[定义范围内的车型为p]
#[]
pdot=list(formula=~1)
ptime=list(formula=~time)
psex=list(formula=~sex)
psextime=list(formula=~sex+time)
psex.time=list(formula=~sex*time)
pFlood=list(formula=~Flood)
#[]
#  Define range of models for pent[为压抑已久的车型定义范围]
#[]
pentsex.time=list(formula=~sex*time)
#[]
#  Define range of models for N[定义的N系列车型]
#[]
Nsex=list(formula=~sex)
#[]
# Run assortment of models[运行模型的分类]
#[]
dipper.phisex.time.psex.time.pentsex.time=mark(dipper.processed,dipper.ddl,
model.parameters=list(Phi=Phisex.time,p=psex.time,pent=pentsex.time,N=Nsex),
invisible=FALSE,adjust=FALSE)
dipper.phisex.time.psex.pentsex.time=mark(dipper.processed,dipper.ddl,
model.parameters=list(Phi=Phisex.time,p=psex,pent=pentsex.time,N=Nsex),
invisible=FALSE,adjust=FALSE)
#[]
# Return model table and list of models[回归模型的表格和列表的车型]
#[]
return(collect.models() )
}

dipper.popan.results=run.dipper.popan()

# *****************************************************************[************************************************** ***************]
# Here is an example of user specified links for each real parameter[下面是一个例子用户指定的每个实际参数的链接]
data(dipper)
dipper.proc=process.data(dipper)
dipper.ddl=make.design.data(dipper.proc)
# dummy run of make.mark.model to get links and design data.[假的运行make.mark.model,链接和设计数据。]
# parm.specific set to TRUE so it will create a link for[parm.specific设置为TRUE,所以它会创建一个链接]
# each parameter because for this model they are all the[每一个参数,因为这个模型,他们都是]
# same (logit) and if this was not specified you'ld get a vector with one element[相同(罗吉特)和如果这未指定yould的得到的向量用一个元素]
dummy=make.mark.model(dipper.proc,dipper.ddl,simplify=FALSE,parm.specific=TRUE)
input.links=dummy$links
# get model indices for p where time=4[模型指数p,其中时间= 4]
log.indices=dipper.ddl$p$model.index[dipper.ddl$p$time==4]
# assign those links to log[分配这些链接,登录]
input.links[log.indices]="Log"
# Now these can be used with any call to mark[现在,这些可以使用的任何呼叫马克]
mymodel=mark(dipper.proc,dipper.ddl,input.links=input.links)
summary(mymodel)


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-23 19:14 , Processed in 0.023264 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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