categorical_bugs: Bugs code for Categorical response

View source: R/simulateabn.R

categorical_bugsR Documentation

Bugs code for Categorical response

Description

Bugs code for Categorical response

Usage

categorical_bugs(
  nodename,
  nodesCatIdx,
  parentnames,
  nodesintercepts,
  parentcoefs
)

categorical_bugsGroup(
  nodename,
  nodesCatIdx,
  nodesintercepts,
  parentnames,
  parentcoefs,
  sigma,
  sigma_alpha
)

Arguments

nodename

character string of response variable name.

nodesCatIdx

integer vector of length |K-1| and starting at k+1 (see Examples).

parentnames

single character string (for one parent) or vector of characters (for multiple parent nodes) with parent node (predictor variables) names.

nodesintercepts

overall mean of response. Parameter from fixed-effects intercept.

parentcoefs

overall slope for each predictor (parent node) variable (fixed-effects).

sigma

within-group variance. Parameter from random-effects residual.

sigma_alpha

between-group variance-covariance matrix. Parameters from random-effects intercept.

Details

The output of fitAbn with method = "mle" is based on the output of logistic regression models fit with either lm, glm, glmer, multinom, mblogit or internal irls methods. They all use the first factor level as reference level. Therefore, nodesCatIdx starts with index 2 and not 1. nodesintercepts and parentcoefs refer to the values of (Intercept) and Estimate of the respective model output. Predictor names build the keys in parentcoef.

Value

Bugs model returned as stdout.

Functions

  • categorical_bugsGroup(): Bugs code for Categorical response with varying intercept

See Also

makebugs simulateAbn

Examples

# A -> B
# Where B is a categorical variable with 4 levels.
categorical_bugs(nodename = "b",
                 nodesCatIdx = c(2, 3, 4),
                 parentnames = "a",
                 nodesintercepts = c(2.188650, 3.133928, 3.138531),
                 parentcoefs = list("a"=c(a=1.686432, a=3.134161, a=5.052104)))

abn documentation built on Nov. 3, 2023, 5:08 p.m.