simS: Covariance Matrix Simulation

Description Usage Arguments Value Examples

View source: R/simS.R

Description

For non-canonical links, simulating the covariance matrix is sometimes the easiest way to get an estimate of the covariance matrix. Even for the canonical links, simulating the covariance matrix may be desirable, as theoretical covariance matrices are based off of asymptotic properties which may not hold for small sample sizes.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
simS(
  doses,
  resp,
  nSample,
  Ntype = c("arm", "total", "actual"),
  nSim = 1000,
  alRatio = NULL,
  family,
  link,
  modelPar = NULL,
  placEff = NULL,
  verbose = FALSE
)

Arguments

doses

A numerical vector of doses, corresponding to the theoretical response values provided.

resp

A numeric vector of response values corresponding to the doses. This should be on the link scale (e.g. resp should be on the log-scale if using the log-link).

nSample

An integer if Ntype is "arm" or "total", or a numerical vector of patient allocations for each arm if Ntype is "actual".

Ntype

One of "arm", "total", or 'actual". See documentation for Ntype in powMCT for descriptions of "arm" and 'total". For "actual", the nSample should be a numerical vector containing the actual patient allocation for each dose provided.

nSim

An integer specifying the number of simulations used to estimate the covariance matrix.

alRatio

Vector describing the relative patient allocations to the dose groups up to proportionality, e.g. rep(1, length(doses)) corresponds to balanced allocations.

family

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

link

A character string specifying the link to be using when modeling the glm.

modelPar

A numeric vector containing the additional parameters for the family argument. If the family is negative binomial, the dispersion parameter should be supplied. If the family is binomial, no model parameter should be supplied.

placEff

A numeric value specifying the mean response at the placebo This is required if link = "risk ratio" or "log risk ratio" and ignored otherwise.

verbose

A logical specifying whether the patient allocation should be printed, in addition to the results.

Value

Numeric containing the estimated covariance matrix.

Examples

1
2
3
4
data(migraine)
models = Mods(linear = NULL, emax = 1, quadratic = c(-0.004), doses = migraine$dose)
simS(migraine$dose, getResp(models)[,1], 30, "arm", 10, family = "binomial",
     link = "logit", verbose = TRUE)

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