SimMatrix-class: Matrix object: Random parameters matrix

Description Objects from the Class Slots Methods Author(s) See Also Examples

Description

This object can be used to represent a matrix in SEM model. It contains free parameters, fixed values, starting values, and model misspecification. This object can be represented mean, intercept, or variance vectors.

Objects from the Class

This object is created by bind or binds function.

Slots

free:

The free-parameter vector. Any NA elements or character elements are free. Any numeric elements are fixed as the specified number. If any free elements have the same characters (except NA), the elements are equally constrained.

popParam:

Real population parameters of the free elements.

misspec:

Model misspecification that will be added on top of the fixed and real parameters.

symmetric:

If TRUE, the specified matrix is symmetric.

Methods

rawDraw

Draws data-generation parameters.

summaryShort

Provides a short summary of all information in the object

summary

Provides a thorough description of all information in the object

Author(s)

Sunthud Pornprasertmanit (psunthud@gmail.com)

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
showClass("SimMatrix")

loading <- matrix(0, 6, 2)
loading[1:3, 1] <- NA
loading[4:6, 2] <- NA
loadingValues <- matrix(0, 6, 2)
loadingValues[1:3, 1] <- 0.7
loadingValues[4:6, 2] <- 0.7
LY <- bind(loading, loadingValues)
summary(LY)
rawDraw(LY)

LY <- bind(loading, "rnorm(1, 0.6, 0.05)")
summary(LY)
rawDraw(LY)

mis <- matrix("runif(1, -0.1, 0.1)", 6, 2)
mis[is.na(loading)] <- 0
LY <- bind(loading, "rnorm(1, 0.6, 0.05)", mis)
summary(LY)
rawDraw(LY)

Example output

Loading required package: lavaan
This is lavaan 0.5-23.1097
lavaan is BETA software! Please report any bugs.
 
###############################################################################################
This is simsem 0.5-13
simsem is BETA software! Please report any bugs.
simsem was developed at the University of Kansas Center for Research Methods and Data Analysis.
###############################################################################################
Class "SimMatrix" [package "simsem"]

Slots:
                                              
Name:       free  popParam   misspec symmetric
Class:    matrix    matrix    matrix   logical
[1] "Random Full Matrix Object."
[1] "Free/Fixed Parameters:"
     [,1] [,2]
[1,]   NA    0
[2,]   NA    0
[3,]   NA    0
[4,]    0   NA
[5,]    0   NA
[6,]    0   NA
[1] "Population Parameters/Starting Values:"
     [,1]  [,2] 
[1,] "0.7" ""   
[2,] "0.7" ""   
[3,] "0.7" ""   
[4,] ""    "0.7"
[5,] ""    "0.7"
[6,] ""    "0.7"
[1] "Model misspecification"
     [,1]
[1,]  NaN
[1] "Symmetric: FALSE"
$param
     [,1] [,2]
[1,]  0.7  0.0
[2,]  0.7  0.0
[3,]  0.7  0.0
[4,]  0.0  0.7
[5,]  0.0  0.7
[6,]  0.0  0.7

$paramMis
     [,1] [,2]
[1,]  0.7  0.0
[2,]  0.7  0.0
[3,]  0.7  0.0
[4,]  0.0  0.7
[5,]  0.0  0.7
[6,]  0.0  0.7

$missRaw
     [,1] [,2]
[1,]    0    0
[2,]    0    0
[3,]    0    0
[4,]    0    0
[5,]    0    0
[6,]    0    0

[1] "Random Full Matrix Object."
[1] "Free/Fixed Parameters:"
     [,1] [,2]
[1,]   NA    0
[2,]   NA    0
[3,]   NA    0
[4,]    0   NA
[5,]    0   NA
[6,]    0   NA
[1] "Population Parameters/Starting Values:"
     [,1]                  [,2]                 
[1,] "rnorm(1, 0.6, 0.05)" ""                   
[2,] "rnorm(1, 0.6, 0.05)" ""                   
[3,] "rnorm(1, 0.6, 0.05)" ""                   
[4,] ""                    "rnorm(1, 0.6, 0.05)"
[5,] ""                    "rnorm(1, 0.6, 0.05)"
[6,] ""                    "rnorm(1, 0.6, 0.05)"
[1] "Model misspecification"
     [,1]
[1,]  NaN
[1] "Symmetric: FALSE"
$param
          [,1]      [,2]
[1,] 0.5584126 0.0000000
[2,] 0.6367904 0.0000000
[3,] 0.6870000 0.0000000
[4,] 0.0000000 0.5843137
[5,] 0.0000000 0.5808702
[6,] 0.0000000 0.6563590

$paramMis
          [,1]      [,2]
[1,] 0.5584126 0.0000000
[2,] 0.6367904 0.0000000
[3,] 0.6870000 0.0000000
[4,] 0.0000000 0.5843137
[5,] 0.0000000 0.5808702
[6,] 0.0000000 0.6563590

$missRaw
     [,1] [,2]
[1,]    0    0
[2,]    0    0
[3,]    0    0
[4,]    0    0
[5,]    0    0
[6,]    0    0

[1] "Random Full Matrix Object."
[1] "Free/Fixed Parameters:"
     [,1] [,2]
[1,]   NA    0
[2,]   NA    0
[3,]   NA    0
[4,]    0   NA
[5,]    0   NA
[6,]    0   NA
[1] "Population Parameters/Starting Values:"
     [,1]                  [,2]                 
[1,] "rnorm(1, 0.6, 0.05)" ""                   
[2,] "rnorm(1, 0.6, 0.05)" ""                   
[3,] "rnorm(1, 0.6, 0.05)" ""                   
[4,] ""                    "rnorm(1, 0.6, 0.05)"
[5,] ""                    "rnorm(1, 0.6, 0.05)"
[6,] ""                    "rnorm(1, 0.6, 0.05)"
[1] "Model misspecification"
     [,1]                  [,2]                 
[1,] "0"                   "runif(1, -0.1, 0.1)"
[2,] "0"                   "runif(1, -0.1, 0.1)"
[3,] "0"                   "runif(1, -0.1, 0.1)"
[4,] "runif(1, -0.1, 0.1)" "0"                  
[5,] "runif(1, -0.1, 0.1)" "0"                  
[6,] "runif(1, -0.1, 0.1)" "0"                  
[1] "Symmetric: FALSE"
$param
          [,1]      [,2]
[1,] 0.5726089 0.0000000
[2,] 0.6102844 0.0000000
[3,] 0.5349775 0.0000000
[4,] 0.0000000 0.6377042
[5,] 0.0000000 0.6247760
[6,] 0.0000000 0.5787018

$paramMis
           [,1]       [,2]
[1,] 0.57260891 0.04349337
[2,] 0.61028438 0.04885434
[3,] 0.53497747 0.07962248
[4,] 0.09353607 0.63770423
[5,] 0.09780276 0.62477602
[6,] 0.02987231 0.57870178

$missRaw
           [,1]       [,2]
[1,] 0.00000000 0.04349337
[2,] 0.00000000 0.04885434
[3,] 0.00000000 0.07962248
[4,] 0.09353607 0.00000000
[5,] 0.09780276 0.00000000
[6,] 0.02987231 0.00000000

simsem documentation built on March 29, 2021, 1:07 a.m.