Movatterモバイル変換


[0]ホーム

URL:


statar

Matthieu Gomez

2025-07-23

stat_binmean

stat_binmean() is astat for ggplot2. Itreturns the mean ofy andx within bins ofx. It’s a bareborne version of the Stata commandbinscatter

ggplot(iris,aes(x = Sepal.Width ,y = Sepal.Length))+stat_binmean()

ggplot(iris,aes(x = Sepal.Width ,y = Sepal.Length,color = Species))+stat_binmean(n=10)

Sincestat_binmean is just a layer for ggplo2, you cansurimpose any model fit

ggplot(iris,aes(x = Sepal.Width ,y = Sepal.Length,color = Species))+stat_binmean(n=10)+stat_smooth(method ="lm",se =FALSE)


[8]ページ先頭

©2009-2025 Movatter.jp