fit_hill: Fit 2- or 3-parameter Hill model

View source: R/fit_hill.R

fit_hillR Documentation

Fit 2- or 3-parameter Hill model

Description

Fit a 2-parameter (fixed slope) or 3-parameter (variable slope) Hill model to concentration-response data.

Usage

fit_hill(
  x,
  conc = "logc",
  resp = "resp",
  fixed_slope = TRUE,
  assay = NULL,
  substance = NULL
)

Arguments

x

Data frame of dose response data.

conc

Column name of base-10 log scaled concentration (default "logc").

resp

Column name of response (default "resp").

fixed_slope

Logical indicating whether to fit a 2-parameter (TRUE) or 3-parameter (FALSE) Hill model (default TRUE).

assay

Column name of assay identifier(s) (optional, default NULL).

substance

Column name of substance identifier(s) (optional, default NULL).

Details

The input x data frame must contain columns specified by conc and resp arguments representing the log10-transformed concentration and response, respectively.

Optional assay and substance identifiers can be named vectors that are used to fit multiple substances and/or assays. For example, assay = c(name = "assay", "model") would indicate that x contains both and assay name and model. The name = "assay" part would rename the "assay" column in x to "name" in the 'assay' table when aded with add_hill_params().

Returned column 'tp' is the top asymptote and 'logAC50' is the 50% response concentration. If the computation of the standard deviations of these two parameters fails, then the standard deviation is set equal to the parameter estimate and is indicated by the respective imputed flag being TRUE.

Value

A list with elements 'fit', 'assay', 'substance'. The 'fit' element is a data frame of fit parameters, while the 'assay' and 'substance' elements indicate the column names used for assay and substance identifiers, respectively.

See Also

add_hill_params()

Examples

hill_df <- tibble::tribble(
  ~assay, ~model, ~casn, ~logc, ~resp,
  "a1", "human", "00-00-1",    0,  10,
  "a1", "human", "00-00-1",    1,  20,
  "a1", "human", "00-00-1",    2,  80,
  "a1", "human", "00-00-1",    3, 100,
  "a1", "human", "00-00-2", -0.5,   5,
  "a1", "human", "00-00-2",  0.5,  20,
  "a1", "human", "00-00-2",  1.5,  55,
  "a1", "human", "00-00-2",  2.5,  60,
  "a2",   "rat", "00-00-1",   -1,   0,
  "a2",   "rat", "00-00-1",    0,  10,
  "a2",   "rat", "00-00-1",    1,  30,
  "a2",   "rat", "00-00-1",    2,  40
)

# Fit 2-parameter Hill model
fit_hill(
  hill_df, assay = c(name = "assay", model = "model"), substance = "casn"
)

# Fit 3-parameter Hill model
fit_hill(hill_df, assay = "assay", substance = "casn", fixed_slope = FALSE)

GeoTox documentation built on May 20, 2026, 1:07 a.m.