File tree Expand file tree Collapse file tree 4 files changed +12
-12
lines changed
Expand file tree Collapse file tree 4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -90,16 +90,16 @@ void lbdp_gill
9090 assert (parent <=nnode );
9191#endif
9292
93+ ll = 0 ;
94+
9395 // singular portion of filter equation
9496 switch (nodetype [parent ]) {
9597 default : // non-genealogical event
9698 break ;
9799 case 0 : // root
98- ll = 0 ;
99100 ell += 1 ;
100101 break ;
101102 case 1 : // sample
102- ll = 0 ;
103103 assert (n >= ell );
104104 assert (ell >= 0 );
105105 if (sat [parent ] == 1 ) { // s=1
Original file line number Diff line number Diff line change @@ -168,12 +168,13 @@ void seirs_gill
168168 int parcol = color [parlin ];
169169 assert (parlin >= 0 && parlin < nsample );
170170
171+ ll = 0 ;
172+
171173 // singular portion of filter equation
172174 switch (nodetype [parent ]) {
173175 default : // non-genealogical event
174176 break ;
175- case 0 : // root
176- ll = 0 ;
177+ case 0 : // root
177178 // color lineages by sampling without replacement
178179 assert (sat [parent ]== 1 );
179180 int c = child [index [parent ]];
@@ -204,7 +205,6 @@ void seirs_gill
204205 }
205206 break ;
206207 case 1 : // sample
207- ll = 0 ;
208208 // If parent is not in deme I, likelihood = 0.
209209 if (parcol != 1 ) {
210210 ll += R_NegInf ;
@@ -227,7 +227,6 @@ void seirs_gill
227227 color [parlin ] = R_NaReal ;
228228 break ;
229229 case 2 : // branch point s=(1,1)
230- ll = 0 ;
231230 // If parent is not in deme I, likelihood = 0.
232231 if (parcol != 1 ) {
233232 ll += R_NegInf ;
Original file line number Diff line number Diff line change @@ -110,16 +110,16 @@ void sirs_gill
110110 assert (parent <=nnode );
111111#endif
112112
113+ ll = 0 ;
114+
113115 // singular portion of filter equation
114116 switch (nodetype [parent ]) {
115117 default : // non-genealogical event
116118 break ;
117119 case 0 : // root
118- ll = 0 ;
119120 ellI += 1 ;
120121 break ;
121122 case 1 : // sample
122- ll = 0 ;
123123 assert (I >= ellI );
124124 assert (ellI >= 0 );
125125 if (sat [parent ] == 1 ) {
@@ -133,7 +133,6 @@ void sirs_gill
133133 }
134134 break ;
135135 case 2 : // branch point s=(1,1)
136- ll = 0 ;
137136 assert (S >= 0 );
138137 assert (I >= 0 );
139138 assert (ellI > 0 );
Original file line number Diff line number Diff line change @@ -322,12 +322,13 @@ void twospecies_gill
322322 assert (nearbyint (N2 )== nearbyint (S2 + I2 + R2 ));
323323 assert (check_color (color ,nsample ,ell1 ,ell2 ));
324324
325+ ll = 0 ;
326+
325327 // singular portion of filter equation
326328 switch (nodetype [parent ]) {
327329 default : // non-genealogical event
328330 break ;
329331 case 0 : // root
330- ll = 0 ;
331332 // color lineages by sampling without replacement
332333 assert (sat [parent ]== 1 );
333334 int c = child [index [parent ]];
@@ -361,7 +362,9 @@ void twospecies_gill
361362 assert (check_color (color ,nsample ,ell1 ,ell2 ));
362363 break ;
363364 case 1 : // sample
364- ll = 0 ;
365+ if (parcol != deme ) { // parent color does not match the observed deme
366+ ll += R_NegInf ;
367+ }
365368 if (sat [parent ] == 0 ) { // s=(0,0)
366369 if (parcol == host1 ) {
367370 ell1 -= 1 ;
@@ -404,7 +407,6 @@ void twospecies_gill
404407 assert (check_color (color ,nsample ,ell1 ,ell2 ));
405408 break ;
406409 case 2 : // branch point
407- ll = 0 ;
408410 assert (sat [parent ]== 2 );
409411 if (parcol == host1 ) { // parent is in I1
410412 assert (S1 >=0 && S2 >=0 && I1 >=ell1 && ell1 >=0 );
You can’t perform that action at this time.
0 commit comments