[R] Probabilities greather than 1 in HIST

Jonathan P Daily jdaily at usgs.gov
Thu Mar 3 16:43:48 CET 2011


If you read ?hist, you will answer your own question.

The issue in your code is the parameter prob = T, which does nothing. By 
default, hist reports density.
--------------------------------------
Jonathan P. Daily
Technician - USGS Leetown Science Center
11649 Leetown Road
Kearneysville WV, 25430
(304) 724-4480
"Is the room still a room when its empty? Does the room,
 the thing itself have purpose? Or do we, what's the word... imbue it."
     - Jubal Early, Firefly

r-help-bounces at r-project.org wrote on 03/03/2011 09:03:21 AM:

> [image removed] 
> 
> [R] Probabilities greather than 1 in HIST
> 
> jpmaroco 
> 
> to:
> 
> r-help
> 
> 03/03/2011 10:13 AM
> 
> Sent by:
> 
> r-help-bounces at r-project.org
> 
> Dear all,
> I am a newbie in R and could not find help on this problem. I am trying 
to
> plot an histogram with probabilities in the y axis. This is the code I 
am
> using:
> 
> #TLC uniform
> n=30
> mi=1; mx=6
> nrep=1000
> xbar=rep(0,nrep)
> for (i in 1:nrep) {xbar[i]=mean(runif(n,min=mi,max=mx))}
> hist(xbar,prob=TRUE,breaks="Sturges",xlim=c(1,6),main=paste("n =",n),
> xlab="Média", ylab="Probabilidade")
> curve(dnorm(x,mean=mean(xbar),sd=sd(xbar)),add=TRUE,lwd=2,col="red")
> 
> The problem is that I am getting greater than 1 probabilities in the Y 
axis?
> Is there a way to correct this?
> Many thanks in advance.
> Joao
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/
> Probabilities-greather-than-1-in-HIST-tp3333388p3333388.html
> Sent from the R help mailing list archive at Nabble.com.
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list