-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
... to keep up with improved interface in `dsem`
- Loading branch information
1 parent
54b879f
commit f5583ed
Showing
8 changed files
with
159 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
^_pkgdown\.yml$ | ||
^docs$ | ||
^pkgdown$ | ||
^scratch$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# dsem 1.0.1 | ||
|
||
* Fix bug in `simulate.dsem` to keep up with changing interface in `dsem` | ||
* Update CITATION to indicate accepted paper | ||
|
||
# dsem 1.0.0 | ||
|
||
* Initial public release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
# dsem | ||
Dynamic structural equation models. | ||
|
||
[![](https://cranlogs.r-pkg.org/badges/dsem)](https://cran.r-project.org/package=dsem) | ||
|
||
[![DOI](https://zenodo.org/badge/656795688.svg)](https://zenodo.org/doi/10.5281/zenodo.10304770) | ||
|
||
## Dynamic structural equation models | ||
Package _dsem_ fits dynamic structural equation models, which includes as nested submodels: | ||
* structural equation models | ||
* vector autoregressive models | ||
* dynamic factor analysis | ||
* state-space autoregressive integrated moving average (ARIMA) models | ||
|
||
1. structural equation models | ||
2. vector autoregressive models | ||
3. dynamic factor analysis | ||
4. state-space autoregressive integrated moving average (ARIMA) models | ||
|
||
The model has several advantages: | ||
* It estimates direct, indirect, and total effects among system variables | ||
* It can estimate the cumulative outcome from press or pulse experiments or initial conditions | ||
* It jointly estimates structural linkages and imputes missing values | ||
* It is rapidly fitted as a Gaussian Markov random field (GMRF) in a Generalized Linear Mixed Model (GLMM), with speed and asymptotics associated with each. | ||
|
||
_phylosem_ is specifically intended as a minimal implementation, and uses standard packages for input/output formatting: | ||
* It estimates direct, indirect, and total effects among system variables, including simultaneous and lagged effects and recursive (cyclic) dependencies | ||
* It can estimate the cumulative outcome from press or pulse experiments or initial conditions that differ from the stationary distribution of system dynamics | ||
* It estimates structural linkages as regression slopes while jointly imputing missing values and/or measurement errors | ||
* It is rapidly fitted as a Gaussian Markov random field (GMRF) in a Generalized Linear Mixed Model (GLMM), with speed and asymptotics associated with each | ||
* It allows granular control over the number of parameters (and restrictions on parameters) used to structure the covariance among variables and over time, | ||
|
||
_phylosem_ is specifically intended as a minimal implementation, and uses standard packages to simplify input/output formatting: | ||
|
||
* Input: time-series defined using class _ts_, with `NA` for missing values | ||
* Input: structural trade-offs specified using syntax defined by package _sem_ | ||
* Output: visualizing estimated trade-offs using _igraph_ | ||
* Output: access model output using standard S3-generic functions including `summary`, `predict`, `residuals`, and `simulate` | ||
* Output: access model output using standard S3-generic functions including `summary`, `predict`, `residuals`, `simulate`, and `AIC` | ||
|
||
Please see package vignettes for more details regarding syntax and features. | ||
|
||
[![](https://cranlogs.r-pkg.org/badges/dsem)](https://cran.r-project.org/package=dsem) | ||
|
||
[![DOI](https://zenodo.org/badge/656795688.svg)](https://zenodo.org/doi/10.5281/zenodo.10304770) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
citHeader("For methodological details regarding dynamic structural equation models, please see Thorson et al. (2024).") | ||
|
||
bibentry(bibtype = "Article", | ||
textVersion = "Thorson, J. T., Andrews, A. G., Essington, T., & Large, S. (In press). Dynamic structural equation models synthesize ecosystem dynamics constrained by ecological mechanisms. Methods in Ecology and Evolution.", | ||
title = "Dynamic structural equation models synthesize ecosystem dynamics constrained by ecological mechanisms", | ||
journal = "Methods in Ecology and Evolution", | ||
year = "2024", | ||
author = c(person(given = c("J.", "T."), | ||
family = "Thorson"), | ||
person(given = c("A.", "G."), | ||
family = "Andrews"), | ||
person(given = "T.", | ||
family = "Essington"), | ||
person(given = "S.", | ||
family = "Large"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
|
||
root_dir = R'(C:\Users\James.Thorson\Desktop\Work files\Collaborations\2023 -- DSEM\CRAN submission)' | ||
|
||
library(devtools) | ||
setwd( R'(C:\Users\James.Thorson\Desktop\Git\dsem)' ) | ||
|
||
# Compile | ||
if( FALSE ){ | ||
document() | ||
} | ||
|
||
# Test install | ||
install_local(force=TRUE, dep=TRUE, build_vignettes=TRUE, upgrade=FALSE) | ||
#install_local(force=TRUE, dep=TRUE, build_vignettes=FALSE, upgrade=FALSE) | ||
browseVignettes("dsem") | ||
|
||
# | ||
if( FALSE ){ | ||
library(TMB) | ||
setwd( R'(C:\Users\James.Thorson\Desktop\Git\dsem\src)' ) | ||
compile("dsem.cpp") | ||
} | ||
|
||
# Try building vignetttes | ||
if( FALSE ){ | ||
library(rmarkdown) | ||
setwd( R'(C:\Users\James.Thorson\Desktop\Git\dsem\vignettes)' ) | ||
devtools::build_rmd("vignettes/vignette.Rmd") | ||
render( file.path(getwd(),"vignette.Rmd"), pdf_document()) | ||
} | ||
|
||
# Try mapping dependencies | ||
if( FALSE ){ | ||
# Simple way | ||
library(renv) | ||
x = dependencies() | ||
|
||
# Listed dependencies | ||
tools::package_dependencies("dsem") | ||
tools::package_dependencies("dynlm") | ||
|
||
# All | ||
pack <- available.packages() | ||
pack["dynlm","Depends"] | ||
packrat:::recursivePackageDependencies("dynlm", ignore = "", lib.loc = .libPaths()[1], fields="Imports") | ||
} | ||
|
||
# Run checks ... doesn't seem to work | ||
file.remove( file.path("vignettes","vignette.pdf") ) | ||
#check( remote = TRUE, manual=TRUE ) | ||
check( manual=TRUE ) | ||
|
||
# Check manual | ||
if( FALSE ){ | ||
tools::texi2pdf | ||
} | ||
|
||
# Check online but document first! | ||
document() | ||
check_win_devel() | ||
|
||
# Submit to CRAN via devtools .. not preferred! | ||
if( FALSE ){ | ||
file.remove( file.path("vignettes","vignette.pdf") ) | ||
release() | ||
} | ||
|
||
# Build for uploading via web interface | ||
# https://cran.r-project.org/submit.html | ||
build( path=root_dir, manual=TRUE ) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Author: Kevin See | ||
# Purpose: Build a website for this package using pkgdown | ||
# Created: 5/17/2021 | ||
# Last Modified: 5/17/2021 | ||
# Notes: Based on instructions found here: https://pkgdown.r-lib.org/index.html | ||
|
||
setwd(R'(C:\Users\James.Thorson\Desktop\Git\dsem)') | ||
|
||
#----------------------------------------------------------------- | ||
# load needed libraries | ||
library(pkgdown) | ||
|
||
|
||
# Only needed once | ||
if( FALSE ){ | ||
# set up to automatically publish pkgdown site to GitHub | ||
# usethis::create_github_token() | ||
# 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 | ||
# gitcreds::gitcreds_set(url = "https://github.com") | ||
usethis::use_pkgdown_github_pages() | ||
|
||
|
||
# Run once to configure your package to use pkgdown | ||
usethis::use_pkgdown() | ||
|
||
# check that _pkgdown.yml looks good | ||
pkgdown::check_pkgdown() | ||
} | ||
|
||
# Run to build the website | ||
pkgdown::build_site( examples=TRUE ) | ||
# build_articles( lazy = FALSE ) | ||
|
||
# to look at the site | ||
pkgdown::preview_site() | ||
|
||
#----------------------------------------------------------------- | ||
# deploy site to gh-pages branch on GitHub | ||
pkgdown::deploy_to_branch() |