crdms(RMark)
crdms()所属R语言包:RMark
Example data for Closed Robust Design Multistrata
封闭的稳健设计的多的数据示例
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Data and Script to simulate the MSCRD example of 15.7.1 from the MARK book Cooch and White
数据和脚本,模拟MSCRD的例子15.7.1 MARK书COOCH和白色
格式----------Format----------
A data frame with 557 observations on the following 2 variables.
557以下两个变量的观察与数据框。
ch a character vector of encounter histories
CH字符向量的遭遇历史
freq a numeric vector of frequencies of each history
频率的一个数值向量的每个历史的频率
源----------Source----------
This example was constructed by Andrew Paul who is with Fish and Wildlife Division of the Alberta Provincial Government
这个例子构建了安德鲁·保罗谁是阿尔伯塔省政府鱼类和野生动物部
参考文献----------References----------
http://www.phidot.org/software/mark/
实例----------Examples----------
#Script to simulate the MSCRD[脚本来模拟MSCRD,]
#example of 15.7.1 from the MARK[例如,15.7.1从标记]
#book[书]
#created by AJP 21 Dec 2010[AJP 2010年12月21号]
#cleanup the R environment[清理R环境]
graphics.off()
rm(list=ls())
#cleanup files[清理文件]
cleanup(ask=FALSE)
#convert .inp data - only needed to create crdms[转换。INP - 只需要创建crdms的]
#ch.data<-convert.inp("rd_simple1.inp")[ch.data:<-convert.inp(“rd_simple1.inp”)。]
data(crdms)
#set time intervals[设定的时间间隔]
#4 primary periods each with 3 secondary occasions[4个主周期,每个周期有3个场合]
t.int<-c(rep(c(0,0,1),3),c(0,0))
#process data for RMark[过程数据RMark]
crdms.data<-process.data(crdms,model="CRDMS",time.interval=t.int,
strata.labels=c("1","U"))
#change Psi parameters that are obtained by subtraction[改变是通过减法的的幽参数,]
crdms.ddl<-make.design.data(crdms.data,
parameters=list(Psi=list(subtract.stratum=c("1","1"))))
#create grouping index for unobserved p and c (i.e., always zero)[创建分组索引未观测到的P和C(即始终为零)]
up=as.numeric(row.names(crdms.ddl$p[crdms.ddl$p$stratum=="U",]))
#create grouping index to fix Psi for unobs to unbos at time 1[创建分组指数在时间1,修复幽unobs unbos]
#this isn't necessary but it allows this Psi to be fixed to a value[这不是必需的,但它允许此帕普西被固定到一个值]
#that can be flagged and not erroneously interpreted[只能标记,而不是错误地解释]
Psiuu1=as.numeric(row.names(crdms.ddl$Psi[crdms.ddl$Psi$stratum=="U"&
crdms.ddl$Psi$time==1,]))
#create dummy variable for constraining last Psi in Markovian model[创建虚拟变量约束马尔可夫模型的最后PSI]
#variable is called ctime for constrained time[有限的时间被称为变量的ctime]
crdms.ddl$Psi$ctime=crdms.ddl$Psi$time
crdms.ddl$Psi$ctime[crdms.ddl$Psi$time==3]=2
#Initial assumptions[最初的设想]
S.dot=list(formula=~1) #S equal for both states and constant over time[S等于这两个州和随时间变化]
p.session=list(formula=~session, share=TRUE, #p=c varies with session[P = C随会议]
fixed=list(index=up,value=0)) #p set to zero for unobs[P设置为零unobs]
#Model 1 - Markovian movement[模式1 - 马尔可夫运动]
Psi.markov=list(formula=~ctime+stratum,
fixed=list(index=Psiuu1,value=9e-99)) #9e-99 is a flag[部9e-99是一个标志]
model.1=mark(crdms.data,ddl=crdms.ddl,
model.parameters=list(S=S.dot,
p=p.session,
Psi=Psi.markov),threads=2)
#Model 2 - Random movement[模式2 - 随机运动]
Psi.rand=list(formula=~time)
model.2=mark(crdms.data,ddl=crdms.ddl,
model.parameters=list(S=S.dot,
p=p.session,
Psi=Psi.rand),threads=2)
#Model 3 - No movement[模式3 - 运动]
Psi.fix=list(formula=~1,fixed=0)
model.3=mark(crdms.data,ddl=crdms.ddl,
model.parameters=list(S=S.dot,
p=p.session,
Psi=Psi.fix),threads=2)
#collect and store models[收集和存储模型]
crdms.res<-collect.models()
print(crdms.res)
#final cleanup[最终的清理工作]
cleanup(ask=FALSE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|