Shift the normal curve to the top or near to the top of the histogram

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Shift the normal curve to the top or near to the top of the histogram

AbouEl-Makarim Aboueissa-3
Dear All:

One more thing.

I want to add the normal curve to the histogram. Is there away to stretch
the peak of the curve to the top of the histogram or at least near to the
top of the histogram.

Please see the code below.


Lizard.tail.lengths <- c(6.2, 6.6, 7.1, 7.4, 7.6, 7.9, 8, 8.3, 8.4, 8.5,
8.6,8.8, 8.8, 9.1, 9.2, 9.4, 9.4, 9.7, 9.9, 10.2, 10.4, 10.8,11.3, 11.9)

x<-seq(5,12, 0.001)

hist(Lizard.tail.lengths, main = "Normal Probability Plot of Lizard Tail
Lengths")

curve(dnorm(x ,mean=mean(Lizard.tail.lengths),sd=sd(Lizard.tail.lengths)),
add=TRUE, col=2, lwd = 2)



with many thanks
abou
______________________
AbouEl-Makarim Aboueissa, PhD
Professor of Statistics
Department of Mathematics and Statistics
University of Southern Maine

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Shift the normal curve to the top or near to the top of the histogram

Jim Lemon-4
Hi Abou,
Try this:

library(plotrix)
 curve(rescale(dnorm(x
,mean=mean(Lizard.tail.lengths),sd=sd(Lizard.tail.lengths)),
c(0,6)),add=TRUE, col=2, lwd = 2)

Jim


On Mon, Sep 25, 2017 at 9:35 AM, AbouEl-Makarim Aboueissa
<[hidden email]> wrote:

> Dear All:
>
> One more thing.
>
> I want to add the normal curve to the histogram. Is there away to stretch
> the peak of the curve to the top of the histogram or at least near to the
> top of the histogram.
>
> Please see the code below.
>
>
> Lizard.tail.lengths <- c(6.2, 6.6, 7.1, 7.4, 7.6, 7.9, 8, 8.3, 8.4, 8.5,
> 8.6,8.8, 8.8, 9.1, 9.2, 9.4, 9.4, 9.7, 9.9, 10.2, 10.4, 10.8,11.3, 11.9)
>
> x<-seq(5,12, 0.001)
>
> hist(Lizard.tail.lengths, main = "Normal Probability Plot of Lizard Tail
> Lengths")
>
> curve(dnorm(x ,mean=mean(Lizard.tail.lengths),sd=sd(Lizard.tail.lengths)),
> add=TRUE, col=2, lwd = 2)
>
>
>
> with many thanks
> abou
> ______________________
> AbouEl-Makarim Aboueissa, PhD
> Professor of Statistics
> Department of Mathematics and Statistics
> University of Southern Maine
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Shift the normal curve to the top or near to the top of the histogram

AbouEl-Makarim Aboueissa-3
Dear Jim:

Thank you very much

abou

On Sun, Sep 24, 2017 at 8:18 PM, Jim Lemon <[hidden email]> wrote:

> Hi Abou,
> Try this:
>
> library(plotrix)
>  curve(rescale(dnorm(x
> ,mean=mean(Lizard.tail.lengths),sd=sd(Lizard.tail.lengths)),
> c(0,6)),add=TRUE, col=2, lwd = 2)
>
> Jim
>
>
> On Mon, Sep 25, 2017 at 9:35 AM, AbouEl-Makarim Aboueissa
> <[hidden email]> wrote:
> > Dear All:
> >
> > One more thing.
> >
> > I want to add the normal curve to the histogram. Is there away to stretch
> > the peak of the curve to the top of the histogram or at least near to the
> > top of the histogram.
> >
> > Please see the code below.
> >
> >
> > Lizard.tail.lengths <- c(6.2, 6.6, 7.1, 7.4, 7.6, 7.9, 8, 8.3, 8.4, 8.5,
> > 8.6,8.8, 8.8, 9.1, 9.2, 9.4, 9.4, 9.7, 9.9, 10.2, 10.4, 10.8,11.3, 11.9)
> >
> > x<-seq(5,12, 0.001)
> >
> > hist(Lizard.tail.lengths, main = "Normal Probability Plot of Lizard Tail
> > Lengths")
> >
> > curve(dnorm(x ,mean=mean(Lizard.tail.lengths),sd=sd(Lizard.tail.
> lengths)),
> > add=TRUE, col=2, lwd = 2)
> >
> >
> >
> > with many thanks
> > abou
> > ______________________
> > AbouEl-Makarim Aboueissa, PhD
> > Professor of Statistics
> > Department of Mathematics and Statistics
> > University of Southern Maine
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>



--
______________________
AbouEl-Makarim Aboueissa, PhD
Professor of Statistics
Department of Mathematics and Statistics
University of Southern Maine

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Shift the normal curve to the top or near to the top of the histogram

Rui Barradas
In reply to this post by AbouEl-Makarim Aboueissa-3
Hello,

Try using hist argument 'prob = TRUE' or, which is equivalent, 'freq =
FALSE'.

hist(..., prob = TRUE)   # or hist(..., freq = FALSE)

This is because like this you will have a density, comparable to a
parametric density. Note that the peak of the normal will be outside the
plot area so you will have to adjust the plot area dimensions. In this
case I've set 'ylim = c(0, 0.35)'.


hist(Lizard.tail.lengths, main = "Normal Probability Plot of Lizard Tail
Lengths", ylim = c(0, 0.35), prob = TRUE)

curve(dnorm(x ,mean=mean(Lizard.tail.lengths),sd=sd(Lizard.tail.lengths)),
add=TRUE, col=2, lwd = 2)


Hope this helps,

Rui Barradas

Em 25-09-2017 00:35, AbouEl-Makarim Aboueissa escreveu:

> Dear All:
>
> One more thing.
>
> I want to add the normal curve to the histogram. Is there away to stretch
> the peak of the curve to the top of the histogram or at least near to the
> top of the histogram.
>
> Please see the code below.
>
>
> Lizard.tail.lengths <- c(6.2, 6.6, 7.1, 7.4, 7.6, 7.9, 8, 8.3, 8.4, 8.5,
> 8.6,8.8, 8.8, 9.1, 9.2, 9.4, 9.4, 9.7, 9.9, 10.2, 10.4, 10.8,11.3, 11.9)
>
> x<-seq(5,12, 0.001)
>
> hist(Lizard.tail.lengths, main = "Normal Probability Plot of Lizard Tail
> Lengths")
>
> curve(dnorm(x ,mean=mean(Lizard.tail.lengths),sd=sd(Lizard.tail.lengths)),
> add=TRUE, col=2, lwd = 2)
>
>
>
> with many thanks
> abou
> ______________________
> AbouEl-Makarim Aboueissa, PhD
> Professor of Statistics
> Department of Mathematics and Statistics
> University of Southern Maine
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.