plot.efflist: Workaround for effects::plot.eff

plot.efflistR Documentation

Workaround for effects::plot.eff

Description

method for class 'eff' effects::allEffects

Usage

plot_allEffects(
  x,
  predictor = NULL,
  main = NULL,
  factor.names = FALSE,
  rel_widths = 1,
  rel_heights = 1,
  ylab = NULL,
  xlab = NULL,
  labels = NULL,
  cex = 1.1,
  axis.padding = 0.4,
  multiline = NULL,
  x.var = 1,
  space = "right",
  columns = 1,
  xlevels = NULL,
  select = NULL,
  remove = NULL,
  order = NULL,
  ...
)

plot2(...)

## Default S3 method:
plot2(...)

## S3 method for class 'efflist'
plot2(
  x,
  main = NULL,
  factor.names = FALSE,
  nrow = NULL,
  ncol = NULL,
  rel_widths = 1,
  rel_heights = 1,
  ylab = NULL,
  xlab = NULL,
  labels = NULL,
  xlim = NULL,
  ticks = NULL,
  y.ticks = if (is.list(ticks)) ticks else list(at = ticks),
  x.ticks = NULL,
  cex = 1.1,
  cex.x = cex * 0.8,
  cex.y = cex * 0.8,
  cex.xlab = cex,
  cex.ylab = cex,
  cex.strip = cex * 1.2,
  cex.title = cex,
  cex.key = cex * 0.75,
  cex.points = cex,
  lty = 1,
  lty.factor = 0,
  multiline = NULL,
  x.var = 1,
  space = "right",
  columns = 1,
  axes = NULL,
  axis.padding = 0.4,
  plot = TRUE,
  rug = FALSE,
  layout = NULL,
  key.args = list(space = space, columns = columns, cex.title = cex.title, cex = cex.key),
  bottom.padding = 0,
  top.padding = 0,
  left.padding = 0.4,
  right.padding = 1,
  par.strip.text = list(),
  par.settings = list(add.text = list(cex = cex.strip), par.zlab.text = list(cex =
    cex.xlab), par.ylab.text = list(cex = cex.ylab), par.xlab.text = list(cex =
    cex.xlab), layout.heights = list(bottom.padding = bottom.padding, top.padding =
    top.padding), layout.widths = list(left.padding = left.padding, right.padding =
    right.padding)),
  select = NULL,
  remove = NULL,
  order = NULL,
  ...
)

Arguments

x

an object of class "efflist"

predictor

~ ., a predictor

main

the title for the plot, gows to cowplot

factor.names

lattice factor.names = FALSE

rel_widths, rel_heights

an cowplot::plot_grid

labels, ylab, xlab

Warnung labels funktionieren am besten!! x und y Beschriftung labels ist ein Vector mit Namen

cex, cex.x, cex.y

größe der Schrift

multiline, x.var

multiline display a multiline plot in each panel x.var = 1, bei interactionen immer was in der Formel an erster stelle steht description

xlevels

effects::effect the number of levels for any focal numeric predicto xlevels=list(x1=c(2, 4.5, 7), x2=4)

select, order

Auswahl der Predictor

...

an effects::plot.eff

nrow, ncol

an cowplot::plot_grid

lty

line type for the loess smooth; the default is the first line type, normally 1 (a solid line).

lty.factor

line type for the loess smooth; 0.

axes

liste wird automatisch aud den labels erstellt specifications for the x and y axes

plot

plot or list cowplot::plot_grid(plotlist)

rug

rug

key.args, space, columns

a key, or legend, is added to the plot if multiline = TRUE

bottom.padding, top.padding, left.padding, right.padding, axis.padding

lattice::lattice.options

par.settings

siehe https://stackoverflow.com/questions/13026196/how-to-nicely-rescale-lattice-figures

Value

standard plot

list oder plot

Examples


# require(stp25plot)
# require(stp25tools)
# require(stp25stat2)


mtcars2 <- mtcars |>
dplyr::mutate(
  vs   = factor(vs, labels = c("V-shaped", "straight")),
  am   = factor(am, labels = c("automatic", "manual")),
  cyl  = ordered(cyl),
  gear = ordered(gear),
  carb = ordered(carb)
) |> Label(
  mpg	 = "Miles/(US) gallon",
  cyl	 = "Number of cylinders",
  disp = "Displacement (cu.in.)",
  hp	 = "Gross horsepower",
  drat = "Rear axle ratio",
  wt   = "Weight (1000 lbs)",
  qsec = "1/4 mile time",
  vs   = "Engine",
  am   = "Transmission",
  gear = "Number of forward gears",
  carb = "Number of carburetors"
)

fit <- lm(mpg ~ hp * wt + vs +  am * cyl  , data = mtcars2)

# lattice::trellis.par.set(effectsTheme())
lattice::trellis.par.set(bw_theme(farbe(n=5), lwd = 1))

plot_allEffects(
  fit,
  labels = get_label(mtcars2),
  main = letters[1:3],  #as.roman(1:3),
  # cex= 1,
  space = "right",
  columns = 1,
  rel_widths = c(3, 4),
  rel_heights = c(5, 6)
)

stp4/stp25plot documentation built on Sept. 17, 2024, 5:29 p.m.