Re: [R] superimpose density line over hist

From: Dimitris Rizopoulos <dimitris.rizopoulos_at_med.kuleuven.be>
Date: Wed 14 Dec 2005 - 01:34:42 EST

try

hist(alnlength, prob = TRUE)

moreover I think that you do not need to sample from the Chi-squared to draw its density; you could use

dchisq(seq(...), 4))

instead.

I hope it helps.

Best,
Dimitris



Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium

Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm



> Hi all,
>
> I'm trying to superimpose a rchisq density line over a histogram
> with
> something like:
>
> hist(alnlength)
> lines(density(rchisq(length(alnlength), 4)),col="red")
>
> But the rchisq line won't appear anywhere,
>
> Anyone knows what I am missing here?
>
> Thanks in advance,
>
> Albert.
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Dec 14 02:26:47 2005

This archive was generated by hypermail 2.1.8 : Wed 14 Dec 2005 - 04:31:23 EST