kde2d(MASS)
kde2d()所属R语言包:MASS
Two-Dimensional Kernel Density Estimation
二维核密度估计
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Two-dimensional kernel density estimation with an axis-aligned bivariate normal kernel, evaluated on a square grid.
轴对齐二元正常内核评估,在方格的二维内核密度估计。
用法----------Usage----------
kde2d(x, y, h, n = 25, lims = c(range(x), range(y)))
参数----------Arguments----------
参数:x
x coordinate of data
x坐标数据
参数:y
y coordinate of data
y坐标数据
参数:h
vector of bandwidths for x and y directions. Defaults to normal reference bandwidth (see bandwidth.nrd). A scalar value will be taken to apply to both directions.
向量X和Y方向的带宽。默认正常参考带宽(见bandwidth.nrd)。一个标值将被应用到两个方向。
参数:n
Number of grid points in each direction. Can be scalar or a length-2 integer vector.
在每个方向上的网格点的数量。可以是标量或长度为2的整数向量。
参数:lims
The limits of the rectangle covered by the grid as c(xl, xu, yl, yu). </table>
矩形的范围覆盖由c(xl, xu, yl, yu)电网。 </ TABLE>
值----------Value----------
A list of three components.
三部分组成名单。
参数:x, y
The x and y coordinates of the grid points, vectors of length n.
网格点的X和Y坐标,长度n向量。
参数:z
An n[1] by n[2] matrix of the estimated density: rows correspond to the value of x, columns to the value of y. </table>
的n[1] n[2]矩阵的估计密度:对应的行的x值y,列的值。 </ TABLE>
参考文献----------References----------
Modern Applied Statistics with S. Fourth edition. Springer.
举例----------Examples----------
attach(geyser)
plot(duration, waiting, xlim = c(0.5,6), ylim = c(40,100))
f1 <- kde2d(duration, waiting, n = 50, lims = c(0.5, 6, 40, 100))
image(f1, zlim = c(0, 0.05))
f2 <- kde2d(duration, waiting, n = 50, lims = c(0.5, 6, 40, 100),
h = c(width.SJ(duration), width.SJ(waiting)) )
image(f2, zlim = c(0, 0.05))
persp(f2, phi = 30, theta = 20, d = 5)
plot(duration[-272], duration[-1], xlim = c(0.5, 6),
ylim = c(1, 6),xlab = "previous duration", ylab = "duration")
f1 <- kde2d(duration[-272], duration[-1],
h = rep(1.5, 2), n = 50, lims = c(0.5, 6, 0.5, 6))
contour(f1, xlab = "previous duration",
ylab = "duration", levels = c(0.05, 0.1, 0.2, 0.4) )
f1 <- kde2d(duration[-272], duration[-1],
h = rep(0.6, 2), n = 50, lims = c(0.5, 6, 0.5, 6))
contour(f1, xlab = "previous duration",
ylab = "duration", levels = c(0.05, 0.1, 0.2, 0.4) )
f1 <- kde2d(duration[-272], duration[-1],
h = rep(0.4, 2), n = 50, lims = c(0.5, 6, 0.5, 6))
contour(f1, xlab = "previous duration",
ylab = "duration", levels = c(0.05, 0.1, 0.2, 0.4) )
detach("geyser")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|