Learn R Programming

phylopath (version 1.4.0)

coef.fitted_DAG: Extract the coefficients and confidence intervals of a fitted causal model.

Description

coef() returns the path coefficients as a named vector, and confint() the bounds of their confidence intervals. Both name each path as "from -> to" and return them in the same order, so they can be combined with cbind(). Paths that are absent from the causal model are not included. For a data frame with the standard errors alongside the coefficients, see as.data.frame.fitted_DAG().

Usage

# S3 method for fitted_DAG
coef(object, ...)

# S3 method for fitted_DAG confint(object, parm, level = 0.95, ...)

Value

For coef(), a named numeric vector with one element per path. For confint(), a matrix with a row per path and the lower and upper bound in its two columns.

Arguments

object

An object of class fitted_DAG.

...

Ignored, present for consistency with the generic.

parm

The paths for which to return intervals, given as names or indices. Defaults to all of them.

level

The confidence level, which has to be 0.95 for now.

Details

Note that these are not the parametric intervals that confint() returns for most model objects, but the ones that were stored when the model was made: bootstrap intervals after fitting with boot, and normal intervals around the averaged estimate for a model from average().

Examples

Run this code
  d <- DAG(LS ~ BM, NL ~ BM, DD ~ NL + LS)
  d_fitted <- est_DAG(d, rhino, rhino_tree, 'lambda')
  coef(d_fitted)

  # Confidence intervals require the model to be fitted with bootstrapping.
  # \donttest{
    d_boot <- est_DAG(d, rhino, rhino_tree, 'lambda', boot = 100)
    confint(d_boot)
    cbind(coef = coef(d_boot), confint(d_boot))
  # }

Run the code above in your browser using DataLab