File: gmm_intersections_001.R

package info (click to toggle)
r-cran-mixturefitting 0.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 448 kB
  • sloc: ansic: 518; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 806 bytes parent folder | download
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
library( MixtureFitting )
P = matrix( c( 0.0443473274465592, 0.130138383023397,  0.825514289530041,
               2.21235358083254,   2.00352959127296,   2.03247868665627,
               0.27455506306116,   0.0275176004414257, 0.106694771531626 ),
            ncol = 3 )

test1 = all.equal( gmm_intersections( P[c(1,3),] ),
                   c( 1.66800776372449, 2.33295709358655 ) )
test2 = all.equal( gmm_intersections( P[c(2,3),] ),
                   c() )
test3 = all.equal( gmm_intersections( P[c(1,1),] ),
                   NaN )
test4 = all.equal( gmm_intersections( c( 0.5, 0.5, 1, 2, 1, 1 ) ),
                   c( 1.5 ) )

if( test1 != TRUE ) {
    stop( test1 )
}
if( test2 != TRUE ) {
    stop( test2 )
}
if( test3 != TRUE ) {
    stop( test3 )
}
if( test4 != TRUE ) {
    stop( test4 )
}