[R] superimpose density line over hist

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Tue Dec 13 15:34:42 CET 2005


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



----- Original Message ----- 
From: "Albert Vilella" <avilella at gmail.com>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, December 13, 2005 2:23 PM
Subject: [R] superimpose density line over hist


> 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 at 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




More information about the R-help mailing list