Learn R Programming

Publish (version 2017.10.24)

plot.ci: Plot confidence intervals

Description

Function to plot confidence intervals

Usage

# S3 method for ci
plot(x, y.offset = 0, y.title.offset = 1.3, lower, upper,
  labels, title.labels, values, title.values, factor.reference.pos,
  factor.reference.label = "Reference", pch = 16, cex = 1, lwd = 2,
  col = 1, xlim, ylim, ylab, xlab, automar = TRUE, leftmargin = 0.25,
  rightmargin = 0.25, labels.colintersp = 1, digits = 1, format = NULL,
  shift = 0, add = FALSE, axes = TRUE, axis2 = FALSE, ...)

Arguments

x

Object containing point estimates and the corresponding confidence intervals

y.offset

Adjustment of position of confidence intervals and text on y-axis. When y.offset=0 the positions are integers between the number of intervals (upper most) and 1 (lowest interval).

y.title.offset

Vertical offset for title line

lower

lower confidence limits

upper

upper confidence limits

labels

labels

title.labels

title for label column

values

Logical: if TRUE show the values of the point estimates and confidence intervals on the graph

title.values

Label for the column (or row) of the values.

factor.reference.pos

Position of factor references.

factor.reference.label

Label to use at factor.reference.pos instead of value.

pch

Point type for point estimates

cex

Size of points

lwd

Line type for the confidence intervals

col

Color for confidence intervals and point estimates. Can be controlled separately via points.col and segments.col

xlim

Limit of the x-axis

ylim

Limit of the y-axis

ylab

Label for the x-axis

xlab

Label for the y-axis

automar

If TRUE set margin elements 2 and 4 of par()$mar based on string width of labels and values.

leftmargin

If automar is TRUE additional offset -- measured in margin lines -- which is added to left margin.

rightmargin

If automar is TRUE additional offset -- measured in margin lines -- which is added to right margin.

labels.colintersp

Interspace between label columns

digits

For rounding of values, passed to pubformat and print.ci

format

A string which indicates the format used for confidence intervals. The string is passed to formatCI with two arguments: the lower and the upper limit. For example '(l;u)' yields confidence intervals with round parenthesis in which the upper and the lower limits are separated by semicolon.

shift

Shift the whole graph shift units to the right if shift is positive and to the left if shift is negative. Useful for combining multiple plots.

add

If not FALSE add to an existing plot.

axes

if FALSE do not add axes

axis2

if FALSE do not y-axis

...

Used to transport arguments for the following subroutines: "plot", "points", "segments", "labels", "values", "title.labels", "title.values", "axis1", "axis2", "background".

Details

Function to plot means and other point estimates with confidence intervals

Examples

Run this code
# NOT RUN {
data(Diabetes)
x=ci.mean(bp.2s~frame,data=Diabetes)
# }
# NOT RUN {
plot(x, leftmargin=0, rightmargin=0)
plotConfidence(x, leftmargin=0, rightmargin=0)

data(CiTable)
with(CiTable,plotConfidence(x=list(HazardRatio),
                               lower=lower,
                               upper=upper,
                               labels=CiTable[,2:6],
                               factor.reference.pos=c(1,10,19),
                               format="(u-l)",
                               points.col="blue",
                               digits=2))

with(CiTable,Publish::plot.ci(x=list(HazardRatio),
                               lower=lower,
                               upper=upper,
                               labels=CiTable[,2:6],
                               factor.reference.pos=c(1,10,19),
                               format="(u-l)",
                               points.col="blue",
                               digits=2,
                               leftmargin=-2,
                               title.labels.cex=1.1,
                               labels.cex=0.8,values.cex=0.8))
# }

Run the code above in your browser using DataLab