MathiasHarrer / Doing-Meta-Analysis-in-R

[Read-Only] All R code and source files for the online guide "Doing Meta-Analysis with R: A Hands-On Guide"

Home Page:https://www.protectlab.org/meta-analysis-in-r

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error plotting CFA example with semPaths()

juaninachon opened this issue · comments

Hi, I've been following the examples in chapter 14.3 Confirmatory Factor Analysis_.
I run into an error while attempting to use the semPaths() function, all other outputs seem ok (note: The function works fine when I try to replicate the example from the mediation chapter 14.4.4).

Console reads:

semPaths(cfa.plot,

  •      whatLabels = "est", 
    
  •      edge.color = "black", 
    
  •      nodeLabels = labels,
    
  •      )
    

Error in if (Layout[x[1], 2] != Layout[x[2], 2]) return(0) else return(sum(Layout[Layout[, :
missing value where TRUE/FALSE needed

My semPlotModel object looks like this:

meta2semPlot(cfa2)
An object of class "semPlotModel"
Slot "Pars":
label lhs edge rhs est std group fixed par
36 Ins_Q f_Insomnia -> Quality 0.5694354 0.5694354 Group 1 FALSE 0
37 Ins_L f_Insomnia -> Latency 0.5906298 0.5906298 Group 1 FALSE 0
38 Ins_E f_Insomnia -> Efficiency 0.7604548 0.7604548 Group 1 FALSE 0
46 Las_D f_Lassitude -> DTDysf 0.6799554 0.6799554 Group 1 FALSE 0
47 Las_H f_Lassitude -> HypSomnia 0.6418422 0.6418422 Group 1 FALSE 0
50 Quality <-> Quality 0.6757433 0.6757433 Group 1 FALSE 0
58 Latency <-> Latency 0.6511564 0.6511564 Group 1 FALSE 0
66 Efficiency <-> Efficiency 0.4217085 0.4217085 Group 1 FALSE 0
74 DTDysf <-> DTDysf 0.5376606 0.5376606 Group 1 FALSE 0
82 HypSomnia <-> HypSomnia 0.5880386 0.5880386 Group 1 FALSE 0
90 f_Insomnia <-> f_Insomnia 1.0000000 1.0000000 Group 1 FALSE 0
91 f_Insomnia <-> f_Lassitude 0.3776908 0.3776908 Group 1 FALSE 0
98 f_Lassitude <-> f_Lassitude 1.0000000 1.0000000 Group 1 FALSE 0

Slot "Vars":
name manifest exogenous
1 A TRUE NA
2 C TRUE NA
3 ES TRUE NA
4 E TRUE NA
5 I TRUE NA
6 f_Insomnia FALSE NA
7 f_Lassitude FALSE NA

Slot "Thresholds":
data frame with 0 columns and 0 rows

Slot "Computed":
[1] TRUE

Slot "ObsCovs":
[[1]]
A C ES E I
A 1.00000000 0.3897191 0.4326588 0.04945629 0.09603706
C 0.38971906 1.0000000 0.4272424 0.11929317 0.19292425
ES 0.43265882 0.4272424 1.0000000 0.22690163 0.18105566
E 0.04945629 0.1192932 0.2269016 1.00000000 0.43614968
I 0.09603706 0.1929243 0.1810557 0.43614968 1.00000000

Slot "ImpCovs":
[[1]]
A C ES E I
A 1.0000000 0.3363255 0.4330299 0.1462384 0.1380413
C 0.3363255 1.0000000 0.4491473 0.1516814 0.1431793
ES 0.4330299 0.4491473 1.0000000 0.1952946 0.1843479
E 0.1462384 0.1516814 0.1952946 1.0000000 0.4364241
I 0.1380413 0.1431793 0.1843479 0.4364241 1.0000000

Slot "Original":
list()

These are my current soft & packages versions:

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] metaSEM_1.2.5 OpenMx_2.18.1 semPlot_1.1.2

My full script:
metaCFA.txt