Learn R Programming

repmod (version 0.4.11)

coefplot: Plot of the coefficients of a model

Description

Creates a plot of the coefficients of a model.

Usage

coefplot(
  coefs,
  lwr.int = coefs,
  upper.int = coefs,
  offset = 0,
  coefnames = names(coefs),
  abline.pos = 0,
  sorted = FALSE,
  reverse = FALSE,
  pch = 16,
  xlim = c(min(lwr.int, na.rm = TRUE), max(upper.int, na.rm = TRUE)),
  ylim = c(1, length(coefs)),
  color = "black",
  ...
)

Value

A plot of the coefficients with their CI

Arguments

coefs

A vector with each coefficient

lwr.int

A vector with the lower end of the CI

upper.int

A vector with the upper end of the CI

offset

Y-axis offset for the coefficients

coefnames

Name for each variable

abline.pos

Position for the vertical reference line

sorted

Should the coefficients be sorted from highest to lowest?

reverse

Should the order be reversed?

pch

Type of point

xlim

Limits of the X-axis

ylim

Limits of the Y-axis

color

Color for the points

...

Further arguments passed to axis()

Examples

Run this code
lm1 <- lm(Petal.Length ~ Sepal.Width + Species, data=iris)
a<-report(lm1)
oldpar <- par()
par(mar=c(4, 10, 3, 2))
#Coefplot calling plot.reportmodel
plot(a)
par(mar=oldpar$mar)  #Restore old margin values
#Manual coefplot
coefplot(coefs=c(1, 2, 3), lwr.int=c(0, 1, 2), upper.int=c(5, 6, 7), coefnames=c("A", "B", "C"))

Run the code above in your browser using DataLab