Package: dynr 0.1.16-105

Michael D. Hunter

dynr: Dynamic Models with Regime-Switching

Intensive longitudinal data have become increasingly prevalent in various scientific disciplines. Many such data sets are noisy, multivariate, and multi-subject in nature. The change functions may also be continuous, or continuous but interspersed with periods of discontinuities (i.e., showing regime switches). The package 'dynr' (Dynamic Modeling in R) is an R package that implements a set of computationally efficient algorithms for handling a broad class of linear and nonlinear discrete- and continuous-time models with regime-switching properties under the constraint of linear Gaussian measurement functions. The discrete-time models can generally take on the form of a state-space or difference equation model. The continuous-time models are generally expressed as a set of ordinary or stochastic differential equations. All estimation and computations are performed in C, but users are provided with the option to specify the model of interest via a set of simple and easy-to-learn model specification functions in R. Model fitting can be performed using single-subject time series data or multiple-subject longitudinal data. Ou, Hunter, & Chow (2019) <doi:10.32614%2FRJ-2019-012> provided a detailed introduction to the interface and more information on the algorithms.

Authors:Lu Ou [aut], Michael D. Hunter [aut, cre], Sy-Miin Chow [aut], Linying Ji [aut], Meng Chen [aut], Hui-Ju Hung [aut], Jungmin Lee [aut], Yanling Li [aut], Jonathan Park [aut], Massachusetts Institute of Technology [cph], S. G. Johnson [cph], Benoit Scherrer [cph], Dieter Kraft [cph]

dynr_0.1.16-105.tar.gz
dynr_0.1.16-105.tar.gz(r-4.5-noble)dynr_0.1.16-105.tar.gz(r-4.4-noble)
dynr_0.1.16-105.tgz(r-4.4-emscripten)dynr_0.1.16-105.tgz(r-4.3-emscripten)
dynr.pdf |dynr.html
dynr/json (API)
NEWS

# Install 'dynr' in R:
install.packages('dynr', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/mhunter1/dynr/issues

Uses libs:
  • gsl– GNU Scientific Library (GSL)
Datasets:
  • EMG - Single-subject time series of facial electromyography data
  • EMGsim - Simulated single-subject time series to capture features of facial electromyography data
  • LinearOsc - Simulated time series data for a deterministic linear damped oscillator model
  • LogisticSetPointSDE - Simulated time series data for a stochastic linear damped oscillator model with logistic time-varying setpoints
  • NonlinearDFAsim - Simulated multi-subject time series based on a dynamic factor analysis model with nonlinear relations at the latent level
  • Oscillator - Simulated time series data of a damped linear oscillator
  • Outliers - Simulated time series data for detecting outliers.
  • PFAsim - Simulated time series data of a multisubject process factor analysis
  • PPsim - Simulated time series data for multiple eco-systems based on a predator-and-prey model
  • RSPPsim - Simulated time series data for multiple eco-systems based on a regime-switching predator-and-prey model
  • TrueInit_Y14 - Simulated multilevel multi-subject time series of a Van der Pol Oscillator
  • VARsim - Simulated time series data for multiple imputation in dynamic modeling.
  • oscData - Another simulated multilevel multi-subject time series of a damped oscillator model
  • vdpData - Another simulated multilevel multi-subject time series of a Van der Pol Oscillator

gsl

6.09 score 2 stars 62 scripts 40k downloads 1 mentions 30 exports 109 dependencies

Last updated 1 years agofrom:96dda34c0d. Checks:OK: 1 NOTE: 1. Indexed: no.

TargetResultDate
Doc / VignettesOKNov 25 2024
R-4.5-linux-x86_64NOTENov 25 2024

Exports:coef<-diagdynr.configdynr.cookdynr.datadynr.flowFielddynr.ggplotdynr.ldldynr.midynr.modeldynr.plotFreqdynr.tastedynr.taste2dynr.trajectorydynr.versiongetdxplotFormulaplotGCVprep.formulaDynamicsprep.initialprep.loadingsprep.matrixDynamicsprep.measurementprep.noiseprep.regimesprep.tfunprintprintexshowtheta_plot

Dependencies:abindashbackportsbitbit64bitopsbootbroomcarcarDataclicliprclustercodetoolscolorspacecowplotcpp11crayonDerivdeSolvedoBydplyrfansifarverfdafdsFNNforcatsforeachFormulagenericsggplot2glmnetgluegtablehavenhdrcdehmsisobanditeratorsjomokernlabKernSmoothkslabelinglatex2explatticelifecyclelme4locfitmagrittrMASSMatrixMatrixModelsmclustmgcvmicemicrobenchmarkminqamitmlmodelrmulticoolmunsellmvtnormnlmenloptrnnetnumDerivordinalpanpbkrtestpcaPPpillarpkgconfigplyrpracmaprettyunitsprogresspurrrquantregR6rainbowrbibutilsRColorBrewerRcppRcppEigenRCurlRdpackreadrreshape2rlangrpartscalesshapeSparseMstringistringrsurvivaltibbletidyrtidyselecttzdbucminfutf8vctrsviridisLitevroomwithrxtable

Example: A Linear Stochastic Differential Equation Model

Rendered fromlinearSDE.Rmdusingknitr::rmarkdownon Nov 25 2024.

Last update: 2022-10-17
Started: 2018-09-15

Installation for Developers

Rendered fromInstallationForDevelopers.Rnwusingutils::Sweaveon Nov 25 2024.

Last update: 2023-11-29
Started: 2018-09-15

Installation for Users

Rendered fromInstallationForUsers.Rnwusingutils::Sweaveon Nov 25 2024.

Last update: 2023-11-29
Started: 2017-05-21

Linear discrete-time regime-switching models

Rendered fromLinearDiscreteTimeModels.Rnwusingutils::Sweaveon Nov 25 2024.

Last update: 2022-10-17
Started: 2018-09-15

Nonlinear continuous-time models

Rendered fromNonlinearContinuousTimeModels.Rnwusingutils::Sweaveon Nov 25 2024.

Last update: 2019-09-12
Started: 2018-09-15

Readme and manuals

Help Manual

Help pageTopics
Dynamic Models with Regime-Switchingdynr-package dynr
The ggplot of the outliers estimates.autoplot.dynrTaste
Extract fitted parameters from a dynrCook Objectcoef.dynrCook coef.dynrModel coef<- coef<-.dynrModel
Confidence Intervals for Model Parametersconfint.dynrCook
Create a diagonal matrix from a character vectordiag diag,character-method diag.character
Check that dynr in configured properlydynr.config
Cook a dynr model to estimate its free parametersdynr.cook
Create a list of data for parameter estimation (cooking dynr) using 'dynr.cook'dynr.data
A Function to plot the flow or velocity field for a one or two dimensional autonomous ODE system from the phaseR package written by Michael J. Grayling.dynr.flowField
The ggplot of the smoothed state estimates and the most likely regimesautoplot.dynrCook dynr.ggplot
LDL Decomposition for Matricesdynr.ldl
Multiple Imputation of dynrModel objectsdynr.mi
Create a dynrModel object for parameter estimation (cooking dynr) using 'dynr.cook'dynr.model
Plot of the estimated frequencies of the regimes across all individuals and time points based on their smoothed regime probabilitiesdynr.plotFreq
Detect outliers in state space models.dynr.taste
Re-fit state-space model using the estimated outliers.dynr.taste2
A Function to perform numerical integration of the chosen ODE system, for a user-specified set of initial conditions. Plots the resulting solution(s) in the phase plane. This function from the phaseR package written by Michael J. Grayling.dynr.trajectory
Current Version Stringdynr.version
The dynrCook Class$,dynrCook-method dynrCook-class dynrDebug-class print,dynrCook-method show,dynrCook-method
The dynrDynamics ClassdynrDynamics-class dynrDynamicsFormula-class dynrDynamicsMatrix-class
The dynrInitial ClassdynrInitial-class
The dynrMeasurement ClassdynrMeasurement-class
The dynrModel Class$,dynrModel-method $<-,dynrModel-method dynrModel-class print,dynrModel-method show,dynrModel-method
The dynrNoise ClassdynrNoise-class
The dynrRecipe Class$,dynrRecipe-method dynrRecipe-class print,dynrRecipe-method show,dynrRecipe-method
The dynrRegimes ClassdynrRegimes-class
The dynrTrans ClassdynrTrans-class
Single-subject time series of facial electromyography dataEMG
Simulated single-subject time series to capture features of facial electromyography dataEMGsim
Extend a user-specified model to include random variblesExpandRandomAsLVModel
A wrapper function to call functions in the fda package to obtain smoothed estimated derivatives at a specified ordergetdx
Do internal model preparation for dynrinternalModelPrep
Simulated time series data for a deterministic linear damped oscillator modelLinearOsc
Simulated time series data for a stochastic linear damped oscillator model with logistic time-varying setpointsLogisticSetPointSDE
Extract the log likelihood from a dynrCook Objectdeviance.dynrCook logLik.dynrCook
Extract the free parameter names of a dynrCook objectnames,dynrCook-method
Extract the free parameter names of a dynrModel objectnames,dynrModel-method
Extract the number of observations for a dynrCook objectnobs.dynrCook
Extract the number of observations for a dynrModel objectnobs.dynrModel
Simulated multi-subject time series based on a dynamic factor analysis model with nonlinear relations at the latent levelNonlinearDFAsim
Another simulated multilevel multi-subject time series of a damped oscillator modeloscData
Simulated time series data of a damped linear oscillatorOscillator
Simulated time series data for detecting outliers.Outliers
Simulated time series data of a multisubject process factor analysisPFAsim
Plot method for dynrCook objectsplot.dynrCook
Plot the formula from a modelplotFormula
A function to evaluate the generalized cross-validation (GCV) values associated with derivative estimates via Bsplines at a range of specified smoothing parameter (lambda) valuesplotGCV
Simulated time series data for multiple eco-systems based on a predator-and-prey modelPPsim
'predict' method for 'dynrModel' objectspredict.dynrModel
Recipe function for specifying dynamic functions using formulasprep.formulaDynamics
Recipe function for preparing the initial conditions for the model.prep.initial
Recipe function to quickly create factor loadingsprep.loadings
Recipe function for creating Linear Dynamics using matricesprep.matrixDynamics
Prepare the measurement recipeprep.measurement
Recipe function for specifying the measurement error and process noise covariance structuresprep.noise
Recipe function for creating regime switching (Markov transition) functionsprep.regimes
Create a dynrTrans object to handle the transformations and inverse transformations of model paramtersprep.tfun
The printex Methodprintex printex,dynrCook-method printex,dynrDynamicsFormula-method printex,dynrDynamicsMatrix-method printex,dynrInitial-method printex,dynrMeasurement-method printex,dynrModel-method printex,dynrNoise-method printex,dynrRegimes-method
Simulated time series data for multiple eco-systems based on a regime-switching predator-and-prey modelRSPPsim
Get the summary of a dynrCook objectsummary.dynrCook
A function to plot simple slopes and region of significance.theta_plot
Simulated multilevel multi-subject time series of a Van der Pol OscillatorTrueInit_Y14
Simulated time series data for multiple imputation in dynamic modeling.VARsim
Extract the Variance-Covariance Matrix of a dynrCook objectvcov.dynrCook
Another simulated multilevel multi-subject time series of a Van der Pol OscillatorvdpData