question on graphs and finding area under a curve
On Tue, 2005-08-02 at 18:20 +0530, Renuka Sane wrote:
Question on graphs: The default case for drawing a graph in R, is where a little space is left on the x and y axis before the first tick i.e. even if I say xlim=c(0,1) -- there will be some space between the edge of the x-axis and where 0 is placed. If I want 0 on the edge, how do I do it in R?
See ?par and take note of the 'xaxs' and 'yaxs' parameters. By default, these are set to 'r', where the axes are extended by 4% in each direction. Thus, set one or both parameters to 'i' to set the axes to exactly the ranges of xlim and/or ylim as you require.
Area under the curve: I have a 45 degree line and a curve above or below it. Is there a way in R to find the area between the two?
See Frank Harrell's somers2() function in the Hmisc package on CRAN. Among other things, it outputs a value "C", which is the AUC. HTH, Marc Schwartz