fitHillModel {basicdrm} | R Documentation |
This function uses the R stats
function optim
to fit a Hill dose
response model to a given set of dose and response values. Four different
model settings are allowed, in which the minimal and maximal effects are
either fixed at a provided value or allowed to be fit to the data.
fitHillModel(
formula,
data,
model,
weights = NULL,
start = NULL,
direction = 0,
lower = NULL,
upper = NULL
)
formula |
Either an object of class |
data |
If |
model |
A vector of values between 1 and 4, specifying the precise
model to be fit. The values correspond to the four parameters of the Hill
model: dose of median effect, Hill slope, minimal effect, and maximal effect
(see |
weights |
A vector of weights (between 0 and 1) the same length as
|
start |
A vector of four starting values for the Hill model to be fit.
Any values not being fit will be fixed at these starting values. If left as
|
direction |
Determines the possible directionality of the dose response model. If 0 (the default) no additional constraints are placed on the parameters. If greater than 0, the fitting will require that the maximal effect is greater than the minimal effect. If less than 0, the fitting wll require tha the maximal effect is less than the minimal effect. |
lower |
A vector of lower bounds on the Hill parameter values. Can be
the same length as |
upper |
A vector of upper bounds on the Hill parameter values. Works
the same as parameter |
An object of class hillrm
, containing the following values:
conc
: the given vector of concentraitons
act
: the given vector of responses
weights
: the vector of measurement weights used in minimizing the sum
of squared errors
coefficients
: the full four-parameter Hill parameter vector (accessible
by the function coef()
)
par
: the vector of paramters that were actually fit
fitted.values
: the predicted responses of the best fit model (accessible
by the functoin fitted()
)
residuals
: the difference between the actual responses and the predicted
responses (accessible by the function residuals()
)
model
: the vector of values between 1 and 4 specifying the precise model
that was fit
mname
: a character string naming the precise model that was fit. One of
"m2p", "m3plc", "m3puc", or "m4p"
start
: a four-value parameter vector used as the starting value for the
model fit
direction
: the direction constraint used in the fit
pbounds
: a two-by-four matrix of values specifying the lower and upper
bounds used in the fit
conc <- c(0,2^(-6:3),Inf)
hpar <- c(1,3,0,75)
response <- evalHillModel(conc, hpar) + rnorm(length(conc),sd=7.5)
data <- data.frame(conc=conc,response=response,weight=c(0.5,rep(1,10),0.1))
hfit <- fitHillModel(conc,response,c(1,2,3,4),start=c(0.5,1,0,100))
hfit2 <- fitHillModel(response~conc,data,c(1,2,4),weight,start=c(0.5,1,0,100),
direction=0,lower=c(NA,NA,0,0))