colext(unmarked)
colext()所属R语言包:unmarked
Fit the dynamic occupancy model of MacKenzie et. al (2003)
适合Mackenzie等的动态入住模型的。人(2003)
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Estimate parameters of the colonization-extinction model,
估计参数的的定植灭绝模式,
用法----------Usage----------
参数----------Arguments----------
参数:psiformula
Right-hand sided formula for the initial probability of occupancy at each site.
右手侧占用的初始概率公式在每个站点。
参数:gammaformula
Right-hand sided formula for colonization probability.
右手侧为殖民概率公式。
参数:epsilonformula
Right-hand sided formula for extinction probability.
右手侧的灭绝概率公式。
参数:pformula
Right-hand sided formula for detection probability.
右手侧检测概率公式。
参数:data
unmarkedMultFrame object that supplies the data (see unmarkedMultFrame).
unmarkedMultFrame对象提供的数据(见unmarkedMultFrame“)。
参数:starts
optionally, initial values for parameters in the optimization.
任选地,在优化的参数的初始值。
参数:method
Optimization method used by optim.
优化所使用的方法optim。
参数:se
logical specifying whether or not to compute standard errors.
逻辑指定是否计算标准误差。
参数:...
Additional arguments to optim, such as lower and upper bounds
其他参数OPTIM,如上限和下限
Details
详细信息----------Details----------
This function fits the colonization-extinction model of MacKenzie et al (2003). The colonization and extinction rates can be modeled with covariates that vary yearly at each site using a logit link. These covariates are supplied by special unmarkedMultFrame yearlySiteCovs slot. These parameters are specified using the gammaformula and epsilonformula arguments. The initial probability of occupancy is modeled by covariates specified in the psiformula.
此功能适合定植灭绝的麦肯齐等人(2003)的模型。殖民和灭绝率可以模拟不同的协变量每年每个站点使用logit的关联。这些的协变量提供的特别unmarkedMultFrame的yearlySiteCovs插槽。这些参数指定使用gammaformula和epsilonformula的参数。占用为蓝本的psiformula在指定的协变量的初始概率。
The conditional detection rate can also be modeled as a function of covariates that vary at the secondary sampling period (ie., repeat visits). These covariates are specified by the first part of the formula argument and the data is supplied via the usual obsCovs slot.
有条件的检出率也可以在二次采样周期(即,重复访问)不同的协变量的函数模型。这些协变量formula参数所指定的第一部分,并且该数据被提供通过一个常用的obsCovs插槽。
The projected and smoothed trajectories (Weir et al 2009) can be obtained from the smoothed.mean and projected.mean slots (see examples).
预测和平滑的轨迹(堰等人2009),可从smoothed.mean和projected.mean插槽(参见示例)。
值----------Value----------
unmarkedFitColExt object describing model fit.
描述模型拟合unmarkedFitColExt对象。
参考文献----------References----------
2003. Estimating site occupancy, colonization, and local extinction when a species is detected imperfectly. Ecology 84:2200–2207.
Northeastern States of the North American Amphibian Monitoring Program. Herpetological Conservation and Biology. 4(3):389-402.
参见----------See Also----------
nonparboot, unmarkedMultFrame, and formatMult
nonparboot,unmarkedMultFrame和formatMult
实例----------Examples----------
# Fake data[假数据]
R <- 4 # number of sites[一些网站]
J <- 3 # number of secondary sampling occasions[数量的二次抽样的场合]
T <- 2 # number of primary periods[主周期数]
y <- matrix(c(
1,1,0, 0,0,0,
0,0,0, 0,0,0,
1,1,1, 1,1,0,
1,0,1, 0,0,1), nrow=R, ncol=J*T, byrow=TRUE)
y
site.covs <- data.frame(x1=1:4, x2=factor(c('A','B','A','B')))
site.covs
yearly.site.covs <- list(
year = matrix(c(
'year1', 'year2',
'year1', 'year2',
'year1', 'year2',
'year1', 'year2'), nrow=R, ncol=T, byrow=TRUE)
)
yearly.site.covs
obs.covs <- list(
x4 = matrix(c(
-1,0,1, -1,1,1,
-2,0,0, 0,0,2,
-3,1,0, 1,1,2,
0,0,0, 0,1,-1), nrow=R, ncol=J*T, byrow=TRUE),
x5 = matrix(c(
'a','b','c', 'a','b','c',
'd','b','a', 'd','b','a',
'a','a','c', 'd','b','a',
'a','b','a', 'd','b','a'), nrow=R, ncol=J*T, byrow=TRUE))
obs.covs
umf <- unmarkedMultFrame(y=y, siteCovs=site.covs,
yearlySiteCovs=yearly.site.covs, obsCovs=obs.covs,
numPrimary=2) # organize data[组织数据]
umf # look at data[看数据]
summary(umf) # summarize[总结]
fm <- colext(~1, ~1, ~1, ~1, umf) # fit a model[拟合模型]
fm
# Real data[实时数据]
data(frogs)
umf <- formatMult(masspcru)
obsCovs(umf) <- scale(obsCovs(umf))
## Use 1/4 of data just for run speed in example[#使用1/4的数据,例如运行速度在]
umf <- umf[which((1:numSites(umf)) %% 4 == 0),]
## constant transition rates[#不变的升学率]
(fm <- colext(psiformula = ~ 1,
gammaformula = ~ 1,
epsilonformula = ~ 1,
pformula = ~ JulianDate + I(JulianDate^2), umf, control = list(trace=1, maxit=1e4)))
## get the trajectory estimates[#得到的轨迹估计。]
smoothed(fm)
projected(fm)
# Empirical Bayes estimates of number of sites occupied in each year[经验贝叶斯估计的网站数量在每年占用]
re <- ranef(fm)
modes <- colSums(bup(re, stat="mode"))
CI <- colSums(confint(re))
plot(1:7, modes, xlab="Year", ylab="Sites occupied", ylim=c(0, 70))
arrows(1:7, CI[1,], 1:7, CI[2,], code=3, angle=90, length=0.05)
## Not run: [#不运行:]
## Find bootstrap standard errors for smoothed trajectory[#查找引导标准误差为平滑的轨迹]
fm <- nonparboot(fm, B = 100) # This takes a while![这需要一段时间!]
fm@smoothed.mean.bsse
## End(Not run)[#(不执行)]
## Not run: [#不运行:]
## try yearly transition rates[#尝试每年的升学率。]
yearlySiteCovs(umf) <- data.frame(year = factor(rep(1:7, numSites(umf))))
(fm.yearly <- colext(psiformula = ~ 1,
gammaformula = ~ year,
epsilonformula = ~ year,
pformula = ~ JulianDate + I(JulianDate^2), umf,
control = list(trace=1, maxit=1e4)))
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|