sm.density.compare(), density().
sm.density.compare() . , , .
:
group.index <- rep(1:3, c(length(x), length(y), length(z)))
den <- sm.density.compare(c(x,y,z), group = group.index, model = "equal")

model = "equal", sm.density.compare() . str(den):
List of 4
$ p : num 0
$ estimaate : num [1:3, 1:50] 2.37e-07 3.81e-06 6.06e-10 2.17e-06 2.26e-05 ...
$ eval.points: num [1:50] -4.12 -3.94 -3.76 -3.58 -3.4 ...
$ h : num 0.376
h , , eval.points , estimaate - . ( , "", "", LOL).
sm, sm. ..., sm.options. ?sm.options, , , , ..
. , sm.density.compare() . :
den2 <- sm.density.compare(c(x,y), group = rep(1:2, c(length(x), length(y))),
model = "equal")

> str(den2)
List of 6
$ p : num 0.22
$ estimate : num [1:2, 1:50] 4.92e-06 2.70e-05 2.51e-05 1.00e-04 1.09e-04 ...
$ eval.points: num [1:50] -4.12 -3.94 -3.76 -3.58 -3.4 ...
$ upper : num [1:50] 0.00328 0.00373 0.00459 0.00614 0.00886 ...
$ lower : num [1:50] 0 0 0 0 0 ...
$ h : num 0.44
lower upper / .
density(), sm.density.compare()
xlim <- range(x, y, z)
dx <- density(x, from = xlim[1], to = xlim[2], n = 200)
dy <- density(y, from = xlim[1], to = xlim[2], n = 200)
dz <- density(z, from = xlim[1], to = xlim[2], n = 200)
. "" , :
> str(dx)
List of 7
$ x : num [1:200] -2.64 -2.61 -2.58 -2.55 -2.52 ...
$ y : num [1:200] 0.023 0.026 0.0291 0.0323 0.0356 ...
$ bw : num 0.31
$ n : int 100
$ call : language density.default(x = x, n = 200, from = xlim[1], to = xlim[2])
$ data.name: chr "x"
$ has.na : logi FALSE
- attr(*, "class")= chr "density"
x - , y - , bw - . , dx$bw, dy$bw dz$bw , . density() bw, bw. . ?density, .
, , .
ylim <- range(dx$y, dy$y, dz$y)
plot(dx$x, dx$y, col = 1, lwd = 2, type = "l", xlim = xlim, ylim = ylim)
lines(dy$x, dy$y, col = 2, lwd = 2)
lines(dz$x, dz$y, col = 3, lwd = 2)
