parameterise_contrast_2l: Define and visualise a contrast between two factor levels

View source: R/parameterise.R

parameterise_contrast_2lR Documentation

Define and visualise a contrast between two factor levels

Description

This function is used to define and visualise a contrast between two factor levels (e.g. the difference in depth between males and females). Simulated contrasts can be compared to estimated contrasts from an mgcv generalised additive model (GAM). The function is intended primarily for use behind-the-scenes in GAMS4DTS.

Usage

parameterise_contrast_2l(
  x = factor(c("F", "M")),
  param = 0,
  plot_gam = FALSE,
  dat,
  model,
  term = "sex",
  cex.axis = 1,
  mtext_args = list(list(side = 1, text = "Sex (F, female; M, male)", line = 2.5),
    list(side = 2, text = "Contrast (m)", line = 2.5))
)

Arguments

x

A vector of two factor levels for which to define a contrast.

param

A numeric input which defines the size of the contrast between two factor levels.

plot_gam

A logical input which defines whether or not to add model estimates to the plot.

dat

The dataframe used to fit the model.

model

The model.

term

A character input which defines the name of the term in the model.

cex.axis

A numeric input which defines the size of the font for axis tick labels.

mtext_args

A named list of arguments which are passed to mtext to produce axis labels. A nested list can be used to control each axis (see also pretty_ts).

Value

The function returns a plot showing the size of the contrast between factor levels, possibly in relation to that estimated by an mgcv GAM model.

Author(s)

Edward Lavender


edwardlavender/Tools4ETS documentation built on Nov. 29, 2022, 7:41 a.m.