makeStanmodel: Create a Stan model and data

Description Usage Arguments Value

View source: R/makeStanmodel.r

Description

Takes in data and builds appropriate Stan code representation of model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
makeStanmodel(
  data,
  outcome,
  N,
  sd = NULL,
  reference,
  type = "consistency",
  time = NULL,
  family,
  link,
  effects,
  prior.mu = "DEFAULT",
  prior.d = "DEFAULT",
  prior.sigma = "DEFAULT"
)

Arguments

data

a BUGSnetData object produced from data.prep()

outcome

A string indicating the column name of the outcome variable

N

A string indciating the column name of the variable containing number of participants in each arm

sd

A string indicating the column name of the standard deviation for each arm (NOT the standard error - convert by multiplying by square root of N) of the outcome (only required for continuous outcomes).

reference

A string for the name of the treatment to be used as the "referent" comparator, and to be labelled as treatment 1 in the Stan code

type

If type="inconsistency", an inconsistency model will be built. By default, type="consistency" and a consistency model is built. Inconsistency models are not yet supported in StanNet.

time

A string (only required for binomial-cloglog or poisson-log models) indicating the name of variable indicating person-time followup (e.g person years) or study followup time.

family

string indicating family of the distribution of the outcome. Options are: "binomial", "normal", "poisson".

link

The link function for the nma model. Options are "logit" (binomial family), "cloglog" (binomial family), "log" (poisson family), "identity" (normal family).

effects

A string indicating the type of treatment effect relative to the baseline, either "fixed" or "random"

prior.mu

A string of Stan code which defines priors on the baseline treatment effects, or if "default", independent normal priors are used with mean 0 and standard deviation 15u, where u is the largest maximum likelihood estimator in single trials (see van Valkenhoef, G et al. 2012)

prior.d

A string of Stan code that defines priors on the relative treatment effects. If "default", independent normal priors with mean 0 and standard deviation 15u where u is the largest maximum likelihood estimator in single trials (see van Valkenhoef, G et al. 2012) (BUGSnet)

prior.sigma

A string of Stan code that defines the prior on the standard deviation of the relative treatment effects. By default, uniform distribution on (0, u) where u is largest MLE from single trials (see van Valkenhoef, G et al. 2012) (BUGSnet)

Value

An object of class StanNetModel which includes a string of Stan code which represent the model, and the model data, to be passed to runStan for compilation and MCMC sampling


augustinewigle/StanNet documentation built on July 21, 2020, 12:13 a.m.