「ks」パッケージと「rgl」パッケージを使用して、3D カーネル密度推定とこれらの 3D プロットを作成しました。この最初の部分はうまくいきました (以下の簡単な例)。私が理解できないのは、最初にカーネルを構築するために使用された特定の xyz 位置のカーネルの値を抽出できるかどうかです。つまり、「ラスター」パッケージで 2D サーフェスに使用される抽出コマンドと同様に、3D プロット内のポイントの値を抽出します。誰かが私を正しい方向に向けることができるこのようなことをした経験がありますか? どうもありがとう。-DJ
library("rgl")
library("ks")
# call the plug-in bandwidth estimator
H.pi <- Hpi(b,binned=TRUE) ## b is a matrix of x,y,z points
# calculate the kernel densities
fhat2 <- kde(b, H=H.pi)
#plot the 50% and 95% kernels in gray and blue
plot(fhat2,cont=c(50,95),colors=c("gray","blue"),drawpoints=TRUE
,xlab="", ylab="", zlab="",size=2, ptcol="white", add=FALSE, box=TRUE, axes=TRUE)
#Structure of fhat2. Original df consists of ~6000 points.
List of 9
$ x : num [1:6173, 1:3] -497654 -497654 -497929 -498205 -498205 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:6173] "50" "57" "70" "73" ...
.. ..$ : chr [1:3] "x" "max_dep" "y"
$ eval.points:List of 3
..$ : num [1:51] -550880 -546806 -542733 -538659 -534586 ...
..$ : num [1:51] -7.9 -4.91 -1.93 1.06 4.05 ...
..$ : num [1:51] -376920 -374221 -371522 -368823 -366124 ...
$ estimate : num [1:51, 1:51, 1:51] 0 0 0 0 0 ...
$ H : num [1:3, 1:3] 3.93e+07 -2.97e+03 8.95e+06 -2.97e+03 2.63e+01 ...
$ gridtype : chr [1:3] "linear" "linear" "linear"
$ gridded : logi TRUE
$ binned : logi FALSE
$ names : chr [1:3] "x" "max_dep" "y"
$ w : num [1:6173] 1 1 1 1 1 1 1 1 1 1 ...
- attr(*, "class")= chr "kde"