ipdma.model.deft.onestage {bipd} | R Documentation |

## Make a (deft-approach) one-stage individual patient data meta-analysis object containing data, priors, and a JAGS model code

### Description

This function sets up data and JAGS code that is needed to run (deft-approach) one-stage IPD-MA models in JAGS.

### Usage

```
ipdma.model.deft.onestage(
y = NULL,
study = NULL,
treat = NULL,
X = NULL,
response = "normal",
type = "random",
mean.alpha = 0,
prec.alpha = 0.001,
mean.beta = 0,
prec.beta = 0.001,
mean.gamma.within = 0,
prec.gamma.within = 0.001,
mean.gamma.across = 0,
prec.gamma.across = 0.001,
mean.delta = 0,
prec.delta = 0.001,
hy.prior = list("dhnorm", 0, 1)
)
```

### Arguments

`y` |
outcome of the study. Can be continuous or binary. |

`study` |
vector indicating which study the patient belongs to. Please change the study names into numbers (i.e. 1, 2, 3, etc) |

`treat` |
vector indicating which treatment the patient was assigned to (i.e. 1 for treatment, 0 for placebo) |

`X` |
matrix of covariate values for each patient. Dimension would be number of patients x number of covariates. |

`response` |
specification of the outcome type. Must specify either "normal" or "binomial". |

`type` |
assumption on the treatment effect: either "random" for random effects model or "fixed" for fixed effects model. Default is "random". |

`mean.alpha` |
prior mean for the study intercept |

`prec.alpha` |
prior precision for the study intercept |

`mean.beta` |
prior mean for the regression coefficients of the main effects of the covariates; main effects are assumed to have common effect. |

`prec.beta` |
prior precision for the regression coefficients of the main effects of the covariates |

`mean.gamma.within` |
prior mean for effect modifiers of within study information. |

`prec.gamma.within` |
prior precision for the effect modifiers of within study information. |

`mean.gamma.across` |
prior mean for the effect modifiers of across study information; effect modification is assumed to have common effect. |

`prec.gamma.across` |
prior precision for the effect modifiers of across study information |

`mean.delta` |
prior mean for the average treatment effect |

`prec.delta` |
prior precision for the average treatment effect |

`hy.prior` |
prior for the heterogeneity parameter. Supports uniform, gamma, and half normal for normal and binomial response It should be a list of length 3, where first element should be the distribution (one of dunif, dgamma, dhnorm) and the next two are the parameters associated with the distribution. For example, list("dunif", 0, 5) gives uniform prior with lower bound 0 and upper bound 5 for the heterogeneity parameter. |

### Value

`data.JAGS` |
data organized in a list so that it can be used when running code in JAGS |

`code` |
JAGS code that is used to run the model. Use cat(code) to see the code in a readable format |

`model.JAGS` |
JAGS code in a function. This is used when running model in parallel |

`Xbar` |
study specific averages of covariates |

### References

Fisher DJ, Carpenter JR, Morris TP, et al. Meta-analytical methods to identify who benefits most from treatments: daft, deluded, or deft approach?. *BMJ*. 2017;356:j573 doi: 10.1136/bmj.j573

### Examples

```
ds <- generate_ipdma_example(type = "continuous")
ipd <- with(ds, ipdma.model.deft.onestage(y = y, study = studyid, treat = treat, X = cbind(z1, z2),
response = "normal"))
samples <- ipd.run(ipd)
treatment.effect(ipd, samples, newpatient= c(1,0.5), reference = c(0, 0))
```

*bipd*version 0.3 Index]