bartholdja / compLionMort

Comparison of age- and sex-specific mortality among lion populations
1 stars 1 forks source link

plot.basta and lifetable code #5

Open bartholdja opened 11 years ago

bartholdja commented 11 years ago

Hi Fer, I've got a meeting with Andy tomorrow and I would like to show him some mortality plots and maybe a preliminary life table.

So I was wondering whether I could adapt the BaSTA code for doing this but the plot.basta function, for example, is asterisked. Could you maybe upload some code for me?

Or is there a way how I can use our output list with BaSTA?

Thanks, Julia

fercol commented 11 years ago

Hi Julia, I just updated the lionMort code. At the end you'll find additional code to create survival and mortality plots from the outputs. The plots look pretty interesting! The code is not nice but I'm sure you can make the plots look much better...

Abrazos,

Fer

bartholdja commented 11 years ago

Hi, It seems that somehow the updated code hasn't made it to the GitHub repository. Did you sync your local repository with GitHub? Maybe you could try again? Thanks! Cheers, Julia

fercol commented 11 years ago

I just did... I'm not sure what I need to do; I committed it, I pushed it, and now I synced it... Hope it works.

Fer

Fernando Colchero Assistant Professor Department of Mathematics and Computer Science Max-Planck Odense Center on the Biodemography of Aging

Tlf. +45 65 50 23 24 Email colchero@imada.sdu.dk Web www.sdu.dk/staff/colchero Pers. web www.colchero.com Adr. Campusvej 55, 5230, Odense, Dk

University of Southern Denmark

On 30 Sep 2013, at 16:23, Julia Barthold notifications@github.com wrote:

Hi, It seems that somehow the updated code hasn't made it to the GitHub repository. Did you sync your local repository with GitHub? Maybe you could try again? Thanks! Cheers, Julia

— Reply to this email directly or view it on GitHub.

bartholdja commented 11 years ago

Sounds perfectly right, but the file doesn't show up (for me) in our GitHub online repository. I assume it shows up in yours? Weird. Well, I hate to say it, but can you just put the file into dropbox, because I really should do some plotting now. Thanks!

fercol commented 11 years ago

I just tried a different way (via the webpage), if it's not there in 5 mins, let me know.

Best,

Fer

Fernando Colchero Assistant Professor Department of Mathematics and Computer Science Max-Planck Odense Center on the Biodemography of Aging

Tlf. +45 65 50 23 24 Email colchero@imada.sdu.dk Web www.sdu.dk/staff/colchero Pers. web www.colchero.com Adr. Campusvej 55, 5230, Odense, Dk

University of Southern Denmark

On 30 Sep 2013, at 16:42, Julia Barthold notifications@github.com wrote:

Sounds perfectly right, but the file doesn't show up (for me) in our GitHub online repository. I assume it shows up in yours? Weird. Well, I hate to say it, but can you just put the file into dropbox, because I really should do some plotting now. Thanks!

— Reply to this email directly or view it on GitHub.

bartholdja commented 11 years ago

I think the solution to the mystery is that you are still working in your forked repository instead of our shared one. It's fine because everything is save. But at the moment you still have to commit and push changes from your local repository to your forked repository, and then from there to the shared repository.

However, you have contribution rights directly to the master repository bartholdja/compLionMort. You'll probably have to make a local repository with your GitHub app for this master repository and delete the other one. But let's do it together. I am back on Friday. Thanks for the code.

Cheers, Julia

fercol commented 11 years ago

In case it doesn't make it, here's the file... I'll try to figure it out later.

Fernando Colchero Assistant Professor Department of Mathematics and Computer Science Max-Planck Odense Center on the Biodemography of Aging

Tlf. +45 65 50 23 24 Email colchero@imada.sdu.dk Web www.sdu.dk/staff/colchero Pers. web www.colchero.com Adr. Campusvej 55, 5230, Odense, Dk

University of Southern Denmark

On 30 Sep 2013, at 16:53, Julia Barthold notifications@github.com wrote:

I think the solution to the mystery is that you are still working in your forked repository instead of our shared one. It's fine because everything is save. But at the moment you still have to commit and push changes from your local repository to your forked repository, and then from there to the shared repository.

However, you have contribution rights directly to the master repository bartholdja/compLionMort. You'll probably have to make a local repository with your GitHub app for this master repository and delete the other one. But let's do it together. I am back on Friday. Thanks for the code.

Cheers, Julia

— Reply to this email directly or view it on GitHub.

bartholdja commented 11 years ago

Sorry, forgot to mention it, but it appeared in the repository after you tried it via the webpage. All good for now.

fercol commented 11 years ago

Ok, I'll have to check the tutorial again to find out what I'm doing wrong, but I think I have to replace my repository with yours... In any case, here's the plot I have from a run. I like it!

Best,

Fer

Fernando Colchero Assistant Professor Department of Mathematics and Computer Science Max-Planck Odense Center on the Biodemography of Aging

Tlf. +45 65 50 23 24 Email colchero@imada.sdu.dk Web www.sdu.dk/staff/colchero Pers. web www.colchero.com Adr. Campusvej 55, 5230, Odense, Dk

University of Southern Denmark

On 30 Sep 2013, at 17:05, Julia Barthold notifications@github.com wrote:

Sorry, forgot to mention it, but it appeared in the repository after you tried it via the webpage. All good for now.

— Reply to this email directly or view it on GitHub.

fercol commented 11 years ago

Did you get the plot? What do you think?

Best,

Fer

Fernando Colchero Assistant Professor Department of Mathematics and Computer Science Max-Planck Odense Center on the Biodemography of Aging

Tlf. +45 65 50 23 24 Email colchero@imada.sdu.dk Web www.sdu.dk/staff/colchero Pers. web www.colchero.com Adr. Campusvej 55, 5230, Odense, Dk

University of Southern Denmark

On 30 Sep 2013, at 17:05, Julia Barthold notifications@github.com wrote:

Sorry, forgot to mention it, but it appeared in the repository after you tried it via the webpage. All good for now.

— Reply to this email directly or view it on GitHub.

bartholdja commented 11 years ago

Hi Fer,

I actually did not get your plot. Do you know that this conversation is in a "comment thread" on GitHub? I post my answers here, and they send you an email. If you press answer to that email, your answer gets posted here, and they send me an email. I think that we can't send files back and forth like this.

That said, I did plot one of my own runs using your code. It's in the results folder "survMort.pdf". It looks great. However, it shows that we are not getting the mortality of young individuals right. Mortality of young females is estimated to be higher than that of young males, but we know from theory and other species that that is most likely not true in sexually dimorphic species.

But I think that I figured out what the problem is: there must be a strong male-bias in the unsexed individuals. I deduced that from two things (jump over if pressed for time):

First, we have a higher number of female observations than male observations in the overall data set. However, if we assume an equal sex ratio at birth, we have the same number of observations on males and females born into the study population. But all males born in the study population either die or disperse, and other males immigrate into the population. So we would expect to have more observations of males than of females in the overall data set. Where are the missing males?

Second, we dug out some data on fetus sex ratio from cullings in the Kruger and it shows a sex ratio of 1.2 males to 0.8 females. So there are more males being born. Which makes the question even more important, where are the missing males?

So, if we assume a male-biased sex ratio at birth and a higher mortality rate of young males when compared to young females, we have a more young males dying than young females, right? Now, the individuals that die young tend to die unsexed. So I think that there are lots of males among the unsexed individuals. If we did observe these deaths as male deaths, that would pull the beginning of the mortality curve up, which would result in young males having an equal or higher mortality rate when compared to young females.

At the moment, we tell the model that an unsexed individuals as a 50% chance of being either sex. I think that we should change that to a higher chance of being male than female.

Cheers, Julia

fercol commented 11 years ago

Hi Julia,

Let's give it another try to GitHub, but if it starts being a bit of a pain, let's just use the traditional old people's way.

We can account for the male biased sex ratio when we estimate the likelihood of a given individual being a male. It's just a Bernoulli probability taken from the ratio itself.

best,

Fer

Fernando Colchero Assistant Professor Department of Mathematics and Computer Science Max-Planck Odense Center on the Biodemography of Aging

Tlf. +45 65 50 23 24 Email colchero@imada.sdu.dk Web www.sdu.dk/staff/colchero Pers. web www.colchero.com Adr. Campusvej 55, 5230, Odense, Dk

University of Southern Denmark

On 1 Oct 2013, at 13:54, Julia Barthold notifications@github.com wrote:

Hi Fer,

I actually did not get your plot. Do you know that this conversation is in a "comment thread" on GitHub? I post my answers here, and they send you an email. If you press answer to that email, your answer gets posted here, and they send me an email. I think that we can't send files back and forth like this.

That said, I did plot one of my own runs using your code. It's in the results folder "survMort.pdf". It looks great. However, it shows that we are not getting the mortality of young individuals right. Mortality of young females is estimated to be higher than that of young males, but we know from theory and other species that that is most likely not true in sexually dimorphic species.

But I think that I figured out what the problem is: there must be a strong male-bias in the unsexed individuals. I deduced that from two things (jump over if pressed for time):

First, we have a higher number of female observations than male observations in the overall data set. However, if we assume an equal sex ratio at birth, we have the same number of observations on males and females born into the study population. But all males born in the study population either die or disperse, and other males immigrate into the population. So we would expect to have more observations of males than of females in the overall data set. Where are the missing males?

Second, we dug out some data on fetus sex ratio from cullings in the Kruger and it shows a sex ratio of 1.2 males to 0.8 females. So there are more males being born. Which makes the question even more important, where are the missing males?

So, if we assume a male-biased sex ratio at birth and a higher mortality rate of young males when compared to young females, we have a more young males dying than young females, right? Now, the individuals that die young tend to die unsexed. So I think that there are lots of males among the unsexed individuals. If we did observe these deaths as male deaths, that would pull the beginning of the mortality curve up, which would result in young males having an equal or higher mortality rate when compared to young females.

At the moment, we tell the model that an unsexed individuals as a 50% chance of being either sex. I think that we should change that to a higher chance of being male than female.

Cheers, Julia

— Reply to this email directly or view it on GitHub.