Skip to contents

Path coefficients It is advised to standardize the input data (see scale). By doing this, the standardized coefficients represents the relative strength of each causal relationship in the model.

Usage

pathCoef(x, FUN = "lm", formulaArg = "formula", cl, alpha = 0.05, ...)

# S3 method for dSep
pathCoef(x, ...)

# S3 method for graph
pathCoef(x, ...)

# S3 method for list
pathCoef(x, FUN = "lm", formulaArg = "formula", cl, alpha = 0.05, ...)

# S3 method for pathCoef
summary(object, ...)

# S3 method for pathCoef
plot(
  x,
  y,
  plotCoef = TRUE,
  legend = TRUE,
  lty = c(signif = 1, nonSignif = 2),
  alpha = 0.05,
  ...
)

Arguments

x

a pathCoef object.

FUN

a function or a the name of the function to test the conditional independences. Currently tested with lm, glm, gls, pgls, MCMCglmm and brm.

formulaArg

argument name from FUN that accepts the formula parameter of the lineal model.

cl

the number of CPU cores or a cluster object to run the models in parallel. Cluster object can be defined with makeCluster in package parallel or makeCluster from snow package.

alpha

significance level.

...

parameters passed to FUN. Parameters must be named following the FUN arguments (e.g. data=data.frame()).

plotCoef

if TRUE plot the path coefficients.

legend

if TRUE add a legend.

lty

a vector of 2 elements with the line type of significant and non significant paths.

Value

a pathCoef object.

Author

Joan Maspons <j.maspons@creaf.uab.cat>

Examples

## Dummy data
g1<- gRbase::dag(~a:c:d + b:d)
g2<- gRbase::dag(~a:c:d + b:d:a)
g<- list(m1=g1, m2=g2)
d<- data.frame(a=rnorm(100), b=rnorm(100), c=rnorm(100), d=rnorm(100))

p.a<- pathCoef(g1, FUN="lm", nobs=nrow(d), data=d)
#> Error in UseMethod("pathCoef"): no applicable method for 'pathCoef' applied to an object of class "igraph"
plot(p.b<- pathCoef(list(m1=g1, m2=g2), FUN="lm", nobs=nrow(d), data=d))
#> Error in (function (classes, fdef, mtable) {    methods <- .findInheritedMethods(classes, fdef, mtable)    if (length(methods) == 1L)         return(methods[[1L]])    else if (length(methods) == 0L) {        cnames <- paste0("\"", vapply(classes, as.character,             ""), "\"", collapse = ", ")        stop(gettextf("unable to find an inherited method for function %s for signature %s",             sQuote(fdef@generic), sQuote(cnames)), domain = NA)    }    else stop("Internal error in finding inherited methods; didn't return a unique method",         domain = NA)})(list("igraph"), new("standardGeneric", .Data = function (object,     ...) standardGeneric("edgeNames"), generic = structure("edgeNames", package = "graph"),     package = "graph", group = list(), valueClass = character(0),     signature = "object", default = NULL, skeleton = (function (object,         ...)     stop(gettextf("invalid call in method dispatch to '%s' (no default method)",         "edgeNames"), domain = NA))(object, ...)), <environment>): unable to find an inherited method for function ‘edgeNames’ for signature ‘"igraph"’