File: MxPath.R

package info (click to toggle)
r-cran-openmx 2.21.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,412 kB
  • sloc: cpp: 36,577; ansic: 13,811; fortran: 2,001; sh: 1,440; python: 350; perl: 21; makefile: 5
file content (44 lines) | stat: -rw-r--r-- 2,849 bytes parent folder | download | duplicates (3)
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
library(OpenMx)

omxCheckEquals(capture.output(mxPath("a","b")),
               c('mxPath',
                 "a -> b [value=0, free=TRUE]"))
               
omxCheckEquals(capture.output(mxPath("a","b",lbound=0)),
               c('mxPath',
                 "a -> b [value=0, free=TRUE, lbound=0]"))
                              
omxCheckEquals(capture.output(mxPath("model.a","b",ubound=0)),
               c("mxPath", "model.a -> b [value=0, free=TRUE, ubound=0]"))

omxCheckEquals(capture.output(mxPath("a","b", free=FALSE)),
               c("mxPath", "a -> b [value=0, free=FALSE]"))

omxCheckEquals(capture.output(mxPath("G", paste0("i",1:5))),
               c("mxPath", "G -> i1 [value=0, free=TRUE]", "G -> i2 [value=0, free=TRUE]",  "G -> i3 [value=0, free=TRUE]", "G -> i4 [value=0, free=TRUE]",  "G -> i5 [value=0, free=TRUE]"))

omxCheckEquals(capture.output(mxPath("G", arrows=2, values=1)),
               c("mxPath", "G <-> G [value=1, free=TRUE]"))

omxCheckEquals(capture.output(mxPath(paste0('i',1:3), connect='all.pairs')),
               c("mxPath", "i1 -> i1 [value=0, free=TRUE]", "i1 -> i2 [value=0, free=TRUE]",  "i1 -> i3 [value=0, free=TRUE]", "i2 -> i1 [value=0, free=TRUE]",  "i2 -> i2 [value=0, free=TRUE]", "i2 -> i3 [value=0, free=TRUE]",  "i3 -> i1 [value=0, free=TRUE]", "i3 -> i2 [value=0, free=TRUE]",  "i3 -> i3 [value=0, free=TRUE]"))

omxCheckEquals(capture.output(mxPath(paste0('i',1:3), connect='unique.pairs')),
               c(c("mxPath", "i1 -> i1 [value=0, free=TRUE]", "i1 -> i2 [value=0, free=TRUE]",  "i1 -> i3 [value=0, free=TRUE]", "i2 -> i2 [value=0, free=TRUE]",  "i2 -> i3 [value=0, free=TRUE]", "i3 -> i3 [value=0, free=TRUE]" )))

omxCheckEquals(capture.output(mxPath(paste0('i',1:3), connect='all.bivariate')),
               c("mxPath", "i1 -> i2 [value=0, free=TRUE]", "i1 -> i3 [value=0, free=TRUE]",  "i2 -> i1 [value=0, free=TRUE]", "i2 -> i3 [value=0, free=TRUE]",  "i3 -> i1 [value=0, free=TRUE]", "i3 -> i2 [value=0, free=TRUE]" ))

omxCheckEquals(capture.output(mxPath(paste0('i',1:3), connect='unique.bivariate')),
               c("mxPath", "i1 -> i2 [value=0, free=TRUE]", "i1 -> i3 [value=0, free=TRUE]",  "i2 -> i3 [value=0, free=TRUE]"))

omxCheckError(mxPath('alice', to = 'bob', values = list(v=1)['v']),
              message=paste0("The 'values' argument to mxPath must be a numeric vector of length > 0 in ",
                             'mxPath("alice", to = "bob", values = list(v = 1)["v"])',
                             " 'values' argument had class list and length 1"))

omxCheckError(mxPath(from='alice', to='bob', arrows=1, fixed=TRUE),
              message=paste("mxPath does not accept 'fixed' as argument(s)",
                            "and does not accept values for the '...' argument.",
                            "See ?mxPath for more information."))