single_continuous_fit: single_continuous_fit - Fit a single continuous BMD model.

View source: R/continuous_wrappers.R

single_continuous_fitR Documentation

single_continuous_fit - Fit a single continuous BMD model.

Description

Fit a single continuous BMD model.

Usage

single_continuous_fit(
  D,
  Y,
  model_type = "hill",
  fit_type = "laplace",
  prior = NA,
  BMD_TYPE = "sd",
  BMR = 0.1,
  point_p = 0.01,
  distribution = "normal-ncv",
  alpha = 0.05,
  samples = 25000,
  degree = 2,
  burnin = 1000,
  ewald = FALSE,
  transform = FALSE
)

Arguments

D

doses matrix

Y

response matrix

model_type

Mean model. It should be one of "hill","exp-3","exp-5","power","polynomial"

fit_type

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

prior

Prior / model for the continuous fit. If this is specified, it overrides the parameters 'model_type' and 'distribution.'

BMD_TYPE

BMD_TYPE specifies the type of benchmark dose analysis to be performed. For continuous models, there are four types of BMD definitions that are commonly used.
- Standard deviation is the default option, but it can be explicitly specified with 'BMR_TYPE = "sd"' This definition defines the BMD as the dose associated with the mean/median changing a specified number of standard deviations from the mean at the control dose., i.e., it is the dose, BMD, that solves \mid f(dose)-f(0) \mid = BMR \times σ
- Relative deviation can be specified with 'BMR_TYPE = "rel"'. This defines the BMD as the dose that changes the control mean/median a certain percentage from the background dose, i.e. it is the dose, BMD that solves \mid f(dose) - f(0) \mid = (1 \pm BMR) f(0)
- Hybrid deviation can be specified with 'BMR_TYPE = "hybrid"'. This defines the BMD that changes the probability of an adverse event by a stated amount relitive to no exposure (i.e 0). That is, it is the dose, BMD, that solves \frac{Pr(X > x| dose) - Pr(X >x|0)}{Pr(X < x|0)} = BMR. For this definition, Pr(X < x|0) = 1 - Pr(X > X|0) = π_0, where 0 ≤q π_0 < 1 is defined by the user as "point_p," and it defaults to 0.01. Note: this discussion assumed increasing data. The fitter determines the direction of the data and inverts the probability statements for decreasing data.
- Absolute deviation can be specified with 'BMR_TYPE="abs"'. This defines the BMD as an absolute change from the control dose of zero by a specified amount. That is the BMD is the dose that solves the equation \mid f(dose) - f(0) \mid = BMR.

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."

point_p

This option is only used for hybrid BMD calculations. It defines a probability that is the cutpoint for observations. It is the probability that observations have this probability, or less, of being observed at the background dose.

distribution

The underlying distribution used as the data distribution.

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-α)\% confidence interval. For the interval (BMDL,BMDU) this is a 100\times(1-2α)\% confidence interval. By default, it is set to 0.05.

samples

the number of samples to take (MCMC only)

degree

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

burnin

the number of burnin samples to take (MCMC only)

ewald

perform Wald CI computation instead of the default profile likelihood computation. This is the the 'FAST BMD' method of Ewald et al (2021)

transform

Transforms doses using \log(dose+√{dose^2+1}). Note: this is a log transform that has a derivative defined when dose =0.

Value

Returns a model object class with the following structure:

  • full_model: The model along with the likelihood distribution.

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

  • 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(sigma^2).

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

  • bmd_dis: Quantiles for the BMD distribution.

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

  • Deviance: An array used to compute the analysis of deviance table.

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

  • model: Parameter specifies t mean model used.

  • options: Options used in the fitting procedure.

  • data: The data used in the fit.

  • transformed: Are the data \log(x+√{x^2+1}) transformed?

    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

M2           <- matrix(0,nrow=5,ncol=4)
colnames(M2) <- c("Dose","Resp","N","StDev")
M2[,1] <- c(0,25,50,100,200)
M2[,2] <- c(6,5.2,2.4,1.1,0.75)
M2[,3] <- c(20,20,19,20,20)
M2[,4] <- c(1.2,1.1,0.81,0.74,0.66)
model = single_continuous_fit(M2[,1,drop=FALSE], M2[,2:4], BMD_TYPE="sd", BMR=1, ewald = TRUE,
                             distribution = "normal",fit_type="laplace",model_type = "hill")

summary(model)

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