Package 'stim'

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

Help Index


Create a parameter table

Description

Create a parameter table

Usage

effectTable(model)

Arguments

model

An object with the model description for the cross-sectional model in lavaan syntax

Value

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.

Examples

#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

Description

Outputs Lavaan Summary

Usage

lavaanSummary(x, subset = NULL)

Arguments

x

a stim Object

subset

Specify which model(s) you would like summarized. Default is to output all estimated models

Value

Lavaan summary table

Examples

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

Description

Estimate a Stability Informed Model

Usage

stim(data = NULL, S = NULL, n = NULL, model, stability)

Arguments

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.

Value

An object of class stim

Examples

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)

Summary method for stim objects

Description

Summarize a set of Stability Informed Models

Usage

## S3 method for class 'stim'
summary(object, ...)

Arguments

object

An object of class stim

...

Not used

Value

A print out containing the results for a set of Stability Informed Models

See Also

stim

Examples

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)