# [R] hist(x, ...) with normal distribution curve

Knut Krueger Knut.Krueger at usa.com
Sun Sep 25 19:22:23 CEST 2005

```
Romain Francois schrieb:

>Do you want that :
>
>h<-hist(x,breaks=10,freq = TRUE)
>xfit<-seq(min(x),max(x),length=40)
>yfit<-dnorm(xfit,mean=mean(x),sd=sd(x))
>
>lines(xfit,yfit * 150 * (h\$breaks[2]-h\$breaks[1]))
>
>
>
>
Right thats what I want ... but does it make sense to fit the line with
a try and error multipier (150)

Is there no way to compute the frequency and the distribution line with
standardised function?
I used SPSS with the data from x<-5+rnorm(150)
Hit the graph-histogramm menue choosed: display normal curve and got the
result:
http://biostatistic.de/temp/spss1.jpg - just as easy as possible

So, they have any standardised function.
maybe it does not make sence, but i am not able to see why there is such
a esay to use function in SPSS but not in R
Maybe anybody is able to explane whiy

and my intention:
As a previous computer scientist I am trying to find a way to eleminate
SPSS an use R
Sure there is a big lack of my statistic knowledge - but the often the
SPSS user have similar lack  but it is easy to click and view instead to
try the similar steps in R
But if I am not able to find the steps in R for the common ..
"SPSS-clicks" , I will never be able to suggest R in the institute to
the people with mor statistical knowledge but no knowledge about
computer science ... and command line interpreter

Regards Knut

--
Viele Grüße
Knut Krüger
--

Reitpark Einthal

Leitung: 1 Tierarzt, 1 Berufsreiter
Homepage http://www.einthal.de

Eine fachgerechte Betreuung rund um die Uhr.

```