divorce and break_partner

7 views
Skip to first unread message

Ingrid Schockaert

unread,
Apr 29, 2020, 6:23:29 AM4/29/20
to liam2-users
Dear all

I'm using the following code to simulate divorce 

person:
links:
            partner: {type: many2one, target: person, field: partner_id}

divorce:
                - atrisk: (partner_id !=UNSET) and (is_migr==0) and (age<85) 
                - divorce: align(0.0, "i_scheiden.csv", filter=ISFEMALE and atrisk)
                - break_partner: partner.divorce
                - show (groupby(divorce,break_partner))               



The part of the code break_partner, however, doesn't work correctly:

divorce | break_partner |       |        
        |         False |  True |   total
  False |       8058259 | 14881 | 8073140
   True |         32137 |   157 |   32294
  total |       8090396 | 15038 | 8105434


It seems a very easy code to me, but I can't find why the "break_partner" is not working. As far as I know, in the database there are no duplicated partner_id's and no duplicated id's. 
In attachment, I added two examples from the vitables of a partner unwilling to break and/or the person divorced also being the breaking partner...

Thanks in advance!
Ingrid

example of failing break_partner.docx

Gaëtan de Menten

unread,
Apr 29, 2020, 8:04:48 AM4/29/20
to liam2...@googlegroups.com

Dear Ingrid,

 

I am a bit at a loss explaining what could be happening.

 

Just for my own sanity, I checked the same code on the demo model and it seems to give sensible results:

 

divorce | break_partner |      |     

        |         False | True | total

  False |          9961 |   29 |  9990

   True |            29 |    0 |    29

  total |          9990 |   29 | 10019

 

 

The only case where I can see divorce and break_partner to be both true at the same time (for the 157 individuals in your groupby), would be if somebody has him/herself as partner.

 

You could use:

 

>>> dump(filter=id == partner_id)

 

to check that.

 

As for why you have more divorce than break_partner, the only explanation I see is that you have inconsistent partner links somewhere (person X has person Y as partner but person Y has somebody else as partner -- or no partner at all).

 

You can find those using:

 

>>> dump(filter=partner_id != UNSET and partner.partner_id != id)

 

Also, you are using version 0.12, right (not that I can explain the behavior using an earlier version, but it helps to be on the same page)?

 

If the above does not help, I would need to somehow be able to execute your code myself to see what is happening behind the scene. Would it be possible for you to send me (not on the mailing list) some _runnable_ code & dataset which exhibits the problem?

 

Hope it helps,

Gaëtan

 

--
You received this message because you are subscribed to the Google Groups "liam2-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liam2-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/liam2-users/03db1eee-ef48-406a-bbdc-3a00b6df5acf%40googlegroups.com.



Disclaimer: This e-mail may contain confidential information which is intended only for the use of the recipient(s) named above.
If you have received this communication in error, please notify the sender immediately and delete this e-mail from your system.
Please note that e-mail messages cannot be considered as official information from the Federal Planning Bureau.
Reply all
Reply to author
Forward
0 new messages