MCPModGen: MCPModGen - Multiple Comparison and Modeling (General Case)

Description Usage Arguments Details Value References Examples

View source: R/MCPModGen.R

Description

This function allows the user to implement the MCPMod function on negative binomial, Poisson, and binary data, without having to write any additional code. If analyzing survival data, see the MCPModSurv function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
MCPModGen(
  family = c("negative binomial", "binomial"),
  link = c("log", "logit", "probit", "cauchit", "cloglog", "identity", "log risk ratio",
    "risk ratio"),
  returnS = FALSE,
  w = NULL,
  dose,
  resp,
  data = NULL,
  models,
  addCovars = ~1,
  placAdj = FALSE,
  selModel = c("AIC", "maxT", "aveAIC"),
  alpha = 0.025,
  df = NULL,
  critV = NULL,
  doseType = c("TD", "ED"),
  Delta,
  p,
  pVal = TRUE,
  alternative = c("one.sided", "two.sided"),
  na.action = na.fail,
  mvtcontrol = mvtnorm.control(),
  bnds,
  control = NULL,
  offset = NULL,
  ...
)

Arguments

family

A character string containing the error distribution to be used in the model.

link

A character string for the model link function.

returnS

Logical determining whether muHat and SHat should be returned, in additional to the MCPMod output.

w

Either a numeric vector of the same length as dose and resp, or a character vector denoting the column name in the data.

dose, resp

Either vectors of equal length specifying dose and response values, or character vectors specifying the names of variables in the data frame specified in data.

data

Data frame with names specified in 'dose', 'resp', and optionally 'w'. If data is not specified, it is assumed that 'dose' and 'resp' are numerical vectors

models

An object of class "Mods", see Mods for details

addCovars

Formula specifying additive linear covariates (e.g. '~ factor(gender)').

placAdj

Logical specifying whether the provided by 'resp' are to be treated as placebo-adjusted estimates.

selModel

Optional character vector specifying the model selection criterion for dose estimation. Possible values are

  • AIC: Selects model with smallest AIC (this is the default)

  • maxT: Selects the model corresponding to the largest t-statistic.

  • aveAIC: Uses a weighted average of the models corresponding to the significant contrasts. The model weights are chosen by the formula: w_i = exp(-0.5AIC_i)/sum(exp(-0.5AIC_i)) See Buckland et al. (1997) for details.

For type = "general" the "gAIC" is used.

alpha

Significance level for the multiple contrast test

df

An optional numeric value specifying the degrees of freedom. Infinite degrees of freedom ('df=Inf', the default), correspond to the multivariate normal distribution.

critV

Supply a pre-calculated critical value. If this argument is NULL, no critical value will be calculated and the test decision is based on the p-values. If critV = TRUE the critical value will be calculated.

doseType

doseType determines the dose to estimate, ED or TD (see also Mods), and Delta and p need to be specified depending on whether TD or ED is to be estimated. See TD and ED for details.

Delta

doseType determines the dose to estimate, ED or TD (see also Mods), and Delta and p need to be specified depending on whether TD or ED is to be estimated. See TD and ED for details.

p

doseType determines the dose to estimate, ED or TD (see also Mods), and Delta and p need to be specified depending on whether TD or ED is to be estimated. See TD and ED for details.

pVal

Logical determining, whether p-values should be calculated.

alternative

Character determining the alternative for the multiple contrast trend test.

na.action

A function which indicates what should happen when the data contain NAs.

mvtcontrol

A list specifying additional control parameters for the qmvt and pmvt calls in the code, see also mvtnorm.control for details.

bnds

Bounds for non-linear parameters. This needs to be a list with list entries corresponding to the selected bounds. The names of the list entries need to correspond to the model names. The defBnds function provides the default selection.

control

Control list for the optimization.
A list with entries: "nlminbcontrol", "optimizetol" and "gridSize".

The entry nlminbcontrol needs to be a list and is passed directly to control argument in the nlminb function, that is used internally for models with 2 nonlinear parameters (e.g. sigmoid Emax or beta model).

The entry optimizetol is passed directly to the tol argument of the optimize function, which is used for models with 1 nonlinear parameters (e.g. Emax or exponential model).

The entry gridSize needs to be a list with entries dim1 and dim2 giving the size of the grid for the gridsearch in 1d or 2d models.

offset

Either a numeric vector of the same length as dose and resp, or a character vector denoting the column name in the data.

...

Additional arguments to be passed to glm or glm.nb. This is especially useful when a fitting error is returned. In these cases, it may be useful to supply a start vector for the parameters.

Details

This function works by first fitting a glm with the chosen family and link. The μ vector and S matrix are extracted from the glm, and these values are supplied to the MCPMod function, along with all user-defined arguments.
Currently, the function can take the negative binomial and Poisson family with a log, sqrt, identity, risk ratio, and log risk ratio links, or a bernoulli family with a log, logit, probit, cauchit, cloglog-link, identity, risk ratio, and log risk ratio links.

Value

An object of class MCPMod if 'returnS = FALSE'. Otherwise, a list containing an object of class MCPMod, the numeric vector μ, and the numeric matrix S.

References

Buckland, S. T., Burnham, K. P. and Augustin, N. H. (1997). Model selection an integral part of inference, Biometrics, 53, 603–618

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Analyze the binary migraine data from the DoseFinding package.
data(migraine)
models = Mods(linear = NULL, emax = 1, quadratic = c(-0.004), doses = migraine$dose)

# Now analyze using binomial weights
PFrate <- migraine$painfree/migraine$ntrt
migraine$pfrat = migraine$painfree / migraine$ntrt
MCPModGen("binomial","logit",returnS = TRUE, w = "ntrt", dose = "dose",
   resp = "pfrat", data = migraine, models = models, selModel = "aveAIC",
   Delta = 0.2)

MCPModGeneral documentation built on March 26, 2020, 7:14 p.m.