single_dichotomous_fit: Fit a single dichotomous dose-response model to data.

View source: R/dichotomous_wrappers.R

single_dichotomous_fitR Documentation

Fit a single dichotomous dose-response model to data.

Description

Fit a single dichotomous dose-response model to data.

Usage

single_dichotomous_fit(
  D,
  Y,
  N,
  model_type,
  fit_type = "laplace",
  prior = NULL,
  BMR = 0.1,
  alpha = 0.05,
  degree = 2,
  samples = 21000,
  burnin = 1000
)

Arguments

D

A numeric vector or matrix of doses.

Y

A numeric vector or matrix of responses.

N

A numeric vector or matrix of the number of replicates at a dose.

model_type

The mean model for the dichotomous model fit. It can be one of the following:
"hill","gamma","logistic", "log-logistic", "log-probit" ,"multistage" ,"probit","qlinear","weibull"

fit_type

the method used to fit (laplace, mle, or mcmc)

prior

Used if you want to specify a prior for the data.

BMR

This option specifies the benchmark response BMR. The BMR is defined in relation to the BMD calculation requested (see BMD). By default, the "BMR = 0.1."

alpha

Alpha is the specified nominal coverage rate for computation of the lower bound on the BMDL and BMDU, i.e., one computes a 100\times(1-α)\% . For the interval (BMDL,BMDU) this is a 100\times(1-2α)\% confidence interval. By default, it is set to 0.05.

degree

the number of degrees of a polynomial model. Only used for polynomial models.

samples

the number of samples to take (MCMC only)

burnin

the number of burnin samples to take (MCMC only)

Value

Returns a model object class with the following structure:

  • full_model: The model along with the likelihood distribution.

  • parameters: The parameter estimates produced by the procedure, which are relative to the model ' given in full_model. The last parameter is always the estimate for \log(σ^2).

  • covariance: The variance-covariance matrix for the parameters.

  • bmd_dist: Quantiles for the BMD distribution.

  • bmd: A vector containing the benchmark dose (BMD) and 100\times(1-2α) confidence intervals.

  • maximum: The maximum value of the likelihod/posterior.

  • gof_p_value: GOF p-value for the Pearson χ^2 GOF test.

  • gof_chi_sqr_statistic: The GOF statistic.

  • prior: This value gives the prior for the Bayesian analysis.

  • model: Parameter specifies t mean model used.

  • data: The data used in the fit.

    When MCMC is specified, an additional variable mcmc_result has the following two variables:

    • PARM_samples: matrix of parameter samples.

    • BMD_samples: vector of BMD sampled values.

Examples

mData <- matrix(c(0, 2,50,
                  1, 2,50,
                  3, 10, 50,
                  16, 18,50,
                  32, 18,50,
                  33, 17,50),nrow=6,ncol=3,byrow=TRUE)
D <- mData[,1]
Y <- mData[,2]
N <- mData[,3]
model = single_dichotomous_fit(D, Y, N, model_type = "hill", fit_type = "laplace")
summary(model)


ToxicR documentation built on Dec. 28, 2022, 3:07 a.m.