Learn R Programming

piecewiseSEM (version 1.2.1)

endogenous.reverse: Updates basis set under certain conditions.

Description

A helper function for sem.missing.paths that reverses independence claims between intermediate endogenous variables fit to non-normal distributions.

Usage

endogenous.reverse(basis.set, modelList, add.vars)

Arguments

basis.set

a list of tests of conditional independence claims obtained from sem.basis.set.

modelList

a list of regressions representing the structural equation model.

add.vars

a vector of additional variables whose independence claims should be evaluated, but which do not appear in the model list.

Value

Returns a list of conditional independence claims. The list contains duplicated entries, reversing the independence claims between endogenous variables that also predict other variables in the model *only if* those variables are fitted to a non-normal distribution.

This is a temporary workaround for GLM(M)s that do not adhere to the property of symmetricity of independence claims as a function of transformations via the link function.

Examples

Run this code
# NOT RUN {
  data = data.frame(
    a = runif(50),
    b = runif(50, 0, 1),
    c = runif(50, 0, 1),
    d = runif(50)
  )
  
  modelList = list(
    glm(b ~ a, family = "binomial", data),
    glm(c ~ a, family = "binomial", data),
    lm(d ~ b + c, data)
  )
  
  (basis.set = sem.basis.set(modelList))
  
  endogenous.reverse(basis.set, modelList)
# }

Run the code above in your browser using DataLab