Model fitting function

model_fit(model_input, R, method_null = "sem", N)

Arguments

model_input

Model input as a character string. Multiple models need to be on their own line. See details for specification.

R

A correlation matrix, most likely this will be the average correlation matrix outputted from the metafor package.

method_null

Unsure

N

Sample size

Value

A list of fit indices.

Examples

Br <-  matrix(c(1.00000000, -0.09773331, -0.1755029,  0.3186775,
-0.09773331,  1.00000000,  0.5271873, -0.4175596,
-0.17550292,  0.5271872,  1.0000000, -0.4006848,
0.31867753, -0.41755963, -0.4006848,  1.0000000),
nrow = 4, byrow = TRUE)

colnames(Br) <- c("Performance",  "Self_confidence",  "Cognitive", "Somatic" )

rownames(Br) <- colnames(Br)

## Proposed path model
model <- "## Regression paths
Performance ~  Self_confidence  + Cognitive  + Somatic
Self_confidence ~ Cognitive + Somatic "

N <- 573
model_fit(model_input = model, R = Br,
         method_null = "sem", N)
#> $path_coefficients
#> $path_coefficients[[1]]
#> Self_confidence -> Performance       Cognitive -> Performance 
#>                     0.08316153                    -0.09261001 
#>         Somatic -> Performance 
#>                     0.31629500 
#> 
#> $path_coefficients[[2]]
#> Cognitive -> Self_confidence   Somatic -> Self_confidence 
#>                    0.4287053                   -0.2457839 
#> 
#> 
#> $Model
#>    Chi2      df  pvalue 
#> 59.1102  2.0000  0.0000 
#> 
#> $NullModel
#> Chi2Null   dfNull 
#> 643.3373   6.0000 
#> 
#> $CFI
#> [1] 0.9103925
#> 
#> $TLI
#> [1] 0.7311776
#> 
#> $RMSEA
#> [1] 0.2234312
#> 
#> $RMSEA_CI
#> [1] 0.1671203 0.2835352
#> 
#> $SRMR
#> [1] 0.2672185
#> 
model_fit(model_input = model, R = Br,
         method_null = "sem", N )
#> $path_coefficients
#> $path_coefficients[[1]]
#> Self_confidence -> Performance       Cognitive -> Performance 
#>                     0.08316153                    -0.09261001 
#>         Somatic -> Performance 
#>                     0.31629500 
#> 
#> $path_coefficients[[2]]
#> Cognitive -> Self_confidence   Somatic -> Self_confidence 
#>                    0.4287053                   -0.2457839 
#> 
#> 
#> $Model
#>    Chi2      df  pvalue 
#> 59.1102  2.0000  0.0000 
#> 
#> $NullModel
#> Chi2Null   dfNull 
#> 643.3373   6.0000 
#> 
#> $CFI
#> [1] 0.9103925
#> 
#> $TLI
#> [1] 0.7311776
#> 
#> $RMSEA
#> [1] 0.2234312
#> 
#> $RMSEA_CI
#> [1] 0.1671203 0.2835352
#> 
#> $SRMR
#> [1] 0.2672185
#>