prepareGen: Prepare General Data for the MCPMod Function

Description Usage Arguments Value Examples

View source: R/prepareGen.R

Description

This function serves as an alternative for using the MCPModGen function directly for general data. The function returns the estimates for μ and S, which are needed for MCPMod.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
prepareGen(
  family = c("negative binomial", "binomial", "poisson"),
  link = c("log", "logit", "probit", "cauchit", "cloglog", "identity", "log risk ratio",
    "risk ratio", "sqrt"),
  w = NULL,
  dose,
  resp,
  data = NULL,
  addCovars = ~1,
  placAdj = FALSE,
  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.

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

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.

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

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.

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.

Value

A list containing the μ vector and S matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 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
muS = prepareGen("binomial", "logit", w = "ntrt", dose = "dose",
                 resp = "pfrat", data = migraine)
## Look at the elements of muS
muS
MCPMod(muS$data$dose, muS$data$resp, models = models, S = muS$S,
       type = "general", selModel = "aveAIC",Delta = 0.2)

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