parse_gm_formula: Parse graphical model formula

View source: R/parse_gm_formula.R

parse_gm_formulaR Documentation

Parse graphical model formula

Description

Parse graphical model formula to internal representation

Usage

parse_gm_formula(
  formula,
  varnames = NULL,
  marginal = NULL,
  interactions = NULL,
  maximal_only = FALSE
)

Arguments

formula

A right hand sided formula or a list.

varnames

Specification of the variables.

marginal

Possible specification of marginal (a set of variables); useful in connection with model specification shortcuts.

interactions

The maximum order of interactions allowed; useful in connection with model specification shortcuts.

maximal_only

Should only maximal generators be retained.

Examples

vn <- c("me", "ve", "al", "an", "st")

form1 <- ~me:ve:al + ve:al + an
form2 <- ~me:ve:al + ve:al + s
form3 <- ~me:ve:al + ve:al + anaba
parse_gm_formula(form1, varnames=vn)
parse_gm_formula(form2, varnames=vn)
## parse_gm_formula(form3, varnames=vn)
parse_gm_formula(form1)
parse_gm_formula(form2)
parse_gm_formula(form3)

## parse_gm_formula(~.^1)
## parse_gm_formula(~.^.)

parse_gm_formula(~.^1, varnames=vn)
parse_gm_formula(~.^., varnames=vn)
parse_gm_formula(~.^., varnames=vn, interactions=3)

vn2 <- vn[1:3]
## parse_gm_formula(form1, varnames=vn, marginal=vn2)
## parse_gm_formula(form2, varnames=vn, marginal=vn2)
## parse_gm_formula(form3, varnames=vn, marginal=vn2)
parse_gm_formula(~.^1, varnames=vn, marginal=vn2)
parse_gm_formula(~.^., varnames=vn, marginal=vn2)


gRim documentation built on Oct. 16, 2024, 1:07 a.m.