test_diff: Test the difference for delay model parameter(s) between two...

View source: R/delay_test.R

test_diffR Documentation

Test the difference for delay model parameter(s) between two uncorrelated groups, based on maximum product of spacings estimation (MPSE).

Description

It is in fact a model comparison between a null model where the parameters are enforced to be equal and an unconstrained full model. As test statistic we use twice the difference in best (=lowest) objective function value, i.e. 2 * (val_0 - val_1). This is reminiscent of a likelihood ratio test statistic albeit the objective function is not a negative log-likelihood but the negative of the maximum product spacing metric.

Usage

test_diff(
  x,
  y = stop("Provide data for group y!"),
  distribution = c("exponential", "weibull"),
  twoPhase = FALSE,
  method = c("MPSE", "MLEn", "MLEw", "MLEc"),
  profiled = method == "MLEw",
  ties = c("density", "equidist", "random", "error"),
  param = "delay1",
  type = c("all", "bootstrap", "GOF", "moran", "pearson", "logrank", "LR"),
  doLogrank = TRUE,
  R = 400,
  chiSqApprox = FALSE,
  verbose = 0
)

Arguments

x

data from reference/control group.

y

data from the treatment group.

distribution

character(1). Name of the parametric delay distribution to use.

twoPhase

logical(1). Do we model two phases per group? Default is FALSE, i.e. a single delay phase per group.

method

character. Which method to fit the models.

profiled

logical. Use the profiled likelihood?

ties

character. How to handle ties in data vector of a group?

param

character. Names of parameters to test difference for. Default value is 'delay1'.

type

character. Which type of tests to perform?

doLogrank

logical. In any case do log-rank based tests?

R

numeric(1). Number of bootstrap samples to evaluate the distribution of the test statistic.

chiSqApprox

logical flag. In bootstrap, should we calculate the approximate degrees of freedom for the distribution of the test statistic under H0?

verbose

numeric. How many details are requested? Higher value means more details. 0=off, no details.

Details

High values of this difference speak against the null-model (i.e. high val_0 indicates bad fit under 0-model and low values of val_1 indicate a good fit under the more general model1. The test is implemented as a parametric bootstrap test, i.e. we

  1. take given null-model fit as ground truth

  2. regenerate data according to this model.

  3. recalculate the test statistic

  4. appraise the observed test statistic in light of the generated distribution under H0

Value

list with the results of the test. Element P contains the different P-values, for instance from parametric bootstrap


incubate documentation built on Sept. 11, 2024, 6:50 p.m.