pmtest function

Test if personalised models improve upon base model.

Test if personalised models improve upon base model.

This is a rudimentary test if there is heterogeneity in the model parameters. The null-hypothesis is: the base model is the correct model.

pmtest(forest, pmodels = NULL, data = NULL, B = 100) ## S3 method for class 'heterogeneity_test' plot(x, ...)

Arguments

  • forest: pmforest object.
  • pmodels: pmodel_identity object (pmodel(..., fun = identity)).
  • data: data.
  • B: number of bootstrap samples.
  • x: object of class heterogeneity_test.
  • ...: ignored.

Returns

list where the first element is the p-value und the second element is a data.frame with all neccessary infos to compute the p-value.

The test statistic is the difference in objective function between the base model and the personalised models. To compute the distribution under the Null we draw parametric bootstrap samples from the base model. For each bootstrap sample we again compute the difference in objective function between the base model and the personalised models. If the difference in the original data is greater than the difference in the bootstrap samples, we reject the null-hypothesis.

Examples

## Not run: set.seed(123) n <- 160 trt <- factor(rep(0:1, each = n/2)) y <- 4 + (trt == 1) + rnorm(n) z <- matrix(rnorm(n * 2), ncol = 2) dat <- data.frame(y, trt, z) mod <- lm(y ~ trt, data = dat) ## Note that ntree should usually be higher frst <- pmforest(mod, ntree = 20) pmods <- pmodel(frst, fun = identity) ## Note that B should be at least 100 ## The low B is just for demonstration ## purposes. tst <- pmtest(forest = frst, pmodels = pmods, B = 10) tst$pvalue tst plot(tst) ## End(Not run)
  • Maintainer: Heidi Seibold
  • License: GPL-2 | GPL-3
  • Last published: 2024-11-08

Useful links