h.plateau: Define a plateau random effect

View source: R/h_plateau.R

h.plateauR Documentation

Define a plateau random effect

Description

Function to specify a plateau random effect in a hierarchical linear model. The plateau relationship corresponds to that described in Brewer et al. 2016. This function is not usually called directly but instead called during processing of the h terms in a hierarchical linear model specification.

Usage

h.plateau(
  var,
  effName = NULL,
  centreCovs = TRUE,
  scaleCovs = TRUE,
  suffix = "",
  platPrecPrior = "dgamma(0.001, 0.001)",
  platRhoPrior = "dunif(0.0, 1.0)",
  xapexPrior = "dnorm(0.0, 0.001)",
  yplateauOffsetPrior = "dgamma(0.001, 0.001)"
)

Arguments

var

The variable around which the hierarchical effect will be defined. This can be a data.frame, matrix, or a vector. If it is the latter then the plateau random effect will be defined as a univariate plateau relationship. If the input variable is a data.frame or a matrix, then the model will be implemented as a series of plateau relationships (one for each variable) with each variable having independent position parameters but shared precision and correlation parameters.

effName

A character scalar giving a name for the hierarchical effect being defined and used as name for the appropriate nodes.

centreCovs

A logical scalar denoting whether the fixed effects in the model should be centred before the analysis: each covariate element is subtracted by its mean. centreCovs can also be a function with one argument that is a vector of covariate values. In this case the variable is instead centred around the output of this function.

scaleCovs

A logical scalar denoting whether the fixed effects in the model should be scaled before the analysis: each covariate element is divided by its standard deviation. scaleCovs can also be a function with one argument that is a vector of covariate values. In this case the variable is instead scaled around the output of this function.

suffix

A character scalar giving an additional suffix applied to all elements created in the hierarchical model specification.

platPrecPrior

A character scalar containing the NIMBLE code that determines the distribution of the prior specification of the precision parameter of the magnitude of the ascending and descending coefficients.

platRhoPrior

A character scalar containing the NIMBLE code that determines the distribution of the prior specification of the correlation parameter of the magnitudes of the ascending and descending coefficients. If this is NULL then the magnitudes of the ascending and descending coefficients are fixed to be uncorrelated.

xapexPrior

A character scalar containing the NIMBLE code that determines the distribution of the prior specification of the position of apex of the plateau on the x-axis.

yplateauOffsetPrior

A character scalar containing the NIMBLE code that determines the distribution of the prior specification of the offset of the plateau from the position of the apex on the y-axis.

Value

A list element with the following named elements:

name

A character scalar containing the name of the hierarchical effect and is used as a name for intermediary variables

code

A character scalar containing the NIMBLE code specifying the hierarchical effect (and will be passed to nimbleCode)

constants

A list containing named elements corresponding to the variables used as constants needed for the hierarchical effect in nimbleModel

data

A list containing named elements corresponding to the data nodes used for the hierarchical effect in nimbleModel

inits

A named list of starting values for model variables used in the hierarchical effect and passed to nimbleModel

monitors

The nodes of the hierarchical effect to monitor in the MCMC and passed to configureMCMC

monitors2

The nodes of the hierarchical effect to monitor in the supplemental chain monitor in the MCMC and passed to configureMCMC

initCode

A list of language objects to run upon initialisation of the NIMBLE instance (see mcmcNIMBLERun)

exitCode

A list of language objects to run upon completion of the NIMBLE instance (see mcmcNIMBLERun)

runTimeGlobal

A list of objects to pass to be compied into each environment of each NIMBLE instance (see mcmcNIMBLERun)

projFunc

A function as produced by the nimbleFunction function that maps the random variables defined by the hierarchical model to the data. If NULL then it is assumed the effect is defined with the same structure as the data already

Author(s)

Joseph D. Chipperfield, joechip90@googlemail.com

See Also

nimbleCode, mcmcNIMBLERun, configureMCMC, nimbleFunction, h


joechip90/PaGAn documentation built on April 17, 2025, 4:05 p.m.