[R] Separating out data values

Peter Ehlers ehlers at ucalgary.ca
Sun Jul 4 23:42:59 CEST 2010


On 2010-07-04 5:29, Mark Carter wrote:
> I'm not very good at statistics, but I know enough to be dangerous. I'm completely new to R, having just discovered it yesterday. Now that the introductions are out of the way ...
>
> I have a table with three columns, only two of which are relevant to the discussion: roe0 and roe1. Plotting roe0 against roe1 shows that there is a convincing correlation between them, and is confirmed by the correlation coefficient. So far, so good. What I'd like to do is answer the question: what is the probability that roe1 is above the median (of roe1) given that roe0 is above the median (of roe0). Is there a simple way of doing this in R?
>

It might be dangerous to just give the answer,
so I'll provide a hint:

Since you know how to plot the data:

  plot(roe1, roe0)
  abline(v = median(roe1), h = median(roe0))

Now start counting points in the relevant quadrants.
Getting R to count the points is left as an exercise
(which should be easy after working through An
Introduction to R).

   -Peter Ehlers



More information about the R-help mailing list