Printing and plotting methods for Theil's inequality index

# S3 method for theil
plot(
  x,
  style = c("mean_qi", "lines"),
  M = 250,
  col = "black",
  fill = "black",
  alpha,
  lwd,
  base_size = 14,
  scale = 100,
  labels = x$summary$time,
  ...
)

# S3 method for theil_list
plot(
  x,
  style = c("mean_qi", "lines"),
  M = 250,
  col = "black",
  fill = "black",
  alpha,
  lwd,
  between_title = "Between",
  within_title = "Within",
  total_title = "Total",
  scale = 100,
  plot = TRUE,
  ncol = 3,
  base_size = 14,
  ...
)

# S3 method for theil
print(x, scale = 100, digits = 3, ...)

# S3 method for theil_list
print(x, scale = 100, digits = 3, ...)

Arguments

x

An object of class thiel' or theil_list, as returned by calling theilon a list of fittedsurveil` models

style

If style = "mean_qi", then the posterior mean and 95 percent credible interval will be plotted; if style = "lines", then M samples from the joint probability distribution will be plotted.

M

If style = "lines", then M is the number of samples from the posterior distribution that will be plotted; the default is M = 250.

col

Line color

fill

Fill color

alpha

For style = "mean_qi", this controls the transparency for the credible interval (passed to geom_ribbon) and defaults to alpha = 0.5; for style = "lines", this controls the transparency of the lines and defaults to alpha = 0.7.

lwd

Line width; for style = "mean_qi", the default is lwd = 1; for style = "lines", the default is lwd = 0.05.

base_size

Passed to theme_classic to control size of plot elements (e.g., text)

scale

Scale Theil's index by scale

labels

x-axis labels (time periods)

...

additional arguments

between_title

Plot title for the between geography component of Theil's T; defaults to "Between".

within_title

Plot title for the within geography component of Theil's T; defaults to "Within".

total_title

Plot title for Theil's index; defaults to "Total".

plot

If FALSE, return a list of ggplots. Not used when style = "lines".

ncol

Number of columns for the plotting device. If ncol = 1, the three plots will be aligned vertically in one column; if ncol = 3 they will b aligned horizontally in one row.

digits

number of digits to print (passed to print.data.frame)

Value

plot.theil

The plot method returns an object of class ggplot.

plot.theil_list

If style = "lines", the plot method for theil_list objects returns a ggplot with facets for each component of inequality (between-areas, within-areas, and total). For style = "mean_qi", the plot method returns either a list of plots (all of class ggplot) or, when plot = TRUE, it will draw them to current plotting device using grid.arrange.

The print returns nothing and method prints a summary of results to the R console.

See also