CheckRAMMatrices: Check Matrices

Description Usage Arguments Author(s) Examples

View source: R/CheckRAMMatrices.R

Description

Checks if the input matrices are in the correct form.

Usage

 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
CheckRAMMatrices(
  A,
  S = NULL,
  u = NULL,
  Filter = NULL,
  C = NULL,
  C.scaled = NULL,
  v = NULL,
  ...
)

## Default S3 method:
CheckRAMMatrices(
  A,
  S = NULL,
  u = NULL,
  Filter = NULL,
  C = NULL,
  C.scaled = NULL,
  v = NULL,
  ...
)

## S3 method for class 'yac_symbol'
CheckRAMMatrices(
  A,
  S = NULL,
  u = NULL,
  Filter = NULL,
  C = NULL,
  C.scaled = NULL,
  v = NULL,
  ...
)

Arguments

A

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

S

t by t numeric matrix \mathbf{S}. Symmetric paths (double-headed arrows), such as variances and covariances.

u

vector of length t or t by 1 matrix. Mean structure parameters.

Filter

p by t numeric matrix \mathbf{F}. Filter matrix used to select observed variables.

C

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

C.scaled

t by t numeric matrix \mathbf{C}_{\mathrm{scaled}}. Scaled/standardized model-implied variance-covariance matrix.

v

vector of length t or t by 1 matrix. Expected values.

...

...

Author(s)

Ivan Jacob Agaloos Pesigan

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
51
52
53
54
55
# Numeric -----------------------------------------------------------
# This is a numerical example for the model
# y = alpha + beta * x + e
# y = 0 + 1 * x + e

A <- S <- matrixR::ZeroMatrix(3)
A[1, ] <- c(0, 1, 1)
colnames(A) <- rownames(A) <- c("y", "x", "e")
diag(S) <- c(0, 0.25, 1)
u <- c(0.00, 0.50, 0.00)
Filter <- diag(2)
Filter <- cbind(Filter, 0)
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]
)
v <- c(0.50, 0.50, 0.00)
CheckRAMMatrices(
  A = A,
  S = S,
  u = u,
  Filter = Filter,
  C = C,
  v = v
)
# Symbolic ----------------------------------------------------------
# This is a symbolic example for the model
# y = alpha + beta * x + e
# y = 0 + 1 * x + e

A <- S <- matrixR::ZeroMatrix(3)
A[1, ] <- c(0, "beta", 1)
diag(S) <- c(0, "sigmax2", "sigmae2")
u <- c("alpha", "mux", 0)
C <- matrix(
  data = c(
    "sigmax2*beta^2+sigmae2", "sigmax2*beta", "sigmae2",
    "sigmax2*beta", "sigmax2", 0,
    "sigmae2", 0, "sigmae2"
  ),
  nrow = dim(A)[1]
)
v <- c("alpha+beta*mux", "mux", 0)
CheckRAMMatrices(
  A = Ryacas::ysym(A),
  S = S,
  u = u,
  Filter = Filter,
  C = C,
  v = v
)

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