我现在对R有些困难。
我有什么:
我需要什么:
答案 0 :(得分:0)
看看你是否可以在这个带有三角内核的基本密度函数的不同带宽规范示例的基础上构建:
data("faithful", package = "datasets")
x <- faithful$waiting
opar <- par(mfcol= c(2,2))
for (bw in c(3,6,12,18) ) {
hist(x, xlab = "Waiting interval", ylab = "Eruption Freq",
probability = TRUE, main = "Density plot: Triangular kernel",
border = "gray", sub= bquote("Bandwidth = "*.(bw) ) )
lines(density(x, width = bw, window = "triangular"), lty=3, col="red")
}
par(opar)