Title: | Structural Equation Modeling Using the Reticular Action Model (RAM) Notation |
---|---|
Description: | We rewrite of RAMpath software developed by John McArdle and Steven Boker as an R package. In addition to performing regular SEM analysis through the R package lavaan, RAMpath has unique features. First, it can generate path diagrams according to a given model. Second, it can display path tracing rules through path diagrams and decompose total effects into their respective direct and indirect effects as well as decompose variance and covariance into individual bridges. Furthermore, RAMpath can fit dynamic system models automatically based on latent change scores and generate vector field plots based upon results obtained from a bivariate dynamic system. Starting version 0.4, RAMpath can conduct power analysis for both univariate and bivariate latent change score models. |
Authors: | Zhiyong Zhang, Jack McArdle, Aki Hamagami, & Kevin Grimm |
Maintainer: | Zhiyong Zhang <[email protected]> |
License: | GPL-2 |
Version: | 0.5.1 |
Built: | 2025-02-07 05:42:26 UTC |
Source: | https://github.com/cran/RAMpath |
We rewrite of RAMpath software developed by John McArdle and Steven Boker as an R package. In addition to performing regular SEM analysis through the R package lavaan, RAMpath has unique features. First, it can generate path diagrams according to a given model. Second, it can display path tracing rules through path diagrams and decompose total effects into their respective direct and indirect effects as well as decompose variance and covariance into individual bridges. Furthermore, RAMpath can fit dynamic system models automatically based on latent change scores and generate vector field plots based upon results obtained from a bivariate dynamic system. Starting version 0.4, RAMpath can conduct power analysis for both univariate and bivariate latent change score models.
Package: | RAMpath |
Type: | Package |
License: | GPL |
Zhiyong Zhang, Jack McArdle, Aki Hamagami, and Kevin Grimm Maintainer: Zhiyong Zhang <[email protected]>
Boker, S. M., McArdle, J. J. & Neale, M. C. (2002) An algorithm for the hierarchical organization of path diagrams and calculation of components of covariance between variables. Structural Equation Modeling, 9(2), 174-194
Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1-36. URL https://www.jstatsoft.org/v48/i02/.
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
Three variables in the data set:
age:
hvlt: Hopkins Verbal Learning Test
ept: Everyday problem solving test
data(ex1)
data(ex1)
Five variables in the data set:
edu
gender
word sets (ws1)
letter set (ls1)
letter series (lt1)
data(ex2)
data(ex2)
12 variables in the data set:
X1-X6: data for variable X from time 1 to time 6.
Y1-Y6: data for variable X from time 1 to time 6.
data(ex3)
data(ex3)
Check whether the input is a numeric variable
isNumeric(constant)
isNumeric(constant)
constant |
A variable to check |
TRUE or FALSE
Convert lavaan output to RAM matrices
lavaan2ram(fitModel, digits = 2, zero.print = "0", ram.out = TRUE, fit = FALSE)
lavaan2ram(fitModel, digits = 2, zero.print = "0", ram.out = TRUE, fit = FALSE)
fitModel |
A lavaan object generated by the function |
digits |
Digits for number print |
zero.print |
Format zeros in the matrix |
ram.out |
Whether print RAM matrices |
fit |
Whether print fit statistics |
A and Ase |
A matrix and its standard errors |
S and Sse |
S matrix and its standard errors |
fit |
model fit |
lavaan |
The lavaan input, the same as fitModel |
Generate all bridges based on Boker, McArdle, & Neale (2002)
makeBridgeList(pathList, spanList)
makeBridgeList(pathList, spanList)
pathList |
A path list from the function |
spanList |
A span list from the function |
Boker, S. M., McArdle, J. J. & Neale, M. C. (2002) An algorithm for the hierarchical organization of path diagrams and calculation of components of covariance between variables. Structural Equation Modeling, 9(2), 174-194
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
Make a list of effects
makePathList(AMatrix, Ase, indirect = TRUE)
makePathList(AMatrix, Ase, indirect = TRUE)
AMatrix |
A matrix from the ram matrices |
Ase |
Standard error matrix for A matrix from the ram matrices |
indirect |
Whether to generate all indirect effects |
Boker, S. M., McArdle, J. J. & Neale, M. C. (2002) An algorithm for the hierarchical organization of path diagrams and calculation of components of covariance between variables. Structural Equation Modeling, 9(2), 174-194
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
Make a list of spans
makeSpanList(SMatrix, Sse)
makeSpanList(SMatrix, Sse)
SMatrix |
S matrix from the ram matrices |
Sse |
Standard error matrix for S matrix from the ram matrices |
Boker, S. M., McArdle, J. J. & Neale, M. C. (2002) An algorithm for the hierarchical organization of path diagrams and calculation of components of covariance between variables. Structural Equation Modeling, 9(2), 174-194
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
Plot the power curve for each specified parameter
## S3 method for class 'lcs.power' plot(x, parameter, ...)
## S3 method for class 'lcs.power' plot(x, parameter, ...)
x |
Output from the |
parameter |
parameter to be plotted. |
... |
Options for the plot function. |
Zhang, Z., & Liu, H. (2018). Sample size and measurement occasion planning for latent change score models through Monte Carlo simulation. In E. Ferrer, S. M. Boker, and K. J. Grimm (Eds.), Advances in longitudinal models for multivariate psychology: A festschrift for Jack McArdle (pp. 189-211). New York, NY: Routledge.
Plot the path diagram according to RAM path and bridges or Plot the vector field for the bivariate latent change score model
## S3 method for class 'RAMpath' plot(x, file, from, to, type = c("path", "bridge"), size = c(8, 8), node.font = c("Helvetica", 14), edge.font = c("Helvetica", 10), rank.direction = c("LR", "TB"), digits = 2, output.type = c("graphics", "dot"), graphics.fmt = "pdf", dot.options = NULL, ...) ## S3 method for class 'blcs' plot(x, ylim, xlim, ninterval=10, scale=.1, length=.25, scatter=TRUE, n=20, alpha=.95, ...)
## S3 method for class 'RAMpath' plot(x, file, from, to, type = c("path", "bridge"), size = c(8, 8), node.font = c("Helvetica", 14), edge.font = c("Helvetica", 10), rank.direction = c("LR", "TB"), digits = 2, output.type = c("graphics", "dot"), graphics.fmt = "pdf", dot.options = NULL, ...) ## S3 method for class 'blcs' plot(x, ylim, xlim, ninterval=10, scale=.1, length=.25, scatter=TRUE, n=20, alpha=.95, ...)
x |
Output from the |
file |
File name for the generated figures |
from |
from variable: path starts from this variable |
to |
to variable: path ends on this variable |
type |
|
size |
The size of the plot in inches |
node.font |
The size of the text for the variables |
edge.font |
The size of the text on the pahts |
rank.direction |
LR: from left to right; TB: from top to bottom. |
digits |
Digits of numbers to plot |
output.type |
If "graphics", the default, both a ".dot" file and a graphics file will be created. |
graphics.fmt |
a graphics format recognized by the dot program; the default is "pdf"; graphics.fmt is also used for the extension of the graphics file that is created. |
dot.options |
options to be passed to the dot program, given as a character string. |
ylim |
Range of y data, for example, c(0,80) from 0 to 80 |
xlim |
Range of x data, for example, c(0,80) from 0 to 80 |
ninterval |
Number of intervals for plotting. The default is 10. |
scale |
Time interval to calculate vector fields. |
length |
The length of arrows to plot |
scatter |
Whether to plot the data points |
n |
The number of data points to be plotted |
alpha |
The confidence level to calculate the ellipse |
... |
Options for plot and arrows function. |
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
data(ex3) test.blcs<-ramBLCS(ex3, 1:6, 7:12, ram.out=TRUE) ramVF(test.blcs, c(0,80),c(0,80), length=.05, xlab='X', ylab='Y',scale=.5, ninterval=9) plot(test.blcs, c(0,80),c(0,80), length=.05, xlab='X', ylab='Y',scale=.5, ninterval=9)
data(ex3) test.blcs<-ramBLCS(ex3, 1:6, 7:12, ram.out=TRUE) ramVF(test.blcs, c(0,80),c(0,80), length=.05, xlab='X', ylab='Y',scale=.5, ninterval=9) plot(test.blcs, c(0,80),c(0,80), length=.05, xlab='X', ylab='Y',scale=.5, ninterval=9)
Calculate power for bivariate latent change score models based on Monte Carlo simulation.
powerBLCS(N=100, T=5, R=1000, betay=0, my0=0, mys=0, varey=1, vary0=1, varys=1, vary0ys=0, alpha=0.05, betax=0, mx0=0, mxs=0, varex=1, varx0=1, varxs=1, varx0xs=0, varx0y0=0, varx0ys=0, vary0xs=0, varxsys=0, gammax=0, gammay=0, ...)
powerBLCS(N=100, T=5, R=1000, betay=0, my0=0, mys=0, varey=1, vary0=1, varys=1, vary0ys=0, alpha=0.05, betax=0, mx0=0, mxs=0, varex=1, varx0=1, varxs=1, varx0xs=0, varx0y0=0, varx0ys=0, vary0xs=0, varxsys=0, gammax=0, gammay=0, ...)
N |
Sample size, can be a scalar or a vector. For better performance, make sure N is at least two times of T |
T |
Number of times, occasions or waves of measurements, can be a scalar or a vector |
R |
Number of replications to run in Monte Carlo simulation. Recommended 1000 or more |
betay |
Population parameter values |
my0 |
Population parameter values |
mys |
Population parameter values |
varey |
Population parameter values |
vary0 |
Population parameter values |
varys |
Population parameter values |
vary0ys |
Population parameter values |
betax |
Population parameter values |
mx0 |
Population parameter values |
mxs |
Population parameter values |
varex |
Population parameter values |
varx0 |
Population parameter values |
varxs |
Population parameter values |
varx0xs |
Population parameter values |
gammax |
Population parameter values |
gammay |
Population parameter values |
varx0y0 |
Population parameter values |
varx0ys |
Population parameter values |
vary0xs |
Population parameter values |
varxsys |
Population parameter values |
alpha |
Significance level |
... |
Options can be used for lavaan |
A matrix with power for each parameter.
Zhang, Z., & Liu, H. (2018). Sample size and measurement occasion planning for latent change score models through Monte Carlo simulation. In E. Ferrer, S. M. Boker, and K. J. Grimm (Eds.), Advances in longitudinal models for multivariate psychology: A festschrift for Jack McArdle (pp. 189-211). New York, NY: Routledge.
## Not run: powerBLCS(R=1000) ## End(Not run)
## Not run: powerBLCS(R=1000) ## End(Not run)
Calculate power for univariate latent change score models based on Monte Carlo simulation.
powerLCS(N=100, T=5, R=1000, betay=0, my0=0, mys=0, varey=1, vary0=1, varys=1, vary0ys=0, alpha=0.05, ...)
powerLCS(N=100, T=5, R=1000, betay=0, my0=0, mys=0, varey=1, vary0=1, varys=1, vary0ys=0, alpha=0.05, ...)
N |
Sample size, can be a scalar or a vector. For better performance, make sure N is at least two times of T |
T |
Number of times, occasions or waves of measurements, can be a scalar or a vector |
R |
Number of replications to run in Monte Carlo simulation. Recommended 1000 or more |
betay |
Population parameter values |
my0 |
Population parameter values |
mys |
Population parameter values |
varey |
Population parameter values |
vary0 |
Population parameter values |
varys |
Population parameter values |
vary0ys |
Population parameter values |
alpha |
Significance level |
... |
Options can be used for lavaan |
model |
The lavaan model specification of the bivariate latent change score model |
lavaan |
The lavaan output |
ram |
Output in terms of RAM matrices |
Zhang, Z., & Liu, H. (2018). Sample size and measurement occasion planning for latent change score models through Monte Carlo simulation. In E. Ferrer, S. M. Boker, and K. J. Grimm (Eds.), Advances in longitudinal models for multivariate psychology: A festschrift for Jack McArdle (pp. 189-211). New York, NY: Routledge.
## Not run: powerLCS(R=1000) ## End(Not run)
## Not run: powerLCS(R=1000) ## End(Not run)
Convert RAM matrix specification to a lavaan model
ram2lavaan(model)
ram2lavaan(model)
model |
An ram model |
Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1-36. URL http://www.jstatsoft.org/v48/i02/.
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
Conduct bivariate latent change score analysis
ramBLCS(data, y, x, timey, timex, ram.out = FALSE, betax, betay, gammax, gammay, mx0, mxs, my0, mys, varex, varey, varx0, vary0, varxs, varys, varx0y0, varx0xs, vary0ys, varx0ys, vary0xs, varxsys, ...)
ramBLCS(data, y, x, timey, timex, ram.out = FALSE, betax, betay, gammax, gammay, mx0, mxs, my0, mys, varex, varey, varx0, vary0, varxs, varys, varx0y0, varx0xs, vary0ys, varx0ys, vary0xs, varxsys, ...)
data |
Data |
y |
Indices for y variables |
x |
Indices for x variables |
timey |
Time for y variables |
timex |
Time for x variables |
ram.out |
whether print ram matrices |
betax |
Starting value |
betay |
Starting value |
gammax |
Starting value |
gammay |
Starting value |
mx0 |
Starting value |
mxs |
Starting value |
my0 |
Starting value |
mys |
Starting value |
varex |
Starting value |
varey |
Starting value |
varx0 |
Starting value |
vary0 |
Starting value |
varxs |
Starting value |
varys |
Starting value |
varx0y0 |
Starting value |
varx0xs |
Starting value |
vary0ys |
Starting value |
varx0ys |
Starting value |
vary0xs |
Starting value |
varxsys |
Starting value |
... |
Options can be used for |
model |
The lavaan model specification of the bivariate latent change score model |
lavaan |
The lavaan output |
ram |
Output in terms of RAM matrices |
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
data(ex3) ## Test the bivariate latent change score model ramBLCS test.blcs<-ramBLCS(ex3, 7:12, 1:6, ram.out=TRUE) summary(test.blcs$lavaan, fit=TRUE) bridge<-ramPathBridge(test.blcs$ram, allbridge=FALSE,indirect=FALSE) ## uncomment to plot ## plot(bridge, 'blcs') ## Test the vector field plot ## test.blcs is the output of the ramBLCS function. ramVF(test.blcs, c(0,80),c(0,80), length=.05, xlab='X', ylab='Y',scale=.5, ninterval=9)
data(ex3) ## Test the bivariate latent change score model ramBLCS test.blcs<-ramBLCS(ex3, 7:12, 1:6, ram.out=TRUE) summary(test.blcs$lavaan, fit=TRUE) bridge<-ramPathBridge(test.blcs$ram, allbridge=FALSE,indirect=FALSE) ## uncomment to plot ## plot(bridge, 'blcs') ## Test the vector field plot ## test.blcs is the output of the ramBLCS function. ramVF(test.blcs, c(0,80),c(0,80), length=.05, xlab='X', ylab='Y',scale=.5, ninterval=9)
Sobel standard error for a given effect
ramEffectSE(object, effect, path=TRUE)
ramEffectSE(object, effect, path=TRUE)
object |
An RAM path bridge output |
effect |
The effect to calculate se for. It is in the form a > b > c. |
path |
se for the direct and indirect effect. |
Fit a model using lavaan based on ram input
ramFit(ramModel, data, type=c('ram','lavaan'), digits = 3, zero.print = "0", ...)
ramFit(ramModel, data, type=c('ram','lavaan'), digits = 3, zero.print = "0", ...)
ramModel |
An ram model |
data |
data |
type |
ram: specify a ram model; lavaan: specify a lavaan model |
digits |
Digits for print |
zero.print |
Format of zeros |
... |
Options for lavaan |
A and Ase |
A matrix and its standard error |
S and Sse |
S matrix and its standard error |
lavaan |
Original lavaan output |
fit |
Model fit statistics and indices |
Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1-36. URL http://www.jstatsoft.org/v48/i02/.
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
## Example 1. A path model data(ex1) m1<-' manifest=3 label=age,hvlt,ept arrow(2,1)=? arrow(3,1)=? arrow(3,2)=? sling(1,1)=? sling(2,2)=? sling(3,3)=? ' ## Fit the model res1<-ramFit(m1, ex1) ## More output from Lavaan summary(res1$lavaan, fit=TRUE) ## Effects and variance decomposition bridge<-ramPathBridge(res1, allbridge=TRUE, indirect=TRUE) summary(bridge) summary(bridge, type='bridge') ## plot the path diagram ## uncomment to plot ## plot(bridge, 'ex1') ## plot the effects from age to ept ## uncomment to plot ## plot(bridge, 'ex1effect', 'age','ept') ## plot the bridges for ept ## uncomment to plot ## plot(bridge, 'ex1bridge', 'ept','hvlt', type='bridge') ## summarize summary(bridge) summary(bridge, type='bridge') ## Example 2: An SEM model (MIMIC model) data(ex2) ## Using lavaan directly for model estimation and specification mimic<-' R =~ ws1 + ls1 + lt1 R ~ edu + gender ' mimic.res<-sem(mimic, data=ex2) mimic.ram<-lavaan2ram(mimic.res) ## plot the path diagram bridge<-ramPathBridge(mimic.ram, allbridge=FALSE, indirect=FALSE) ## uncomment to plot ## plot(bridge, 'mimic')
## Example 1. A path model data(ex1) m1<-' manifest=3 label=age,hvlt,ept arrow(2,1)=? arrow(3,1)=? arrow(3,2)=? sling(1,1)=? sling(2,2)=? sling(3,3)=? ' ## Fit the model res1<-ramFit(m1, ex1) ## More output from Lavaan summary(res1$lavaan, fit=TRUE) ## Effects and variance decomposition bridge<-ramPathBridge(res1, allbridge=TRUE, indirect=TRUE) summary(bridge) summary(bridge, type='bridge') ## plot the path diagram ## uncomment to plot ## plot(bridge, 'ex1') ## plot the effects from age to ept ## uncomment to plot ## plot(bridge, 'ex1effect', 'age','ept') ## plot the bridges for ept ## uncomment to plot ## plot(bridge, 'ex1bridge', 'ept','hvlt', type='bridge') ## summarize summary(bridge) summary(bridge, type='bridge') ## Example 2: An SEM model (MIMIC model) data(ex2) ## Using lavaan directly for model estimation and specification mimic<-' R =~ ws1 + ls1 + lt1 R ~ edu + gender ' mimic.res<-sem(mimic, data=ex2) mimic.ram<-lavaan2ram(mimic.res) ## plot the path diagram bridge<-ramPathBridge(mimic.ram, allbridge=FALSE, indirect=FALSE) ## uncomment to plot ## plot(bridge, 'mimic')
Flip the ram path
ramFlip(input)
ramFlip(input)
input |
An ram path |
To be added
ramIndex(input)
ramIndex(input)
input |
To be added |
Conduct growth curve analysis
ramLCM(data, outcome, model = c("all", "no", "linear", "quadratic", "latent"), basis = 0:(length(outcome) - 1), predictor, equal.var = TRUE, digits = 3, ram.out = FALSE, ...)
ramLCM(data, outcome, model = c("all", "no", "linear", "quadratic", "latent"), basis = 0:(length(outcome) - 1), predictor, equal.var = TRUE, digits = 3, ram.out = FALSE, ...)
data |
Data |
outcome |
Outcome variable indices |
model |
Models to fit |
basis |
Basis coefficients |
predictor |
Covariates as predictors |
equal.var |
Set residual variances to be equal |
digits |
Print digits |
ram.out |
Print ram matrices |
... |
Options can be used for lavaan |
model |
The lavaan model specification of the bivariate latent change score model |
lavaan |
The lavaan output |
ram |
Output in terms of RAM matrices |
fit |
Model fit |
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
data(ex3) ## Example 3. Growth curve models gcm.all<-ramLCM(ex3, 1:6, ram.out=TRUE) ## plot the path diagram bridge<-ramPathBridge(gcm.all$ram$latent, FALSE, FALSE) ## uncomment to plot ## plot(bridge, 'latent') ##unequal variance gcm.all<-ramLCM(ex3, 1:6, ram.out=TRUE, equal.var=FALSE) ## missing data gcm.all<-ramLCM(ex3, c(1,2,4,6), basis=c(1,2,4,6), ram.out=TRUE) gcm.l<-ramLCM(ex3, 1:6, model='linear', ram.out=TRUE) ## with a predictor gcm.pred<-ramLCM(ex3, c(1,2,4,6), model='linear', basis=c(1,2,4,6), predictor=c(3,5), ram.out=TRUE) bridge3<-ramPathBridge(gcm.pred$ram$linear) ## uncomment to plot ## plot(bridge3, 'gcmlinear')
data(ex3) ## Example 3. Growth curve models gcm.all<-ramLCM(ex3, 1:6, ram.out=TRUE) ## plot the path diagram bridge<-ramPathBridge(gcm.all$ram$latent, FALSE, FALSE) ## uncomment to plot ## plot(bridge, 'latent') ##unequal variance gcm.all<-ramLCM(ex3, 1:6, ram.out=TRUE, equal.var=FALSE) ## missing data gcm.all<-ramLCM(ex3, c(1,2,4,6), basis=c(1,2,4,6), ram.out=TRUE) gcm.l<-ramLCM(ex3, 1:6, model='linear', ram.out=TRUE) ## with a predictor gcm.pred<-ramLCM(ex3, c(1,2,4,6), model='linear', basis=c(1,2,4,6), predictor=c(3,5), ram.out=TRUE) bridge3<-ramPathBridge(gcm.pred$ram$linear) ## uncomment to plot ## plot(bridge3, 'gcmlinear')
Univariate latent change score model
ramLCS(data, y, timey, ram.out = FALSE, betay, my0, mys, varey, vary0, varys, vary0ys, ...)
ramLCS(data, y, timey, ram.out = FALSE, betay, my0, mys, varey, vary0, varys, vary0ys, ...)
data |
data |
y |
y data |
timey |
time of y |
ram.out |
Whether print ram matrices |
betay |
Starting value |
my0 |
Starting value |
mys |
Starting value |
varey |
Starting value |
vary0 |
Starting value |
varys |
Starting value |
vary0ys |
Starting value |
... |
Options can be used for lavaan |
model |
The lavaan model specification of the bivariate latent change score model |
lavaan |
The lavaan output |
ram |
Output in terms of RAM matrices |
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
data(ex3) test.lcs<-ramLCS(ex3, 7:12) summary(test.lcs$lavaan, fit=TRUE) bridge<-ramPathBridge(test.lcs$ram, allbridge=FALSE, indirect=FALSE) ## uncomment to plot ## plot(bridge, 'lcs')
data(ex3) test.lcs<-ramLCS(ex3, 7:12) summary(test.lcs$lavaan, fit=TRUE) bridge<-ramPathBridge(test.lcs$ram, allbridge=FALSE, indirect=FALSE) ## uncomment to plot ## plot(bridge, 'lcs')
Generate ram matrices based on ram input
ramMatrix(model)
ramMatrix(model)
model |
An ram model |
lavaan to ram matrices
ramParseLavaan(input, manifest, type = 0)
ramParseLavaan(input, manifest, type = 0)
input |
lavaan input |
manifest |
observed variables |
type |
0: single headed arrow, ... |
Generate path and bridges
ramPathBridge(rammatrix, allbridge = FALSE, indirect = TRUE)
ramPathBridge(rammatrix, allbridge = FALSE, indirect = TRUE)
rammatrix |
RAM matrices |
allbridge |
Generate all bridges |
indirect |
Generate all indirect effects |
Generate a vector field plot based on the bivariate lcsm
ramReFit(object, add, ram.out=FALSE, ...)
ramReFit(object, add, ram.out=FALSE, ...)
object |
Output from any data analysis |
add |
Additional paths to be added, e.g., add='X1~~X2'. |
ram.out |
Whether to print the RAM matrices |
... |
Options for plot and arrows function. |
data(ex3) gcm.l<-ramLCM(ex3, 1:6, model='linear', ram.out=TRUE) ## Add correlated errors ramReFit(gcm.l, add='X1~~X2')
data(ex3) gcm.l<-ramLCM(ex3, 1:6, model='linear', ram.out=TRUE) ## Add correlated errors ramReFit(gcm.l, add='X1~~X2')
Internal function
ramRmOne(input)
ramRmOne(input)
input |
Internal function |
Show the model using Lavvan model syntax
ramShowModel(object)
ramShowModel(object)
object |
Output from any data analysis |
Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1-36. URL http://www.jstatsoft.org/v48/i02/.
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
data(ex3) gcm.l<-ramLCM(ex3, 1:6, model='linear', ram.out=TRUE) ## Add correlated errors ramShowModel(gcm.l)
data(ex3) gcm.l<-ramLCM(ex3, 1:6, model='linear', ram.out=TRUE) ## Add correlated errors ramShowModel(gcm.l)
Get the uniques paths
ramUniquePath(tPathlist)
ramUniquePath(tPathlist)
tPathlist |
The path list. |
Generate a vector field plot based on the bivariate lcsm
ramVF(ramout, ylim, xlim, ninterval=10, scale=.1, length=.25, scatter=TRUE, n=20, alpha=.95, ...)
ramVF(ramout, ylim, xlim, ninterval=10, scale=.1, length=.25, scatter=TRUE, n=20, alpha=.95, ...)
ramout |
Output from the ramBLCS function |
ylim |
Range of y data, for example, c(0,80) from 0 to 80 |
xlim |
Range of x data, for example, c(0,80) from 0 to 80 |
ninterval |
Number of intervals for plotting. The default is 10. |
scale |
Time interval to calculate vector fields. |
length |
The length of arrows to plot |
scatter |
Whether to plot the data points |
n |
The number of data points to be plotted |
alpha |
The confidence level to calculate the ellipse |
... |
Options for plot and arrows function. |
Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2015). Using R package RAMpath for tracing SEM path diagrams and conducting complex longitudinal data analysis. Structural Equation Modeling, 22(1), 132-147. https://doi.org/10.1080/10705511.2014.935257
data(ex3) test.blcs<-ramBLCS(ex3, 1:6, 7:12, ram.out=TRUE) ramVF(test.blcs, c(0,80),c(0,80), length=.05, xlab='X', ylab='Y',scale=.5, ninterval=9)
data(ex3) test.blcs<-ramBLCS(ex3, 1:6, 7:12, ram.out=TRUE) ramVF(test.blcs, c(0,80),c(0,80), length=.05, xlab='X', ylab='Y',scale=.5, ninterval=9)
Calculate the total and individual contribution for each path and bridge
## S3 method for class 'RAMpath' summary(object, from, to, type = c("path", "bridge"), se=FALSE, ...)
## S3 method for class 'RAMpath' summary(object, from, to, type = c("path", "bridge"), se=FALSE, ...)
object |
Output from the ramPathBridge function |
from |
from variable: starting from this variable |
to |
to variable: end on this variable |
type |
path: to calculate the effect; bridge: to calculate the bridges |
se |
Whether to generate se for direct and indirect effects. |
... |
Other options |