Thursday, March 24, 2011

R: how to plot histogram with normal density


histnorm = function(xx,...)
{
  h<-hist(xx, ...)
  xfit<-seq(min(xx),max(xx),length=40)
  yfit<-dnorm(xfit,mean=mean(xx),sd=sd(xx))
  yfit <- yfit*diff(h$mids[1:2])*length(xx)
  lines(xfit, yfit, col="blue", lwd=2)
}
from http://www.statmethods.net/graphs/density.html

1 comment:

  1. bash command line editing:

    set -o vi # for vi mode
    set -o emacs # for emacs mode

    Emacs command line editing cheat-sheet:
    http://www.scribd.com/doc/985254/Bash-Emacs-Editing-Mode-readline-Cheat-Sheet

    ReplyDelete

Subscribe via email

Enter your email address:

Delivered by FeedBurner

Followers

google analytics