fitADMG: Fit data to an ADMG model

View source: R/fitADMG.R

fitADMGR Documentation

Fit data to an ADMG model

Description

Fit discrete data to the Markov structure implied by an acyclic directed mixed graph or summary graph.

Usage

fitADMG(
  dat,
  graph,
  r = TRUE,
  tol = sqrt(.Machine$double.eps),
  SEs = TRUE,
  sparse = FALSE,
  quietly = TRUE,
  use_optim = TRUE
)

Arguments

dat

The data, as an array of counts or a data frame whose final column contains the counts.

graph

An ADMG (or summary graph), as an object of class graph.

r

Logical indicating whether or not recursive factorizations should be used.

tol

Numeric; if log-likelihood increases by less that tol in one step, procedure stops.

SEs

logical: should standard errors be calculated?

sparse

Should sparse matrices be used? Requires package Matrix.

quietly

Logical indicating whether output should be suppressed.

use_optim

should optim be used for fitting?

Details

Fits data using coordinate-wise block descent algorithm, with an Armijo line search. Details in Evans and Richardson (2010).

Recursive factorizations allow for modelling of Verma-constraints. See Richardson et al (2012).

Value

An object of class mixed_fit. This is a list containing (amongst other things):

params

An object of class Mparams, containing the Moebius parameters which maximise the likelihood.

ll

Value of the log-likelihood at the maximum.

Warning

For the algorithm to be guaranteed to work correctly, all counts for marginal tables consisting of districts and their parents should be positive. A warning will be produced if this is not so.

Author(s)

Robin Evans, Ilya Shpitser

References

Evans, R.J. and Richardson, T.S. (2010) - Fitting acyclic directed mixed graphs to binary data. UAI-10.

Richardson, T.S., Robins, J.M., Shpitser, I., Evans, R.J. (2012) -

See Also

summary.mixed_fit autoFit

Examples


data(gss_small)
data(gr1, package="MixedGraphs")

out = fitADMG(gss_small, gr1)
summary(out)
# not a good fit!


rje42/ADMGs2 documentation built on Sept. 3, 2024, 7:39 p.m.