nodes: Data Frame of Nodes within a BUGS model.

Description Usage Arguments Details Value Author(s) Examples

View source: R/nodes.R

Description

Provides a data.frame of both random and deterministic nodes in a tsbugs BUGS model. Can also be used to extract nodes from just a single part of the model, such as the prior distributions. This might be of particular use to users when setting up parameters to follow when running models through R2WinBUGS or R2OpenBUGS.

Usage

1
nodes(bug, part = NULL)

Arguments

bug

A time series BUGS model created using the tsbugs package.

part

A part of the tsbugs models. Must be one of "likelihood", "priors", "forecast" or "simulation". Abbreviations of these parts are allowed (pmatch is used for the matching).

Details

Provides a summary of nodes in all of, or part of, the tsbugs BUGS model. Returns a data frame with details on each node. When nodes are within a loop additional details on the starting and ending time points for the node are also given.

Value

A data.frame with columns:

name

Name of node.

type

Stochastic node represented by ~. Deterministic node represented by <-.

dt

Distribution or transformation in node.

beg

Beginning of node loop.

end

End of node loop.

stoc

Binary representation of type column, where 1 represents a stochastic node and 0 a deterministic node.

id

Line number of node in the BUGS model.

dist

Distribution in node.

param1

First parameter of distribution.

param2

Second parameter of distribution.

Author(s)

Guy J. Abel

Examples

1
2
3
4
5
6
7
8
9
# Create AR(1) model for Lake Huron data
LH <- LakeHuron
ar1 <- ar.bugs(y = diff(LH), ar.order = 1)

# All nodes in model
nodes(ar1)

# Priors in model
nodes(ar1, "priors") 

tsbugs documentation built on Jan. 26, 2019, 1:04 a.m.