[R] Shading area under PDF of t -distribution
Dimitris Rizopoulos
Dimitris.Rizopoulos at med.kuleuven.be
Fri Nov 2 10:41:56 CET 2007
try this:
curve(dt(x, 74), from = -4, to = 4)
x <- seq(-1.96, 1.96, len = 100)
y <- dt(x, 74)
polygon(c(x[1], x, x[100]), c(dt(-4, 74), y, dt(4, 74)),
col = "red", border = NA)
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://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
Quoting Chung-hong Chan <chainsawtiney at gmail.com>:
> Dear R experts,
>
> I have plot the PDF of t distribution with df = 74.
> curve(dt(x,df=74),from=-4, to=4)
>
> how can I shade the area under curve (for example, col="red") from
> t=+- 1.996?
>
> Thank you.
> Regards,
> CH
>
> --
> CH Chan
> Research Assistant - KWH
> http://www.macgrass.com
>
> ______________________________________________
> 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.
>
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the R-help
mailing list