horseshoe {bonsaiforest}R Documentation

Bayesian Shrinkage Model Estimation

Description

Function to fit a bayesian shrinkage model with a regularized horseshoe prior on the interaction coefficients between the subgrouping covariates and the treatment.

Usage

horseshoe(
  resp,
  trt,
  subgr,
  covars,
  data,
  resptype = c("survival", "binary"),
  status = NULL,
  ...
)

Arguments

resp

(string)
the response variable name.

trt

(string)
the treatment variable name.The treatment variable must be a factor with 2 levels where the first level is the control and the second one the treatment.

subgr

(character)
vector with the name of the subgroup variables from which we want to obtain the subgroup treatment effect. They have to be factor variables with the subgroups as levels.

covars

(character)
vector with the name of the variables that we want to include in the model. They have to be factor variables with the subgroups as levels. The subgr variables have to be included here.

data

(⁠data frame⁠)
the data frame with the variables.

resptype

(string)
the type of data used. Can be "survival" or "binary".

status

(string)
only for "survival" resptype, the status variable name in survival data.

...

Additional arguments from the brm function.

Value

List with fit, model, resptype, data, alpha, design_matrix, design_dummy, y, subgr_names.

Examples


horseshoe("ev_pfs", "arm", c("x_1", "x_2"), c("x_1", "x_2", "x_3"),
  example_data, "binary",
  chains = 1, seed = 0, control = list(adapt_delta = 0.95),
  iter = 50 # In practice, you need to omit this or set it much higher!
)


[Package bonsaiforest version 0.1.0 Index]