Title: | Person-Oriented Method and Perturbation on the Model |
---|---|
Description: | An implementation of a hybrid method of person-oriented method and perturbation on the model. Pompom is the initials of the two methods. The hybrid method will provide a multivariate intraindividual variability metric (iRAM). The person-oriented method used in this package refers to uSEM (unified structural equation modeling, see Kim et al., 2007, Gates et al., 2010 and Gates et al., 2012 for details). Perturbation on the model was conducted according to impulse response analysis introduced in Lutkepohl (2007). Kim, J., Zhu, W., Chang, L., Bentler, P. M., & Ernst, T. (2007) <doi:10.1002/hbm.20259>. Gates, K. M., Molenaar, P. C. M., Hillary, F. G., Ram, N., & Rovine, M. J. (2010) <doi:10.1016/j.neuroimage.2009.12.117>. Gates, K. M., & Molenaar, P. C. M. (2012) <doi:10.1016/j.neuroimage.2012.06.026>. Lutkepohl, H. (2007, ISBN:3540262393). |
Authors: | Xiao Yang [cre, aut], Nilam Ram [aut], Peter Molenaar [aut] |
Maintainer: | Xiao Yang <[email protected]> |
License: | GPL-2 |
Version: | 0.2.1 |
Built: | 2024-11-16 04:20:36 UTC |
Source: | https://github.com/cran/pompom |
Bootstrapped iRAM (including replications of iRAM and corresponding time profiles) for the bivariate time-series (simts2node)
bootstrap_iRAM_2node
bootstrap_iRAM_2node
An object of class list
of length 5.
Data bootstrapped from the estimated three-node network structure with 200 replications.
bootstrap_iRAM_2node$mean # mean of bootstrapped iRAM bootstrap_iRAM_2node$upper # Upper bound of confidence interval of bootstrapped iRAM bootstrap_iRAM_2node$lower # lower bound of confidence interval of bootstrapped iRAM bootstrap_iRAM_2node$time.profile.data # time profiles generated from the bootstrapped beta matrices bootstrap_iRAM_2node$recovery.time.reps # iRAMs generated from the bootstrapped beta matrices
bootstrap_iRAM_2node$mean # mean of bootstrapped iRAM bootstrap_iRAM_2node$upper # Upper bound of confidence interval of bootstrapped iRAM bootstrap_iRAM_2node$lower # lower bound of confidence interval of bootstrapped iRAM bootstrap_iRAM_2node$time.profile.data # time profiles generated from the bootstrapped beta matrices bootstrap_iRAM_2node$recovery.time.reps # iRAMs generated from the bootstrapped beta matrices
Bootstrapped iRAM (including replications of iRAM and corresponding time profiles) for the 3-variate time-series (simts)
bootstrap_iRAM_3node
bootstrap_iRAM_3node
An object of class list
of length 5.
Data bootstrapped from the estimated three-node network structure with 200 replications.
bootstrap_iRAM_3node$mean # mean of bootstrapped iRAM bootstrap_iRAM_3node$upper # Upper bound of confidence interval of bootstrapped iRAM bootstrap_iRAM_3node$lower # lower bound of confidence interval of bootstrapped iRAM bootstrap_iRAM_3node$time.profile.data # time profiles generated from the bootstrapped beta matrices bootstrap_iRAM_3node$recovery.time.reps # iRAMs generated from the bootstrapped beta matrices
bootstrap_iRAM_3node$mean # mean of bootstrapped iRAM bootstrap_iRAM_3node$upper # Upper bound of confidence interval of bootstrapped iRAM bootstrap_iRAM_3node$lower # lower bound of confidence interval of bootstrapped iRAM bootstrap_iRAM_3node$time.profile.data # time profiles generated from the bootstrapped beta matrices bootstrap_iRAM_3node$recovery.time.reps # iRAMs generated from the bootstrapped beta matrices
Generate iRAM (impulse response anlaysis metric) from model fit.
iRAM( model.fit, beta, var.number, lag.order = 1, threshold = 0.01, boot = FALSE, replication = 200, steps = 100 )
iRAM( model.fit, beta, var.number, lag.order = 1, threshold = 0.01, boot = FALSE, replication = 200, steps = 100 )
model.fit |
model fit object generated by lavaan |
beta |
beta matrix for a point estimate |
var.number |
number of variables in the time series |
lag.order |
lag order of the model to be fit |
threshold |
threshold of calculation of recovery time (duration of perturbation), default value is 0.01 |
boot |
to bootstrap, default value is FALSE |
replication |
number of replication of bootstrap, default value is 200 |
steps |
number of steps of impulse response analysis, default value is 100 |
iRAM matrix. Rows represent where the orthognal impulse was given, and columns represent the response. Dimension is var.number by var.number.
Lütkepohl, H. (2007). New introduction to multiple time-series analysis. Berlin: Springer.
boot.iRAM <- iRAM(model.fit = usemmodelfit, beta = NULL, var.number = 3, lag.order = 1, threshold = 0.01, boot = TRUE, replication = 200, steps = 100 ) boot.iRAM$mean
boot.iRAM <- iRAM(model.fit = usemmodelfit, beta = NULL, var.number = 3, lag.order = 1, threshold = 0.01, boot = TRUE, replication = 200, steps = 100 ) boot.iRAM$mean
Generate iRAM (impulse response anlaysis metric) in the equilibrium form.
iRAM_equilibrium(beta.matrix, var.number, lag.order)
iRAM_equilibrium(beta.matrix, var.number, lag.order)
beta.matrix |
beta matrix for a point estimate |
var.number |
number of variables in the time series |
lag.order |
lag order of the model to be fit |
a list of equilibria. First numeric number in the variable name indicate where the impulse was given, and the second numeric number indicate the response, e.g., e12 indicates equilibrium of node 2 when node 1 is given an impulse.
iRAM_evalue <- iRAM_equilibrium(beta.matrix = true_beta_3node, var.number = 3, lag.order = 1 ) iRAM_evalue
iRAM_evalue <- iRAM_equilibrium(beta.matrix = true_beta_3node, var.number = 3, lag.order = 1 ) iRAM_evalue
Provide model summary.
model_summary(model.fit, var.number, lag.order)
model_summary(model.fit, var.number, lag.order)
model.fit |
model fit object generated by lavaan |
var.number |
number of variables in the time-series |
lag.order |
lag order of model |
Model fit criteria: 3 out of 4 rule, meaning 3 out of 4 critea should be satisfied, including CFI and TLI should be greater than 0.95, RMSEA and SRMR should be less than 0.08.
beta matrix estimates
matrix of standard error of beta
matrix of psi estimates
fit statistics CFI
fit statistics TLI
fit statistics RMSEA
fit statistics SRMR
mdl <- model_summary(model.fit = usemmodelfit, var.number = 3, lag.order = 1) mdl$beta mdl$beta.se mdl$psi mdl$cfi mdl$tli mdl$rmsea mdl$srmr
mdl <- model_summary(model.fit = usemmodelfit, var.number = 3, lag.order = 1) mdl$beta mdl$beta.se mdl$psi mdl$cfi mdl$tli mdl$rmsea mdl$srmr
Parse the beta from model fit object
parse_beta(var.number, model.fit, lag.order, matrix = F)
parse_beta(var.number, model.fit, lag.order, matrix = F)
var.number |
number of variables in the time series |
model.fit |
model fit object generated by lavaan |
lag.order |
lag order of the model to be fit |
matrix |
output beta in matrix format or estimates format, default value is FALSE (as estimates) |
beta
data(usemmodelfit) beta.matrix <- parse_beta(var.number = 3, model.fit = usemmodelfit, lag.order = 1, matrix = TRUE) beta.matrix
data(usemmodelfit) beta.matrix <- parse_beta(var.number = 3, model.fit = usemmodelfit, lag.order = 1, matrix = TRUE) beta.matrix
Plot the time profiles in the integrated form
plot_integrated_time_profile(beta.matrix, var.number, lag.order = 1)
plot_integrated_time_profile(beta.matrix, var.number, lag.order = 1)
beta.matrix |
matrix of temporal relations, cotaining both lag-1 and contemporaneous |
var.number |
number of variables in the time series |
lag.order |
lag order of the model to be fit |
plot_integrated_time_profile(beta.matrix = true_beta_3node, var.number = 3, lag.order = 1)
plot_integrated_time_profile(beta.matrix = true_beta_3node, var.number = 3, lag.order = 1)
Plot distribution of recovery time based on bootstrapped version of iRAM
plot_iRAM_dist(recovery.time.reps)
plot_iRAM_dist(recovery.time.reps)
recovery.time.reps |
bootstrapped version of recovery time |
plot_iRAM_dist(bootstrap_iRAM_3node$recovery.time.reps)
plot_iRAM_dist(bootstrap_iRAM_3node$recovery.time.reps)
Plot the network graph
plot_network_graph(beta, var.number)
plot_network_graph(beta, var.number)
beta |
matrix of temporal relations, cotaining both lag-1 and contemporaneous |
var.number |
number of variables in the time series |
plot_network_graph(beta = true_beta_3node, var.number = 3)
plot_network_graph(beta = true_beta_3node, var.number = 3)
Plot time profiles given a time-series generated by impulse response analysis
plot_time_profile(time.series.data, var.number, threshold = 0.01, xupper = 20)
plot_time_profile(time.series.data, var.number, threshold = 0.01, xupper = 20)
time.series.data |
data of impulse response in long format |
var.number |
number of variables in the time-series |
threshold |
threshold of asymptote of equilibrium |
xupper |
upper limit of x-axis |
plot_time_profile(time.series.data = bootstrap_iRAM_2node$time.profile.data, var.number = 2, threshold= .01, xupper = 20)
plot_time_profile(time.series.data = bootstrap_iRAM_2node$time.profile.data, var.number = 2, threshold= .01, xupper = 20)
Simulated bivariate time-series data
simts_2node
simts_2node
An object of class data.frame
with 200 rows and 2 columns.
Data simulated from a given three-node network structure with 200 measurements. Network structure is shown in the dataset true.beta. Process noise has mean of 0 and SD .1.
data(simts_2node)
data(simts_2node)
Simulated 3-variate time-series data
simts_3node
simts_3node
An object of class data.frame
with 100 rows and 3 columns.
Data simulated from a given three-node network structure with 200 measurements. Network structure is shown in the dataset true.beta. Process noise has mean of 0 and SD .1.
data(simts_3node)
data(simts_3node)
The true beta matrix (4 by 4) used in simulation.
true_beta_2node
true_beta_2node
An object of class matrix
(inherits from array
) with 4 rows and 4 columns.
true_beta_2node <- matrix(c(0,0,0,0, 0,0,0,0, 0.2,-.4,0,-0.25, 0,0.3,-0.2,0), nrow = 4, ncol = 4, byrow = TRUE)
true_beta_2node
true_beta_2node
The true beta matrix (6 by 6) used in simulation.
true_beta_3node
true_beta_3node
An object of class matrix
(inherits from array
) with 6 rows and 6 columns.
true_beta_3node <- matrix(c(0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,0,0,0, 0.2,0,0.25,0,0,0.6, 0,0.3,0,-0.2,0,-0.6, 0,-0.2,0.3,0,0,0), nrow = 6, ncol = 6, byrow = TRUE)
true_beta_3node
true_beta_3node
Fit a multivariate time series with uSEM (unified Structural Equation Model).
uSEM(var.number, data, lag.order = 1, verbose = FALSE, trim = FALSE)
uSEM(var.number, data, lag.order = 1, verbose = FALSE, trim = FALSE)
var.number |
number of variables in the time series |
data |
time series data, must be in long format |
lag.order |
lag order of the model to be fit, default value is 1. Note: Higher order (greater than 1) might not run. |
verbose |
print intermediate model fit (iterations), default value is FALSE |
trim |
to trim the insignificant betas (just one step, not iterative), default value is FALSE |
The purpose of uSEM is to quantify the temporal relations (both contemporaneous and lag-1) between variables. Model specification and estimation can be found in the references.
model fit object generated by lavaan
Kim, J., Zhu, W., Chang, L., Bentler, P. M., & Ernst, T. (2007). Unified Structural Equation Modeling Approach for the Analysis of Multisubject, Multivariate Functional MRI Data. Human Brain Mapping, 93, 85–93. doi:10.1002/hbm.20259
Gates, K. M., & Molenaar, P. C. M. (2012). Group search algorithm recovers effective connectivity maps for individuals in homogeneous and heterogeneous samples. NeuroImage 63(1), 310-319. doi: 10.1016/j.neuroimage.2012.06.026
Gates, K. M., Molenaar, P. C. M., Hillary, F. G., Ram, N., & Rovine, M. J. (2010). Automatic search for fMRI connectivity mapping: An alternative to Granger causality testing using formal equivalences among SEM path modeling, VAR, and unified SEM. NeuroImage, 50(3), 1118–1125. doi: 10.1016/j.neuroimage.2009.12.117
model.fit <- uSEM(var.number = 3, data = simts_3node, lag.order = 1, verbose = FALSE, trim = FALSE) model.fit
model.fit <- uSEM(var.number = 3, data = simts_3node, lag.order = 1, verbose = FALSE, trim = FALSE) model.fit
Model fitbased on similated time-series by uSEM.
usemmodelfit
usemmodelfit
An object of class lavaan
of length 1.
data(usemmodelfit)
data(usemmodelfit)