SORU
30 EYLÜL 2009, ÇARŞAMBA


Uydurma R histogram için yoğunluk eğrisi

Bir histogram eğrisi uyan R bir fonksiyon var mı?

Hadi aşağıdaki histogram var diyelim

hist(c(rep(65, times=5), rep(25, times=5), rep(35, times=10), rep(45, times=4)))

Normal görünüyor, ama çarpık. Bu histogram etrafında sarmak için çarpık normal bir eğriye uyacak şekilde istiyorum.

Bu soru oldukça basit, ama R için cevap internette bulamadım.

CEVAP
30 EYLÜL 2009, ÇARŞAMBA


Eğer sorunuzu doğru anladıysam, o zaman muhtemelen histogram ile birlikte yoğunluğu bir tahmin istiyorum:

X <- c(rep(65, times=5), rep(25, times=5), rep(35, times=10), rep(45, times=4))
hist(X, prob=TRUE)            # prob=TRUE for probabilities not counts
lines(density(X))             # add a density estimate with defaults
lines(density(X, adjust=2), lty="dotted")   # add another "smoother" density

Uzun süre sonra Edit:

Burada biraz daha giyinmiş bir versiyonu:

X <- c(rep(65, times=5), rep(25, times=5), rep(35, times=10), rep(45, times=4))
hist(X, prob=TRUE, col="grey")# prob=TRUE for probabilities not counts
lines(density(X), col="blue", lwd=2) # add a density estimate with defaults
lines(density(X, adjust=2), lty="dotted", col="darkgreen", lwd=2) 

birlikte ürettiği grafik:

enter image description here

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • bobono1baby

    bobono1baby

    14 AĞUSTOS 2011
  • PlayStation

    PlayStation

    16 Aralık 2005
  • TV nEW

    TV nEW

    25 AĞUSTOS 2012