Description Details Author(s) References Examples

Implements piecewise structural equation modeling in R, complete with goodness-of-fit tests and retrieval of model coefficients. Compared with traditional variance-covariance based SEM, piecewise SEM allows for fitting of models to different distributions and/or incorporates hierarchical/nested random structures.

Supported model classes include: 'lm', 'rq', 'glm', 'glm.nb', 'gls', 'pgls', 'merMod', 'merModLmerTest', 'lme', 'glmmPQL', 'glmmadmb', and 'glmmTMB'.

Package: | piecewiseSEM |

Type: | Package |

Version: | 1.2.1 |

Date: | 2016-12-06 |

Depends: | R (3.3), ggm, lavaan, nlme, pbkrtest |

Suggests: | MASS, lme4 |

License: | MIT |

The primary functions in the package are `sem.fit`

which performs goodness-of-fit tests, and `sem.coefs`

which returns path coefficients (standardized, if specified) and standard errors.

Jon Lefcheck <[email protected]>

Shipley, Bill. "A new inferential test for path models based on directed acyclic graphs." Structural Equation Modeling 7.2 (2000): 206-218.

Shipley, Bill. Cause and correlation in biology: a user's guide to path analysis, structural equations and causal inference. Cambridge University Press, 2002.

Shipley, Bill. "Confirmatory path analysis in a generalized multilevel context." Ecology 90.2 (2009): 363-368.

Shipley, Bill. "The AIC model selection method applied to path analytic models compared using a d-separation test." Ecology 94.3 (2013): 560-564.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | ```
# Load example data
data(shipley2009)
# Reduce dataset for example
shipley2009.reduced = shipley2009[1:200, ]
# Load model packages
library(lme4)
library(nlme)
# Create list of models
shipley2009.reduced.modlist = list(
lme(DD ~ lat, random = ~1|site/tree, na.action = na.omit,
data = shipley2009.reduced),
lme(Date ~ DD, random = ~1|site/tree, na.action = na.omit,
data = shipley2009.reduced),
lme(Growth ~ Date, random = ~1|site/tree, na.action = na.omit,
data = shipley2009.reduced),
glmer(Live ~ Growth+(1|site)+(1|tree),
family=binomial(link = "logit"), data = shipley2009.reduced)
)
# Get goodness-of-fit and AIC
sem.fit(shipley2009.reduced.modlist, shipley2009.reduced)
# Extract path coefficients
sem.coefs(shipley2009.reduced.modlist, shipley2009.reduced)
## Not run:
# Repeat with full dataset as in Shipley (2009)
# Create list of models
shipley2009.modlist = list(
lme(DD ~ lat, random = ~1|site/tree, na.action = na.omit,
data = shipley2009),
lme(Date ~ DD, random = ~1|site/tree, na.action = na.omit,
data = shipley2009),
lme(Growth ~ Date, random = ~1|site/tree, na.action = na.omit,
data = shipley2009),
glmer(Live ~ Growth+(1|site)+(1|tree),
family=binomial(link = "logit"), data = shipley2009)
)
# Get goodness-of-fit and AIC
sem.fit(shipley2009.modlist, shipley2009)
# Extract path coefficients
sem.coefs(shipley2009.modlist, shipley2009)
## End(Not run)
``` |

piecewiseSEM documentation built on May 29, 2017, 6:05 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.