如何改变密度图中R的核带宽

时间:2021-06-22 22:48:01

How do I see what bandwidth gets used for kernels in a density plot and how do I specify a bandwidth to be used? I tried

如何在密度图中看到内核使用的带宽以及如何指定要使用的带宽?我试着

ggplot(mtcars,aes(mpg))+geom_density(bw=1)

with no luck.

没有运气。

1 个解决方案

#1


8  

stat_geom utilises the adjust argument to apply a multiplier to the optimal bandwidth that ggplot calculates see documentation for density(). Try:

stat_geom使用调整参数将乘数应用到最优带宽上,ggplot计算参见密度()文档。试一试:

ggplot(mtcars,aes(mpg))+geom_density() + stat_density(adjust = 2)

ggplot(mtcars,aes(mpg))+geom_density() + stat_density(adjustment = 2)

I gather to determine the calculated optimal bandwidth - based on "the standard deviation of the smoothing kernel" - you'll need to interrogate Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. New York: Springer.

我收集以确定计算的最优带宽——基于“平滑核的标准偏差”——您将需要查询Venables, W. N.和Ripley, B. D.(2002)现代应用统计与纽约:施普林格。

#1


8  

stat_geom utilises the adjust argument to apply a multiplier to the optimal bandwidth that ggplot calculates see documentation for density(). Try:

stat_geom使用调整参数将乘数应用到最优带宽上,ggplot计算参见密度()文档。试一试:

ggplot(mtcars,aes(mpg))+geom_density() + stat_density(adjust = 2)

ggplot(mtcars,aes(mpg))+geom_density() + stat_density(adjustment = 2)

I gather to determine the calculated optimal bandwidth - based on "the standard deviation of the smoothing kernel" - you'll need to interrogate Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. New York: Springer.

我收集以确定计算的最优带宽——基于“平滑核的标准偏差”——您将需要查询Venables, W. N.和Ripley, B. D.(2002)现代应用统计与纽约:施普林格。