sim.popn(secr)
sim.popn()所属R语言包:secr
Simulate 2-D Population
模拟2-D人口
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Simulate a Poisson process representing the locations of individual animals.
模拟的泊松过程,表示动物个体的位置。
用法----------Usage----------
sim.popn (D, core, buffer = 100, model2D = "poisson",
buffertype = "rect", poly = NULL, covariates =
list(sex = c(M = 0.5, F = 0.5)), number.from = 1,
Ndist = "poisson", nsession = 1, details = NULL,
seed = NULL, ...)
tile(popn, method = "reflect")
参数----------Arguments----------
参数:D
density animals / hectare (10 000 m\^2) (see Details for IHP case)
密度小动物/公顷(10万M \ ^ 2)(详见国际水文计划的情况下)
参数:core
data frame of points defining the core area
点的数据框定义的核心区
参数:buffer
buffer radius about core area
核心区缓冲区半径约
参数:model2D
character string for 2-D distribution ("poisson", "cluster", "IHP", "coastal")
2-D分配的字符串(“泊”,“聚类”,“国际水文计划”,“沿海”)
参数:buffertype
character string for buffer type
缓冲器类型的字符串
参数:poly
bounding polygon (see Details)
边界多边形(见详情)
参数:covariates
list of named covariates
命名的协变量列表
参数:number.from
integer ID for animal
动物的整数ID
参数:Ndist
character string for distribution of number of individuals
字符串的个体数量分布
参数:nsession
number of sessions to simulate
的会话数来模拟
参数:details
optional list with additional parameters
其他参数的可选列表
参数:seed
value for setting .Random.seed - either NULL or an integer
值进行设置。Random.seed - 无论是NULL或整数
参数:...
arguments passed to subset if poly is not NULL
参数传递给子集,如果聚不为NULL
参数:popn
popn object
POPN对象
参数:method
character string "reflect" or "copy"
字符串“反映”或“复制”
Details
详细信息----------Details----------
core must contain columns "x" and "y"; a traps object is suitable. For buffertype = "rect", animals are simulated in the rectangular area obtained by extending the bounding box of core by buffer metres to top and bottom, left and right. This box has area A.
core必须包含列x和Ytraps对象是合适的。 buffertype = "rect",动物模拟得到延伸的边界框的矩形区域corebuffer米的顶部和底部,左,右。此框区域A。
A notional random covariate "sex" is generated by default.
随机协的名义性是默认生成的。
Each element of covariates defines a categorical (factor) covariate with the given probabilities of membership in each class. No mechanism is provided for generating continuous covariates, but these may be added later (see Examples).
covariates的每一个元素定义了一个明确的(因素)协与给定的概率在每一个类的成员。产生连续协变量的机制尚未提供,但这些可能会增加(见例)。
Ndist may be "poisson" or "fixed". The number of individuals N has expected value DA. If DA is non-integer then Ndist = "fixed" results in N in { trunc(DA), trunc(DA)+1 } , with probabilities set to yield DA individuals on average.
Ndist可能是“泊”或“固定”。个人N预期值DA。如果DA非整数,然后Ndist =“固定”在N in { trunc(DA), trunc(DA)+1 } ,产生的DA个人平均概率。
If model2D = "cluster" then the simulated population approximates a Neyman-Scott clustered Poisson distribution. Ancillary parameters are passed as components of details: details$mu is the fixed number of individuals per cluster and details$hsigma is the spatial scale (sigma) of a 2-D kernel for location within each cluster. The algorithm is
如果model2D = "cluster"然后模拟的人口接近一奈曼 - 斯科特聚类泊松分布。辅助参数被传递组件details:$亩数是固定的,每个聚类的个人和细节hsigma的空间尺度(sigma)的2-D内核的位置在每个聚类的细节。该算法是
Determine the number of clusters (parents) as a random Poisson variate with lambda = DA/mu
确定的数字聚类(父母) lambda = DA/mu 一个随机泊松变数的
Locate each parent by drawing uniform random x- and y-coordinates
通过利用均匀分布的随机的X和Y坐标,找到每个父
Generate mu offspring for each parent and locate them by adding random normal error to each parent coordinate
生成亩为每个父的后代,并找到他们的加入随机错误,每个父坐标
Apply toroidal wrapping to ensure all offspring locations are inside the buffered area
应用环形的包装,以确保所有的后代的位置是缓冲区域内的
Function tile replicates a popn pattern by either reflecting or copying and translating it to fill a 3 x 3 grid.
函数tile复制popn的模式,通过反射或复制和翻译,以填补一个3×3格。
Toroidal wrapping is a compromise. The result is more faithful to the Neyman-Scott distribution if the buffer is large enough that only a small proportion of the points are wrapped.
环形的包装是一种妥协。如果缓冲区足够大,只有一小部分的点被包裹,结果是更忠实的奈曼 - 斯科特发行。
If model2D = "IHP" then an inhomogeneous Poisson distribution is simulated. core should be a habitat mask and D should be either a vector of length equal to the number of cells (rows) in core or the name of a covariate in core that contains cell-specific densities (animals / hectare), or a constant. The number of individuals in each cell is Poisson-distributed with mean DA where A is the cell area (an attribute of the mask). buffertype and buffer are ignored, as the extent of the population is governed entirely by the mask in core.
如果model2D = "IHP"那么非齐次泊松分布模拟。 core应该是一个栖息地的掩模和D应该是一个矢量的长度相等的单元数(行)在core或协变量的名称在core包含特定的单元密度(动物/公顷),或一个常数。在每个单元格中的个人的数量是泊松分布,平均DA其中A是社会的单元区域(属性的面膜)。 buffertype和buffer被忽略,就像程度的人口完全受到的面具core。
If model2D = "coastal" then a form of inhomogeneous Poisson distribution is simulated in which the x- and y-coordinates are drawn from independent Beta distributions. Default parameters generate the "coastal" distribution used by Fewster and Buckland (2004) for simulations of line-transect distance sampling (x ~ Beta(1, 1.5), y ~ Beta(5, 1), which places 50% of the population in the "northern" 13% of the rectangle). The four Beta parameters may be supplied in the vector component Beta of the "details" list (see Examples). The Beta parameters (1,1) give a uniform distribution. Coordinates are scaled to fit the limits of a sampled rectangle, so this method assumes buffertype = "rect".
如果model2D = "coastal"然后非齐次泊松分布的一种形式是,其中模拟的x坐标和y坐标绘制从独立Beta值分布。默认参数生成的沿海分布的Fewster和巴克兰(2004)的模拟样线距离取样(X~β(1,1.5),Y~50%的测试(5,1),其中地方人口中的“北”的矩形的13%)。 4个测试参数可以提供在“详细信息”列表中的矢量分量Beta值(见例)。测试参数(1,1)均匀分布。坐标的缩放到适合的采样矩形的限制,所以此方法假定buffertype =“正确的”。
If model2D = "hills" then a form of inhomogeneous Poisson distribution is simulated in which intensity is a sine curve in the x- and y- directions (density varies symmetrically between 0 and 2 x D along each axis). The number of hills in each direction (default 1) is determined by the "hills" component of the "details" list (e.g. details = list(hills=c(2,3)) for 6 hills). If either number is negative then alternate rows will be offset by half a hill. Displacements of the entire pattern to the right and top are indicated by further elements of the "hills" component (e.g. details = list(hills=c(1,1,0.5,0.5)) for 1 hill shifted half a unit to the top right; coordinates are wrapped, so the effect is to split the hill into the four corners). Negative displacements are replaced by runif(1). Density is zero at the edge when the displacement vector is (0,0) and rows are not offset.
如果model2D = "hills"然后非齐次泊松分布的一种形式,是在其中模拟强度是一个正弦曲线的x-和y-方向(沿每个轴的密度的变化,对称地在0和2 x深)。山在每个方向上的数量(默认为1),是由“小山”组成部分的“详细信息”列表中(例如有关列表(丘陵= C(2,3))6山)。如果任一数字为负,则交替行会抵消一半一座小山上。位移的整个图案的右和顶部所指示进一步元素山丘分量(例如细节=列表(丘陵= C(1,1,0.5,0.5)),1山半单位转移到右上角的坐标包裹,这样的效果是分裂进山的四角)。负位移者runif(1)所取代。密度为零时的位移矢量为(0,0)的边缘处和行不偏移。
If poly is specified, points outside poly are
如果poly指定点外poly
a matrix or dataframe
一个矩阵或数据框
a SpatialPolygonsDataFrame object as defined in the package "sp", possibly
一个的SpatialPolygonsDataFrame对象中定义的“SP”的包,可能
The subset method is called internally when poly is used; the ... argument may be used to pass values for keep.poly and poly.habitat.
subset方法被调用时内部poly使用的...参数可用于传递值keep.poly和poly.habitat。
The random number seed is managed as in simulate.lm.
随机数种子管理作为在simulate.lm。
值----------Value----------
An object of class "popn", a data frame with columns "x" and "y". Rows correspond to individuals. Individual covariates (optional) are stored as a data frame attribute. The initial state of the R random number generator is stored in the "seed" attribute.
对象类的POPN,列x和y的一个数据框。行对应于个人。个人的协变量(可选)被存储为一个数据框的属性。的R的随机数发生器的初始状态被存储在“种子”的属性。
注意----------Note----------
Other buffertypes will be defined later
其他buffertypes将被定义后
参考文献----------References----------
sampling estimators. In: S. T. Buckland, D. R. Anderson, K. P. Burnham, J. L. Laake, D. L. Borchers and L. Thomas (eds) Advanced distance sampling. Oxford University Press, Oxford, U. K. Pp. 281–306.
参见----------See Also----------
popn, plot.popn,
popn,plot.popn,
实例----------Examples----------
temppop <- sim.popn (D = 10, expand.grid(x = c(0,100), y =
c(0,100)), buffer = 50)
## plot, distinguishing "M" and "F"[#图,区分“M”和“F”]
plot(temppop, pch = 1, cex= 1.5,
col = c("green","red")[covariates(temppop)$sex])
## add a continuous covariate[#添加一个连续的协变量]
## assumes covariates(temppop) is non-null[#假设协变量(temppop)非空]
covariates(temppop)$size <- rnorm (nrow(temppop), mean = 15, sd = 3)
summary(covariates(temppop))
## Neyman-Scott cluster distribution[#奈曼 - 斯科特聚类分布]
oldpar <- par(xpd = TRUE, mfrow=c(2,3))
for (h in c(5,15))
for (m in c(1,4,16)) {
temppop <- sim.popn (D = 10, expand.grid(x = c(0,100),
y = c(0,100)), model2D = "cluster", buffer = 100,
details = list(mu = m, hsigma = h))
plot(temppop)
text (50,230,paste(" mu =",m, "hsigma =",h))
}
par(oldpar)
## Inhomogeneous Poisson distribution[#非齐次泊松分布]
xy <- secrdemo.0$mask$x + secrdemo.0$mask$y - 900
tempD <- xy^2 / 1000
plot(sim.popn(tempD, secrdemo.0$mask, model2D = "IHP"))
## Coastal distribution in 1000-m square, homogeneous in[#海岸,均匀的分布在1000米的正方形]
## x-direction[#x-方向]
arena <- data.frame(x = c(0, 1000, 1000, 0),
y = c(0, 0, 1000, 1000))
plot(sim.popn(D = 5, core = arena, buffer = 0, model2D =
"coastal", details = list(Beta = c(1, 1, 5, 1))))
## Hills[#山]
plot(sim.popn(D = 100, core = arena, model2D = "hills",
buffer = 0, details = list(hills = c(-2,3,0,0))),
cex = 0.4)
## tile demonstration[#瓷砖示范]
pop <- sim.popn(D = 100, core = make.grid(), model2D = "coastal")
par(mfrow = c(1,2), mar = c(2,2,2,2))
plot(tile(pop, "copy"))
polygon(cbind(-100,200,200,-100), c(-100,-100,200,200),
col = "red", density = 0)
title("copy")
plot(tile(pop, "reflect"))
polygon(cbind(-100,200,200,-100), c(-100,-100,200,200),
col = "red", density = 0)
title("reflect")
## Not run: [#不运行:]
## simulate from inhomogeneous fitted density model[#从非齐次装密度模型模拟]
regionmask <- make.mask(traps(possumCH), type = 'polygon',
spacing = 20, poly = possumremovalarea)
dsurf <- predictDsurface(possum.model.Dh2, regionmask)
possD <- covariates(dsurf)$D.0
posspop <- sim.popn(D = possD, core = dsurf, model = "IHP")
plot(regionmask, dots = FALSE, ppoly = FALSE)
plot(posspop, add = TRUE, frame = FALSE)
plot(traps(possumCH), add = TRUE)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|