nof1.data: Make an N of 1 object containing data, priors, and a jags...

Description Usage Arguments Value Examples

Description

Make an N of 1 object containing data, priors, and a jags model file

Usage

1
2
3
4
nof1.data(Y, Treat, baseline = "baseline", ncat = NULL,
  response = NULL, Time = NULL, knots = NULL, alpha.prior = NULL,
  beta.prior = NULL, gamma.prior = NULL, dc.prior = NULL,
  c1.prior = NULL, rho.prior = NULL, hy.prior = NULL)

Arguments

Y

Outcome of the study. This should be a vector with length of total number of observations.

Treat

Treatment indicator vector with same length as the outcome.

baseline

baseline Treatment name. This serves as a baseline/placebo when comparing different treatments.

ncat

Number of categories. Used in ordinal models.

response

Type of outcome. Can be normal, binomial, poisson or ordinal.

Time

parameter used for modelling splines. Still under development.

knots

parameter used for modelling splines. Still under development.

alpha.prior

Prior for the intercept of the model.

beta.prior

Prior for the treatment coefficient.

gamma.prior

Prior for modelling splines. Still under development.

dc.prior

Prior for the length between cutpoints. Used only for ordinal logistic models.

c1.prior

Prior for the first cutpoint. Used only for ordinal logistic models.

rho.prior

Prior for the correlated error model. Still under development.

hy.prior

Prior for the heterogeneity parameter. Supports uniform, gamma, and half normal for normal and binomial response and wishart for multinomial response. It should be a list of length 3, where first element should be the distribution (one of dunif, dgamma, dhnorm, dwish) and the next two are the parameters associated with the distribution. For example, list("dunif", 0, 5) give uniform prior with lower bound 0 and upper bound 5 for the heterogeneity parameter. For wishart distribution, the last two parameter would be the scale matrix and the degrees of freedom.

Value

Creates list of variables that are used to run the model using nof1.run

Y

Outcome

Treat

Treatment

baseline

Baseline variable

ncat

Number of categories for ordinal response

nobs

Total number of observations in a study

Treat.name

Treatment name besides baseline treatment

response

The type of response variable

priors

Priors that the code will be using. Default priors are used if prior was not specified

code

Rjags model file code that is generated using information provided by the user. To view model file inside R, use cat(nof1$code).

Examples

1
2
3
4
5
6
7
###Blocker data example
laughter
Y <- laughter$Y
Treat <- laughter$Treat
nof1 <- nof1.data(Y, Treat, ncat = 11, baseline = "Usual Routine", response = "ordinal")
str(nof1)
cat(nof1$code)

MikeJSeo/nof1 documentation built on May 30, 2019, 3:41 p.m.