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

R语言 sparr包 bivariate.density()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 12:28:27 | 显示全部楼层 |阅读模式
bivariate.density(sparr)
bivariate.density()所属R语言包:sparr

                                         Bivariate kernel density estimates
                                         二元核密度估计

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

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

Provides an adaptive or fixed bandwidth kernel density estimate of bivariate data.
提供了一个变通的或者固定带宽核密度估计的二元数据。


用法----------Usage----------


bivariate.density(data, ID = NULL, pilotH, globalH = pilotH,
                  adaptive = TRUE, edgeCorrect = TRUE, res = 50, WIN = NULL,
                  counts = NULL, intensity = FALSE, xrange = NULL,
                  yrange = NULL, trim = 5, gamma = NULL, atExtraCoords = NULL,
                  use.ppp.methods = TRUE, comment = TRUE)



参数----------Arguments----------

参数:data
An object of type data.frame, list, matrix, or ppp giving the observed data from which we wish to calculate the density estimate. Optional ID information (e.g. a dichotomous indicator for cases and controls) may also be provided in these four data structures. See "Details" for further information on how to properly specify each one.  
类型的对象,data.frame,list,matrix或ppp给所观察到的数据,从中我们希望计算密度估计。可选的ID信息(例如,病例组和对照组的二分法指标),也可以设置在这些四个数据结构。请参阅“详细信息”的详细信息,如何正确地指定每一个。


参数:ID
If data is a data structure with a third component/column indicating case (1) or control (0) status, ID must specify which of these groups we wish to estimate a density for. If ID is NULL (default), a density is estimated for all present observations, regardless of any status information.  
如果data是一个数据结构,第三个组件/列表示的情况下(1)(0)状态或控制,ID必须指定这些群体,我们希望估计的密度。 ID如果是NULL(默认),密度估计本意见中,无论任何状态信息。


参数:pilotH
A single numeric, positive "smoothing parameter" or "bandwidth". When adaptive is TRUE (default), this value is taken to be the pilot bandwidth, used to construct the bivariate pilot density required for adaptive smoothing (see "Details"). For a fixed bandwidth kernel density estimate, pilotH simply represents the fixed amount of smoothing. Currently, all smoothing is isotropic in nature.  
一个单一的数字,积极的“平滑参数”或“带宽”。当adaptive是TRUE(默认值),这个值是采取试点带宽,用来建构二元所需的频密度自适应平滑(见“详细信息”)。对于一个固定的带宽核密度估计,pilotH简单地表示固定的平滑量。目前,所有的平滑是各向同性的。


参数:globalH
A single numeric, positive smoothing multiplier referred to as the global bandwidth, used to calculate the adaptive bandwidths (see "Details"). When adaptive is TRUE, this defaults to be the same as the pilot bandwidth. Ignored for a fixed density estimate.  
一个单一的数字,正面平滑乘数为全局带宽,用来计算的自适应带宽(见“详细信息”)。当adaptive是TRUE,则默认为先导的带宽是相同的。忽略一个固定的密度估计。


参数:adaptive
Boolean. Whether or not to produce an adaptive (variable bandwidth) density estimate, with the alternative being a fixed bandwith density estimate. Defaults to TRUE.  
布尔值。无论自适应(可变带宽)的密度估计,是一个固定的带宽密度估计的替代。默认为TRUE的。


参数:edgeCorrect
Boolean. Whether or not to perform edge-correction on the density estimate according to the methods demonstrated by Diggle (1985) (fixed bandwidth) and Marshall and Hazelton (2010) (adaptive). This can have a noticable effect on computation time in some cases. Defaults to TRUE. When adaptive = TRUE, the fixed-bandwidth pilot density is also edge-corrected according to edgeCorrect.  
布尔值。无论执行边修正的密度估计据Diggle(1985)(固定带宽)和马歇尔和黑泽尔顿(2010)(自适应)的方法表现出来。这在某些情况下,计算时间上可以有一个noticable效果。默认为TRUE的。当adaptive = TRUE,固定带宽的导频密度也是边缘校正根据edgeCorrect。


参数:res
A single, numeric, positive integer indicating the square root of the desired resolution of the evaluation grid. That is, each of the evaluation grid axes will have length res. Currently, only res*res grids are supported. Defaults to 50 for computational reasons.  
一个单一的,数字,正整数表示的评价网格所需的分辨率的平方根。也就是说,每个评价网格轴的长度res。目前,只有res*res电网的支持。计算的原因,默认为50。


参数:WIN
A polygonal object of class owin from the package spatstat giving the study region or "window". All functions in the package sparr that require knowledge of the specific study region make use of this class; no other method of defining the study region is currently supported. If no window is supplied (default), the function defines (and returns) it's own rectangular owin based on xrange and yrange. Ignored if data is an object of type ppp.  
类的多边形对象owin从包spatstat研究区域或窗口。包中的所有功能sparr需要知识的具体研究区域,利用这个类,没有任何其他方法确定的研究区域,目前支持。如果没有窗口(默认),函数定义,并返回它自己的矩形owin的基础上xrange和yrange。忽略,如果data是一个对象类型ppp。


参数:counts
To perform binned kernel estimation, a numeric, positive, integer vector of giving counts associated with each observed coordinate in data, if data contains unique observations. If NULL (default), the function assumes each coordinate in data corresponds to one observation at that point. Should the data being supplied to bivariate.density contain duplicated coordinates, the function computes the counts vector internally (overriding any supplied value for counts), issues a warning, and continues with binned estimation. Non-integer values are rounded to the nearest integer.  
要进行分级的核估计,一个数字的,积极的,给每个观测坐标,data与计数的整数向量,如果data含有独特的观察。如果NULL(默认),函数假定每个坐标data对应于一个观察在这一点上。如果data提供bivariate.density包含重复的坐标,函数计算内部计数矢量(覆盖所提供的任何counts),发出一个警告,并继续与分级估计值。非整数值四舍五入到最接近的整数。


参数:intensity
A boolean value indicating whether or not to return an intensity (interpreted as the the expected number of observations per unit area and integrating to the number of observations in the study region) function, rather than a density (integrating to one). Defaults to FALSE.  
的一个布尔值,该值指示是否返回一个强度(解释为预期数量的每单位面积的观测,并集成到研究区域中的观测值的个数)的函数,而不是集成到1)的密度(。默认为FALSE的。


参数:xrange
Required only when no study region is supplied (WIN = NULL) and data is not an object of class ppp, and ignored otherwise. A vector of length 2 giving the upper and lower limits of the estimation interval for the x axis, in which case an evenly spaced set of values of length res is generated.  
没有研究区域时,才需要提供(WIN = NULL)和data是不是一个对象类ppp,否则将被忽略。甲向量,长度为2的估计的时间间隔为x轴,在这种情况下,均匀地间隔开设置的值的长度res生成给予的上限和下限。


参数:yrange
As above, but for the y axis.  
如上所述,但在y轴上。


参数:trim
A numeric value (defaulting to 5) that prevents excessively large bandwidths in adaptive smoothing by trimming the originally computed bandwidths h by trim times median(h). A value of NA or a negative numeric value requests no trimming. Ignored when adaptive is FALSE.  
的数值(默认5),以防止过大的带宽自适应平滑修整原先计算的带宽h的trim倍median(H)。的值NA或负数值请求没有修剪。时忽略adaptive是FALSE。


参数:gamma
An optional positive numeric value to use in place of gamma for adaptive bandwidth calculation (see "Details"). For adaptive relative risk estimation, this value can sensibly be chosen as common for both case and control densities (such as the gamma value from the adaptive density estimate of the "pooled" (full) dataset) - see Davies and Hazelton (2010). If nothing is supplied (default), this value is computed from the data being used to estimate the density in the defined fashion (again, see "Details"). Ignored for fixed bandwidth estimation.  
可选的正数值代替使用gamma带宽自适应计算(见“详细信息”)。自适应相对风险估计,这个值可以理智地选择常见的两种情况下,控制密度(如gamma“汇集”(全)数据集的自适应密度估计值) - 见戴维斯和黑泽尔顿(2010年)。如果没有(默认),这从数据中定义的方式(再次被用来估计密度值的计算,请参阅“详细信息”)。固定带宽估计忽略。


参数:atExtraCoords
It can occasionally be useful to retrieve the values of the estimated density at specific coordinates that are not the specific observations or the exact grid coordinates, for further analysis or plotting. atExtraCoords allows the user to specify an additional object of type data.frame with 2 colums giving the x atExtraCoords[,1] and y atExtraCoords[,2] coordinates at which to calculate and return the estimated density and other statistics (see "Value").  
有时它可以是有用的检索值的估计密度在特定的坐标,而不是具体的观察或确切的网格坐标,以供进一步分析或绘图。 atExtraCoords允许用户指定一个额外的类型的对象data.frame2 colums给予的xatExtraCoords[,1]和yatExtraCoords[,2]在该坐标计算并返回的估计的密度和其他统计数据(见“价值”)。


参数:use.ppp.methods
Boolean. Whether or not to switch to using methods defined for objects of class ppp.object from the package spatstat to estimate the density. This approach is much, much faster than forcing bivariate.density to do the explicit calculations (due to implementation of a Fast Fourier Transform; see density.ppp) and is highly recommended for large datasets. To further reduce computation time in the adaptive case when use.ppp.methods = TRUE, the variable edge-correction factors are calculated using the integer percentiles of the varying bandwidths. Defaults to TRUE.  
布尔值。无论切换到使用的对象类中定义的方法ppp.object从包spatstat估计的密度。这种方法要快很多不是强迫bivariate.density做了明确的计算(由于执行快速傅立叶变换; density.ppp),并强烈建议用于大型数据集。为了进一步减少计算时间的适应情况下,当use.ppp.methods = TRUE,变量的边缘校正因素计算使用不同的带宽整数百分。默认为TRUE的。


参数:comment
Boolean. Whether or not to print function progress (including starting and ending times) during execution. Defaults to TRUE.  
布尔值。无论打印功能在执行过程中的进展(包括开始和结束的时间)。默认为TRUE的。


Details

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

This function calculates an adaptive or fixed bandwidth bivariate kernel density estimate, using the bivariate Gaussian kernel. Abramson's method is used for adaptive smoothing (Abramson, 1982). Suppose our data argumnent is a data.frame or matrix. Then for each observation data[i,1:2] (i = 1, 2, ... n), the bandwidth h[i] is given by  <br><br> h[i]=globalH / ( w(data[i,1:2]; pilotH)^(1/2)*gamma ) <br><br> where w is the fixed bandwidth pilot density constructed with bandwidth pilotH and the scaling parameter gamma is the geometric mean of the w^(-1/2) values. A detailed discussion on this construction is given in Silverman (1986).
此函数计算的适应或者固定带宽二元内核密度估计,使用二元高斯内核。艾布拉姆森的方法用于自适应平滑(艾布拉姆森,1982)。假设的data:argumnent是一个data.frame或matrix。然后,对于每个观测data[i,1:2](= 1,2,... n)的带宽h[i],给出的参考参考h[i]=globalH/ (W(data[i,1:2],pilotH)^(1/2)*gamma)参考参考,其中w是固定带宽的带宽pilotH构造的导频密度和缩放参数gamma是的w ^(-1 / 2)的值的几何平均值。在此建设西尔弗曼(1986)给出了详细的讨论。

If the data argument is a data.frame or a matrix, this must have exactly two columns containing the x ([,1]) and y ([,2]) data values, or exactly three columns with the third (rightmost) column giving ID information by way of a numeric, dichotomous indicator. Should data be a list, this must have two vector components of equal length named x and y. The user may specify a third component with the name ID giving the vector of corresponding ID information (must be of equal length to x and y). Alternatively, data may be an object of class ppp (see ppp.object). ID information can be stored in such an object through the argument marks. If data is a ppp object, the value of window of this object overrides the value of the argument WIN above.
如果data参数是一个data.frame或matrix,这必须有两列包含x([,1])和y([,2])的数据值,或完全与第三(最右边的)列给出的ID信息通过数值,二分法指示器的方式的三列。 data是list,这必须有两个长度相等的名为x和y矢量分量。用户可以指定一个第三个组成部分的名称ID给予相应的ID信息(必须是等长的向量x和y)。另外,data可能是类的一个对象ppp(见ppp.object)。 ID信息可以被存储在这样的目的通过参数marks。如果data是ppp对象,价值window这个对象的覆盖参数WIN以上的价值。


值----------Value----------

An object of class "bivden". This is effectively a list with the following components:
对象的类"bivden"。这是有效地与以下组件的列表:


参数:Zm
a numeric matrix giving the value of the estimated (edge-corrected if elected) density at each of the coordinates of the grid. Values corresponding to points on the grid that fall outside the study region WIN are set to NA
给出的值的估计(边缘校正如果当选)密度在每个网格的坐标数值矩阵。网格点的对应值,研究区域外的WIN设置为NA


参数:X
a the sequence of values that were used as x grid coordinates. Will have length res
的序列的值,被用来作为x网格坐标。的长度res


参数:Y
a the sequence of values that were used as y grid coordinates. Will have length res
被用来为y网格坐标的值的序列。的长度res


参数:kType
the kernel function used in estimation. Currently fixed at "gaus"
所用的内核函数的估计。目前固定在"gaus"


参数:h
a numeric vector with length equal to the number of observations, giving the bandwidths assigned to each observation in the order they appeared in data. For a fixed bandwidth estimate, this will simply be the identical value passed to and returned as pilotH
一个数值向量长度相等的若干意见,提供的带宽分配给每个观测的顺序出现在data。对于一个固定的带宽估计,这将是相同的值传递给返回的pilotH


参数:pilotH
the pilot or fixed bandwidth depending on whether adaptive smoothing is employed or not, respectively
驾驶员或固定带宽取决于是否采用自适应平滑与否,分别


参数:globalH
the global bandwidth globalH if adaptive smoothing is employed, NA for fixed smoothing
全球带宽globalH,如果采用自适应平滑,NA固定的平滑


参数:hypoH
the matrix of "hypothetical" bandwidths (with element placement corresponding to Zm) for each coordinate of the evaluation grid. That is, these values are the bandwidths at that grid coordinate if, hypothetically, there was an observation there (along with the original data). These are used for edge-correction in adaptive densities (Marshall and Hazelton, 2010). Will be NA for fixed bandwidth estimates
矩阵的每个坐标的评价网格的“假想”带宽(放置元件对应的Zm)。也就是说,这些值是在该网格中的带宽协调,假设,如果有一个观察(沿与原始数据)。这些都是用于边校正自适应密度(马歇尔和黑泽尔顿,2010)。将NA为固定带宽估计


参数:zSpec
a numeric vector with length equal to the number of observations used, giving the values of the density at the specific coordinates of the observations. Order corresponds to the order of the observations in data
一个数值向量,其长度等于所使用的观察到的数目,给人的密度的值在特定坐标的观测。命令对应的顺序的意见data


参数:zExtra
as zSpec for the observations in atExtraCoords, NA if atExtraCoords is not supplied
zSpec的意见atExtraCoords,NA如果atExtraCoords不提供


参数:WIN
the object of class owin used as the study region
类的对象owin作为研究区域


参数:qhz
a numeric matrix of the edge-correction factors for the entire evaluation grid (with placement corresponding to Zm. If edgeCorrect = FALSE, all edge correction factors are set to and returned as 1
如果Zm,所有的边缘校正因子设置为edgeCorrect = FALSE返回数值矩阵的整个评价网格的边缘校正因素(与放置对应1。


参数:qhzSpec
edge-correction factors for the individual observations; order corresponding to data
边缘的个别观测值的校正因子,订单对应的data


参数:qhzExtra
as qhzSpec for the observations in atExtraCoords; NA if atExtraCoords is not supplied
qhzSpec的意见atExtraCoords,NA如果atExtraCoords不提供


参数:pilotvals
the values of the pilot density used to compute the adaptive bandwidths. Order corresponds to the order of the observations in data. NULL when adaptive = FALSE
的导频密度的值用于计算自适应带宽。订购对应的顺序在data的意见。 NULLadaptive = FALSE


参数:gamma
the value of gamma that was passed to the function, or the geometric mean term of the reciprocal of the square root of the pilot density values used to scale the adaptive bandwidths if gamma is not supplied. NULL when adaptive = FALSE
gamma传递的功能,或几何平均期限gamma如果不提供用于扩展的自适应带宽的频密度值的平方根的倒数。 NULLadaptive = FALSE


参数:counts
the counts vector used in estimation of the density/intensity. If all values in data were unique and counts = NULL, the returned counts will be a vector of ones equal to the number of coordinates in data
的密度/强度的估计中使用的计数向量。如果所有的值在data是独特的和counts = NULL,返回counts将是一个向量的等于data对数坐标的


参数:data
a two-column numeric data frame giving the observations in the originally supplied data that were used for the density estimation. If data originally contained duplicated coordinates, the returned data will contain only the unique coordinates, and should be viewed with respect to the returned value of counts
一个两列的数字数据框的观察,在最初提供的data会被用于密度估计。如果data最初包含重复的坐标,返回的data将只包含独特的坐标,并应尊重的返回值counts的浏览


警告----------Warning----------

Explicit calculation of bivariate kernel density estimates is computationally expensive. The decision to produce adaptive over fixed bandwidth estimates, the size of the dataset, the evaluation grid resolution specified by res, the complexity of the study region and electing to edge-correct all have a direct impact upon the time it will take to estimate the density. Keeping use.ppp.methods = TRUE can drastically reduce this computational cost at the expense a degree of accuracy that is generally considered negligible for most practical purposes.
二元内核密度估计的显式计算是计算昂贵。在固定的带宽估计自适应的决定产生的数据集,评估网格分辨率,大小指定res,研究区域的复杂性和边缘正确的选择有直接的影响的时候它会估计的密度。保持use.ppp.methods = TRUE可以大大减少这种计算成本而牺牲了一定程度的精确度通常被认为是最实用的用途可以忽略不计。


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



T.M. Davies




参考文献----------References----------

Davies, T.M. and Hazelton, M.L. (2010), Adaptive kernel estimation of spatial relative risk, Statistics in Medicine, 29(23) 2423-2437.<br><br> Diggle, P.J. (1985), A kernel method for smoothing point process data, Journal of the Royal Statistical Society, Series C, 34(2), 138-147.<br><br> Marshall, J.C. and Hazelton, M.L. (2010) Boundary kernels for adaptive density estimators on regions with irregular boundaries, Journal of Multivariate Analysis, 101, 949-963.<br><br> Silverman, B.W. (1986), Density Estimation for Statistics and Data Analysis, Chapman &amp; Hall, New York. <br><br>

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


##Chorley-Ribble laryngeal cancer data ('spatstat' library)[#乔利的里布尔喉癌数据(“spatstat库)]
data(chorley)

ch.lar.density <- bivariate.density(data = chorley, ID = "larynx",
pilotH = 1.5, adaptive = FALSE)

plot(ch.lar.density, col = "lightblue", phi = 30, theta = -30,
ticktype = "detailed", main = "chorley.larynx", display = "persp")

## Not run: [#不运行:]

##PBC liver disease data[#PBC肝病数据]
data(PBC)
pbc.adaptive.density <- bivariate.density(data = PBC, ID = "case",
pilotH = 350)

#3D plot - may need to adjust size of RGL device. Hold left click[3D绘图 -  RGL设备的大小,可能需要调整。点击左侧举行]
# to pan, hold right to zoom.[平移,按住鼠标放大。]
plot(pbc.adaptive.density, display = "3d", col = heat.colors(20),
main = "Density of PBC in north-east England", aspect = 1:2)

## End(Not run)[#(不执行)]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-10 02:23 , Processed in 0.037962 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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