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

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

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

                                        Robust Design occupancy example data
                                         强大的设计占用的示例数据

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

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

A simulated data set on a breeding bird as an example of robust design occupancy modeling.
一个模拟的数据集上的繁殖鸟类作为强大的设计占用建模的一个例子。


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

A data frame with 35 observations on the following 12 variables
在以下12个变量的35次观测的数据框




ch A character vector containing the presence (1) and absence (0) or (.) not visited for each of 3 visits (secondary occasions)
通道A字符向量的存在(1)无(0)或()。没有到过3次访问(二次场合)

  


cover percentage canopy cover at
覆盖率篷盖

  


occ11 one of 9 session-dependent variables occ11 to occ33 containing the week the survey was conducted; p is the
9会话相关的变量occ11 occ11 1 occ33一周进行调查,P是




occ12 one of 9 session-dependent variables occ11 to occ33 containing the week the survey was conducted; p is the primary session number and s is
9会话相关的变量occ11 occ12之一occ33一周进行调查,p是主会话数和s

  


occ13 one of 9 session-dependent variables occ11 to occ33 containing the week the survey was conducted; p is
9会话相关的变量occ11 occ13 1 occ33一周进行调查,p为




occ21 one of 9 session-dependent variables occ11 to occ33 containing the week the survey was conducted; p is the primary session number and s is
9会话相关的变量occ11 occ21之一occ33一周进行调查,p是主会话数和s

  


occ22 one of 9 session-dependent variables occ11 to occ33 containing the week the survey was conducted; p is
9会话相关的变量occ11 occ22 1 occ33一周进行调查,p为




occ23 one of 9 session-dependent variables occ11 to occ33 containing the week the survey was conducted; p is the primary session number and s is
9会话相关的变量occ11 occ23之一occ33一周进行调查,p是主会话数和s

  


occ31 one of 9 session-dependent variables occ11 to occ33 containing the week the survey was conducted; p is
9会话相关的变量occ11 occ31 1 occ33一周进行调查,p为




occ32 one of 9 session-dependent variables occ11 to occ33 containing the week the survey was conducted; p is the primary session number and s is
9会话相关的变量occ11 occ32之一occ33一周进行调查,p是主会话数和s

  


occ33 one of 9 session-dependent variables occ11 to occ33 containing the week the survey was conducted; p is
9会话相关的变量occ11 occ33 1 occ33一周进行调查,p为




samplearea continuous variable indicating area size (ha) of the
samplearea连续变量,表示区域的大小(公顷)


Details

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

These are simulated data for an imaginary situation with 35 independent 'sites' on which presence/absence of a breeding bird is recorded 3 times annually for 3 years. Potential variables influencing site occupancy are the size of the site in hectares (samplearea) and canopy cover percentage (cover). The timing of the surveys within the year is thought to influence the detection of occupancy, so the week the survey was conducted is included in 9 variables that are named as occps where p is the primary session (year) number and s is the secondary session (visit) number. Using data(RDOccupancy) will retrieve the completed dataframe and using example(RDOccpancy) will run the example code. However, in this example we also show how to import the raw data and how they were modified to construct the RDOccupancy dataframe.
这是一个假想的情况与35个独立的“网站”上的繁殖鸟类的存在/不存在被记录3次,连续3年,每年的模拟数据。影响网站占用的潜在变量的网站公顷(samplearea)的植被覆盖度(盖)的大小。在一年内的调查的定时被认为影响占用检测,所以被包括在该调查的周9个变量,被命名为occps其中p是主会话数(年),和s是次级会话(访问)的数量。使用data(RDOccupancy)将检索的完成数据框,并使用example(RDOccpancy)运行的示例代码。然而,在这个例子中,我们还将展示如何导入原始数据,以及他们是如何修改,以构建RDOccupancy数据框。

For this example, the raw data are shown below and the code below assumes the file is named RD_example.txt.
在这个例子中,原始数据被如下所示,下面的代码假定该文件名为RD_example.txt。


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



Bret Collier




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



data(RDOccupancy)
#[]
# Example of epsilon=1-gamma[ε= 1-γ的例子]
test_proc=process.data(RDOccupancy,model="RDOccupEG",time.intervals=c(0,0,1,0,0,1,0,0))
test_ddl=make.design.data(test_proc)
test_ddl$Epsilon$eps=-1
test_ddl$Gamma$eps=1
p.dot=list(formula=~1)
Epsilon.random.shared=list(formula=~-1+eps, share=TRUE)
model=mark(test_proc,test_ddl,model.parameters=list(Epsilon=Epsilon.random.shared, p=p.dot))
#[]
# A self-contained function for evaluating a set of user-defined candidate models[甲自足功能评估用户定义的候选模型的一组]
run.RDExample=function()
{
# Creating list of potential predictor variables for Psi[为PSI的潜在预测变量创建列表]

Psi.area=list(formula=~samplearea)
Psi.cover=list(formula=~cover)
Psi.areabycover=list(formula=~samplearea*cover)
Psi.dot=list(formula=~1)
Psi.time=list(formula=~time)

# Creating list of potential predictor variables for p[创建列表的潜在预测变量为P]
# When coding formula with session-dependent (primary or secondary)[当编码公式依赖于会话(初级或次级)]
# covariates, you do NOT have to include the session identifiers ([协变量,你没有包括会话标识符(]
# the ps of occps) in the model formula. You only need to specify ~occ.[PS的occps)模型中的公式。你只需要指定~OCC。]
# The variable suffix can be primary occasion numbers or[变量后缀可以是原发的场合号或]
# primary and secondary occasion numbers.[小学和中学的场合号码。]

p.dot=list(formula=~1)
p.occ=list(formula=~occ)
p.area=list(formula=~sample.area)
p.coverbyocc=list(formula=~occ*cover)

# Creating list of potential predictor variables for Gamma[创建列表的潜在预测变量的伽玛]
# and/or Epsilon (depending on which RDOccupXX Parameterization is used)[和/或小量(取决于使用RDOccupXX参数)]

gam.area=list(formula=~samplearea)
epsilon.area=list(formula=~samplearea)
gam.dot=list(formula=~1)
epsilon.dot=list(formula=~1)

# setting time intervals for 3 primary sessions with[设定的时间间隔为3个主要环节]
# secondary session length of 3,3,3[二次预计3,3,3]

time_intervals=c(0,0,1,0,0,1,0,0)

# Initial data processing for RMARK RDOccupPG[初始数据处理RMARK RDOccupPG]
# (see RMARK appendix C-3 for list of RDOccupXX model paramterizations)[(见RMARK附录C-3的列表RDOccupXX模型paramterizations)]

RD_process=process.data(RDOccupancy, model="RDOccupPG",
time.intervals=time_intervals)
RD_ddl=make.design.data(RD_process)
# Candidate model list[候选机型列表]
# 1. Occupancy, detection, and colonization are constant[1。占用,检测和殖民化是不变的]

model.p.dot.Psi.dot.gam.dot<-mark(RD_process, RD_ddl,
model.parameters=list(p=p.dot, Psi=Psi.dot, Gamma=gam.dot),
invisible=TRUE)

# 2. Occupancy varies by time, detection is constant,[2。入住不同的时间,检测是恒定的,]
# colonization is constant[定植是恒定的]

model.p.dot.Psi.time.gam.dot<-mark(RD_process, RD_ddl,
model.parameters=list(p=p.dot, Psi=Psi.time, Gamma=gam.dot),
invisible=TRUE)

# 3. Occupancy varies by area, detection is constant,[3。入住不同的区域,检测是恒定的,]
# colonization varies by area[定植不同的区]

model.p.dot.Psi.area.gam.area<-mark(RD_process,
RD_ddl, model.parameters=list(p=p.dot, Psi=Psi.area,
Gamma=gam.area), invisible=TRUE)

# 4. Occupancy varies by cover, detection is constant,[4。入住不同的封面,检测是恒定的,]
# colonization varies by area[定植不同的区]

model.p.dot.Psi.cover.gam.area<-mark(RD_process, RD_ddl,
model.parameters=list(p=p.dot, Psi=Psi.cover, Gamma=gam.area),
invisible=TRUE)

# 5. Occupancy is constant, detection is session dependent,[5。出租率是恒定的,检测会话相关的,]
# colonization is constant[定植是恒定的]

model.p.occ.Psi.dot.gam.dot<-mark(RD_process, RD_ddl,
model.parameters=list(p=p.occ, Psi=Psi.dot, Gamma=gam.dot),
invisible=TRUE)

# 6. Occupancy varied by area, detection is session[6。入住不同的区域,检测会话]
# dependent, colonization is constant[依赖是恒定的,殖民]
model.p.occ.Psi.area.gam.dot<-mark(RD_process, RD_ddl,
model.parameters=list(p=p.occ, Psi=Psi.area, Gamma=gam.dot),
invisible=TRUE)
#[]
# Return model table and list of models[回归模型的表格和列表的车型]
#[]
return(collect.models())
}
# This runs the 6 models above-Note that if you use[运行上述需要注意的是,如果你使用的6款车型]
# invisible=FALSE in the above model calls[无形= FALSE在上述模型调用]
# then the mark.exe prompt screen will show as each model is run.[然后的mark.exe提示屏幕将显示每个模型的运行。]

robustexample&lt;-run.RDExample() #This runs the 6 models above[这将运行上面的6款车型]

# Outputting model selection results[输出模式选择]
robustexample         # This will print selection results[这将打印评选结果]
options(width=150)        # Sets page width to 100 characters[设置页面的宽度为100个字符]
sink("results.table.txt") # Captures screen output to file[捕获屏幕输出到文件]

# Remove comment to see output[删除评论看输出]
#print.marklist(robustexample) # Sends output to file[print.marklist(robustexample)#将输出发送到文件]
sink() # Returns output to screen[返回输出到屏幕]
#[]
# Allows you to view results in notepad;remove # to see output[允许您查看结果在记事本中删除#看到输出]
# system("notepad results.table.txt", invisible=FALSE, wait=FALSE)[(“记事本results.table.txt”,无形= FALSE,等待= FALSE)]

# Examine the output for Model 1: Psi(.), p(.), Gamma(.)[检查输出模式1:PSI(。),P(),γ()。]
# Opens MARK results file in text editor[在文本编辑器中打开的MARK成果文件]
#robustexample$model.p.dot.Psi.dot.gam.dot[robustexample $ model.p.dot.Psi.dot.gam.dot]

# View beta estimates for specified model in R[测试为指定的模型估计在R]
robustexample$model.p.dot.Psi.dot.gam.dot$results$beta

# View real estimates for specified model in R[查看实时指定模型的估计在R]
robustexample$model.p.dot.Psi.dot.gam.dot$results$real

# Examine the best fitting model which has a time-dependent[检查最佳拟合模型具有一个随时间变化的]
# effect on detection[在检测的影响]
# (Model 5: Psi(.), p(occ), Gamma(.))[(型号:PSI(。),P(OCC),γ(。))]

# View beta estimates for specified model in R[测试为指定的模型估计在R]
robustexample$model.p.occ.Psi.dot.gam.dot$results$beta

# View real estimates for specified model in R[查看实时指定模型的估计在R]
robustexample$model.p.occ.Psi.dot.gam.dot$results$real

# View estimated variance/covariance matrix in R[估计方差/协方差矩阵R中]
robustexample$model.p.occ.Psi.dot.gam.dot$results$beta.vcv


# View model averages estimates for session-dependent[模型的平均预测为会话相关的]
# detection probabilities[检测概率]
model.average(robustexample, "p", vcv=TRUE)

# View model averaged estimate for Psi (Occupancy)[查看模型的平均估计为PSI(入住)]
model.average(robustexample, "Psi", vcv=TRUE)

# View model averaged estimate for Gamma (Colonization)[查看模型的平均估计的伽玛(殖民)]
model.average(robustexample, "Gamma", vcv=TRUE)

#[]
# Compute real estimates across the range of covariates[在整个范围内的协变量,计算实际的估计]
# for a specific model parameter using Model 6[对于一个特定的模型参数,模型6]
#[]
# Identify indices we are interested in predicting[我们有兴趣在预测的识别指标]
# see covariate.predictions for information on[看到covariate.predictions信息]
# index relationship to real parameters[实际参数的指数的关系]

summary.mark(robustexample$model.p.occ.Psi.area.gam.dot, se=TRUE)
# Define data frame of covariates to be used for analysis[定义的数据框的协变量可以用于分析]

ha<-sort(RDOccupancy$samplearea)

# Predict parameter of interest (Psi) across the[预测感兴趣的参数(PSI)在整个]
# range of covariate data of interest[协数据范围]

Psi.by.Area<-covariate.predictions(robustexample,
data=data.frame(samplearea=ha), indices=c(1))

# View dataframe of real parameter estimates without var-cov[VAR-CoV的的实际参数估计没有查看数据框]
# matrix printing (use str(Psi.by.Area) to evaluate structure))[点阵打印(使用的STR(Psi.by.Area),以评估结构))]

Psi.by.Area[1]

#Create a simple plot using plot() and lines()[创建一个简单的图图()和线()]

plot(Psi.by.Area$estimates$covdata, Psi.by.Area$estimates$estimate,
type="l", xlab="Patch Area", ylab="Occupancy", ylim=c(0,1))
lines(Psi.by.Area$estimates$covdata, Psi.by.Area$estimates$lcl, lty=2)
lines(Psi.by.Area$estimates$covdata, Psi.by.Area$estimates$ucl, lty=2)

# For porting graphics directly to file, see pdf() or png(),[用于移植的图形直接到文件,看pdf()或png()]



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


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

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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