[Babase] Males data -- somewhat urgent update

Karl O. Pinc kop at meme.com
Thu Mar 6 13:45:08 EST 2008


On 03/06/2008 12:05:44 PM, Susan Alberts wrote:
> Hi Jeanne, Karl, Lacey, Tabby,
> 
> I am writing this from Nairobi, as an update on a query that karl,  
> Lacey and I have been working on for several days.
> 
> When I created the original database of males, I had a file that had  
> the following columns:
> 
> Sname  Grp  Datein  Dateout
> 
> In other words, one row for every period of time that a male was in a  
> group. If he was in Alto's 3 separate times, there were 3 rows for  
> him in Grp 1. If he was in an unknown group for one or more stretches  
> of time, there was one row each of these strecthes in group 9.
> 
> I have needed the data in this form from time to time, it is a very  
> useful way, for instance, of figuring out how long he spent in each  
> group and in how many different time periods.
> 
> When babase was created, it seemed clear that converting the data  
> from this form to the members form (one row of location data for each  
> animals for each day) made sense, because it should be easy to  
> reconstruct the original version. We all agreed on this.
> 
> however, it turns out not to be easy for some reason none of us gets.  
> I've tried from time to time and given up each time. Lacey found  
> records of when I tried it with Karen and Karl helped, and we didn't  
> manage to do it, and I know I've tried a couple of other times. It  
> WOULD be easy if each male had only one period of residency in each  
> group. But, we have not yet managed to recreate this original table  
> format in all these yeas. This is obviously troubling.

It's actually not so bad.  My head was clear today and I just
had a conversation with Lacey and I think we worked it out.

Her problem was with endpoints, the group at the rankdate and
the group at the statdate.  The rankdate problem is taken care
of by restricting the date range later in the process.  (The
technique is to look for transitions from one group to the
next.  You need to "see" the transition, which generally
occurs before the rankdate, into the group at time of rankdate.)
The statdate endpoint is different.  The "easy" thing to do
when making the table of transitions, is to fake it at the
statdate and create an artificial transition (a new row)
that records the individual leaving his last group on the
statdate and going into the "death group" on the day after
the statdate.  This results in a complete set of transitions.

(You'd have to do something similar for birthdate if you
wanted to go all the way back to birth.)

Another query is required to change the transitions into
a simple date-in/date-out for each group.  If your transitions
are not "complete" then at the "endpoints" you've got no
row to join with and so your first and last row go away.

We did go over this trick the other day, but everybody was
tired and in a hurry to solve the problem.
I think the problem was that Lacey had difficulty visualizing
the process.  I gave her some mental images of what the
queries are doing that should make it easier to think
about this process.

Karl <kop at meme.com>
Free Software:  "You don't pay back, you pay forward."
                  -- Robert A. Heinlein



More information about the Babase mailing list