Title: | Incorporating Stability Information into Cross-Sectional Estimates |
---|---|
Description: | The goal of 'stim' is to provide a function for estimating the Stability Informed Model. The Stability Informed Model integrates stability information (how much a variable correlates with itself in the future) into cross-sectional estimates. Wysocki and Rhemtulla (2022) <https://psyarxiv.com/vg5as>. |
Authors: | Anna Wysocki [aut, cre] |
Maintainer: | Anna Wysocki <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2025-03-10 03:03:26 UTC |
Source: | https://github.com/annawysocki/stim |
Create a parameter table
effectTable(model)
effectTable(model)
model |
An object with the model description for the cross-sectional model in lavaan syntax |
A list with information on the cross-lagged paths and the residual covariances. The cross-lagged effect table has information on which cross-lagged effects to estimate and which to constrain. Each row represents one effect and specifies which variable is the predictor and outcome of the effect. The name column contains information on either the name of the estimated effect (e.g., CLxy) or what value the unestimated effect should be constrained to (e.g., .3). The residual covariance list has the lavaan syntax to specify that specific residuals should be allowed to covary, and a table with information on which variables should have covarying residuals and what the name of that residual covariance parameter should be.
#estimate effect from X to Y #constrain effect from Y to X to .3 #allow X and Y's residuals to covary model <- c('Y ~ X X ~ .3 * Y X ~~ Y') effectTable(model)
#estimate effect from X to Y #constrain effect from Y to X to .3 #allow X and Y's residuals to covary model <- c('Y ~ X X ~ .3 * Y X ~~ Y') effectTable(model)
Outputs Lavaan Summary
lavaanSummary(x, subset = NULL)
lavaanSummary(x, subset = NULL)
x |
a stim Object |
subset |
Specify which model(s) you would like summarized. Default is to output all estimated models |
Lavaan summary table
model <- 'Y~X' stability <- data.frame(X = c(.3, .4, .5), Y = c(.3, .5, .6)) dat <- data.frame(Y = rnorm(500, 0, 1), X = rnorm(500, 0, 1), Z = rnorm(500, 0, 1)) output <- stim(data = dat, model = model, stability = stability) lavaanSummary(output, subset = c(1,2))
model <- 'Y~X' stability <- data.frame(X = c(.3, .4, .5), Y = c(.3, .5, .6)) dat <- data.frame(Y = rnorm(500, 0, 1), X = rnorm(500, 0, 1), Z = rnorm(500, 0, 1)) output <- stim(data = dat, model = model, stability = stability) lavaanSummary(output, subset = c(1,2))
Estimate a Stability Informed Model
stim(data = NULL, S = NULL, n = NULL, model, stability)
stim(data = NULL, S = NULL, n = NULL, model, stability)
data |
A dataframe with the measured variables. Not needed if S is provided |
S |
A covariance matrix for the measured variables. Not needed if data is provided. |
n |
Number of observations. Not needed if data is provided. |
model |
An object with the cross-sectional model description in lavaan syntax |
stability |
An object that contains stability information for each variable in the model. |
An object of class stim
model <- 'Y~X' stability <- data.frame(X = .3, Y = .3) dat <- data.frame(Y = rnorm(500, 0, 1), X = rnorm(500, 0, 1)) stim(data = dat, model = model, stability = stability)
model <- 'Y~X' stability <- data.frame(X = .3, Y = .3) dat <- data.frame(Y = rnorm(500, 0, 1), X = rnorm(500, 0, 1)) stim(data = dat, model = model, stability = stability)
stim
objectsSummarize a set of Stability Informed Models
## S3 method for class 'stim' summary(object, ...)
## S3 method for class 'stim' summary(object, ...)
object |
An object of class |
... |
Not used |
A print out containing the results for a set of Stability Informed Models
model <- 'Y~X' stability <- data.frame(X = .3, Y = .3) dat <- data.frame(Y = rnorm(500, 0, 1), X = rnorm(500, 0, 1)) modelFit <- stim(data = dat, model = model, stability = stability) summary(modelFit)
model <- 'Y~X' stability <- data.frame(X = .3, Y = .3) dat <- data.frame(Y = rnorm(500, 0, 1), X = rnorm(500, 0, 1)) modelFit <- stim(data = dat, model = model, stability = stability) summary(modelFit)