% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fit_hill.R
\name{fit_hill}
\alias{fit_hill}
\title{Fit 2- or 3-parameter Hill model}
\usage{
fit_hill(
  x,
  conc = "logc",
  resp = "resp",
  fixed_slope = TRUE,
  assay = NULL,
  substance = NULL
)
}
\arguments{
\item{x}{Data frame of dose response data.}

\item{conc}{Column name of base-10 log scaled concentration (default "logc").}

\item{resp}{Column name of response (default "resp").}

\item{fixed_slope}{Logical indicating whether to fit a 2-parameter (TRUE) or
3-parameter (FALSE) Hill model (default TRUE).}

\item{assay}{Column name of assay identifier(s) (optional, default NULL).}

\item{substance}{Column name of substance identifier(s) (optional, default
NULL).}
}
\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.
}
\description{
Fit a 2-parameter (fixed slope) or 3-parameter (variable slope) Hill model to
concentration-response data.
}
\details{
The input \code{x} data frame must contain columns specified by \code{conc} and \code{resp}
arguments representing the log10-transformed concentration and response,
respectively.

Optional \code{assay} and \code{substance} identifiers can be named vectors that are
used to fit multiple substances and/or assays. For example, \code{assay = c(name = "assay", "model")} would indicate that \code{x} contains both and assay name and
model. The \code{name = "assay"} part would rename the "assay" column in \code{x} to
"name" in the 'assay' table when aded with \code{\link[=add_hill_params]{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.
}
\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)
}
\seealso{
\code{\link[=add_hill_params]{add_hill_params()}}
}
