S: Matrix of Symmetric Paths \mathbf{S}

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/S.R

Description

Derives the matrix of symmetric paths (double-headed arrows) \mathbf{S} using the Reticular Action Model (RAM) notation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
S(A, C, check = TRUE, ...)

## Default S3 method:
S(A, C, check = TRUE, ...)

## S3 method for class 'yac_symbol'
S(
  A,
  C,
  check = TRUE,
  exe = TRUE,
  R = FALSE,
  format = "ysym",
  simplify = FALSE,
  ...
)

Arguments

A

t by t matrix \mathbf{A}. Asymmetric paths (single-headed arrows), such as regression coefficients and factor loadings.

C

t by t numeric matrix \mathbf{C}. Model-implied variance-covariance matrix.

check

Logical. If check = TRUE do some preprocessing with input matrices using CheckRAMMatrices().

...

...

exe

Logical. If exe = TRUE, executes the resulting yacas expression. If exe = FALSE, returns the resulting yacas expression as a character string. If exe = FALSE, the arguments str, ysym, simplify, and tex, are ignored.

R

Logical. If R = TRUE, returns symbolic result as an R expression. If R = FALSE, returns symbolic result as "ysym", "str", or "tex" depending of format.

format

Character string. Only used when R = FALSE. If format = "ysym", returns symbolic result as yac_symbol. If format = "str", returns symbolic result as a characetr string. If format = "tex", returns symbolic result as LaTeX math.

simplify

Logical. Simplify symbolic results.

Details

The matrix of symmetric paths (double-headed arrows) \mathbf{S} as a function of Reticular Action Model (RAM) matrices is given by

\mathbf{S} = ≤ft( \mathbf{I} - \mathbf{A} \right) \mathbf{C} ≤ft( \mathbf{I} - \mathbf{A} \right)^{\mathsf{T}} \\ = \mathbf{E}^{-1} \mathbf{C} ≤ft( \mathbf{E}^{-1} \right)^{\mathsf{T}}

where

Value

\mathbf{S} = \mathbf{E}^{-1} \mathbf{C} ≤ft( \mathbf{E}^{-1} \right)^{\mathsf{T}}

Author(s)

Ivan Jacob Agaloos Pesigan

References

McArdle, J. J., & McDonald, R. P. (1984). Some algebraic properties of the Reticular Action Model for moment structures. British Journal of Mathematical and Statistical Psychology, 37 (2), 234–251. https://doi.org/10.1111/j.2044-8317.1984.tb00802.x

See Also

Other RAM matrices functions: C(), Expectations(), E(), IminusA(), M(), RAMScaled(), g(), u(), v()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Numeric -----------------------------------------------------------
# This is a numerical example for the model
# y = alpha + beta * x + e
# y = 0 + 1 * x + e
#--------------------------------------------------------------------

A <- matrixR::ZeroMatrix(3)
A[1, ] <- c(0, 1, 1)
C <- matrix(
  data = c(
    1.25, 0.25, 1.00,
    0.25, 0.25, 0.00,
    1.00, 0.00, 1.00
  ),
  nrow = dim(A)[1]
)
colnames(A) <- rownames(A) <- c("y", "x", "e")
S(A, C)
# Symbolic ----------------------------------------------------------
# This is a symbolic example for the model
# y = alpha + beta * x + e
# y = 0 + 1 * x + e
#--------------------------------------------------------------------

A <- matrixR::ZeroMatrix(3)
A[1, ] <- c(0, "beta", 1)
C <- matrix(
  data = c(
    "sigmax2*beta^2+sigmae2", "sigmax2*beta", "sigmae2",
    "sigmax2*beta", "sigmax2", 0,
    "sigmae2", 0, "sigmae2"
  ),
  nrow = dim(A)[1]
)
S(Ryacas::ysym(A), C)
S(Ryacas::ysym(A), C, format = "str")
S(Ryacas::ysym(A), C, format = "tex")
S(Ryacas::ysym(A), C, R = TRUE)

# Assigning values to symbols

beta <- 1
sigmax2 <- 0.25
sigmae2 <- 1

S(Ryacas::ysym(A), C)
S(Ryacas::ysym(A), C, format = "str")
S(Ryacas::ysym(A), C, format = "tex")
S(Ryacas::ysym(A), C, R = TRUE)
eval(S(Ryacas::ysym(A), C, R = TRUE))

jeksterslab/ramR documentation built on March 14, 2021, 9:38 a.m.