On Dec 21, 2009, at 4:13 PM, Ted Harding wrote:

On 21-Dec-09 21:19:27, Marc Schwartz wrote:
On Dec 21, 2009, at 2:54 PM, Rice, Terri wrote:
Hi,
I have the following table of odds ratios (or), lower limits(ll) and
upper limits(ul), which I would like to plot as horizontal lines
beginning at the lower limit, ending at the upper limits and with a
dot at the odds ratio on an x-axis on a log10 scale. The y axis
would be the study sites.

From what I can figure out, it looks like the plotCI function will
do everything except give me an x-axis that is on a log10 scale and
I can't get the logaxis function in the log10 package to work.

Study   or      ll      ul      order
UCSF    0.7     0.55    0.89    1
MDA     0.76    0.71    0.93    2
UK      0.68    0.51    0.89    3
Mayo    0.5     0.28    0.87    4

Thanks for any suggestions!

Terri

Terri,
You can build your own easily, using plot() and then either arrows()
or segments() to create the CI boundary lines. Just use 'log = "x"' in
the call to plot to create the log scaled x axis.

Presuming that your data above are contained in a data frame called
'DF':

DF
  Study   or   ll   ul order
1  UCSF 0.70 0.55 0.89     1
2   MDA 0.76 0.71 0.93     2
3    UK 0.68 0.51 0.89     3
4  Mayo 0.50 0.28 0.87     4


# Get the range of values for the x axis
xlim <- with(DF, range(or - ll, or + ul))

xlim
[1] 0.05 1.69

# Plot the points. set the range of the x axis and set to log10 scale
plot(order ~ or, data = DF, xlim = xlim, pch = 19, log = "x")

# Add the CI's
with(DF, arrows(or - ll, order, or + ul, order, code = 3, angle = 90))

See ?arrows for help on the options for formatting the lines.

Alternatively, since it appears you are doing a meta-analysis of
sorts, you might want to look at the metaplot() and forestplot()
functions in Thomas Lumley's 'rmeta' package on CRAN.

HTH,
Marc Schwartz

While Marc was posting the above, I was working out an example
on just those lines! It is simply an illustration of how one
can proceed. Often, it is worth while constructing one's plot
"by hand", since then you can cook things exactly as you want
them (Haute Cuisine), rather than get served with what's been
prepared (Pizza Bar, even if it is a high-quality one).

<snip>

I nominate Ted's comments above for inclusion in the fortunes package.

Now...to the kitchen...that made me hungry... :-)

Regards,

Marc

______________________________________________
R-help@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.

Reply via email to