vjjan91 / diurnal-Acoustics

A repository that contains code and analyses examining the drivers of diurnal variation in vocal activity
MIT License
0 stars 1 forks source link

pgls analysis #8

Closed vjjan91 closed 1 month ago

vjjan91 commented 2 months ago

Hi @PaviS0102 - keep me posted on this analysis. I am going to make a few more pushes today and tomorrow for light availability, but feel free to start a new script for pgls.

vjjan91 commented 2 months ago

@PaviS0102 Excellent work on the PGLS script!

Couple of thoughts: a) I pushed the scripts again with some minor changes b) the best way to code in categorical predictors is to define them as factors and run them in the model c) I love the way you coded the median time to darkness for dawn and dusk - I think that's a nice way to explore it. d) I am getting a p value of 0.0398 for median_StartTime (not what you got) - maybe I am doing something wrong?

Anyway - take a look at this script and let me know what you think.

I think the Mikula et al. 2020 paper is also worth visiting in terms of how they included PGLS analyses (they included scaling of variables and had a categorical predictor - but I believe they ran phylolm() instead of gls). [Not that we need to follow their approach, but I found it noteworthy to mention]

Let me know when you take a look at the script. The next steps would be to plot the results of the same (say a ggplot of the coefficients?)

vjjan91 commented 2 months ago

I think this particular script is worth checking out:

https://osf.io/dp764

Two things: 1) I think scaling would be necessary (given differences in predictors) 2) take a look at the text associated with running the pgls models (as to why they ran different combinations).

Following which, we should make a plot...perhaps we are recording higher % of acoustic detections with increasing light levels? (and not the inverse?)

vjjan91 commented 2 months ago

I was thinking a bit more about this - @PaviS0102 - I think that having a coefficient plot (ggpredicts or sjPlot::plot_model()) to showcase that predicted coefficients for median startTime implies that ~with increasing time/light levels, we have higher % of detections?

Anyway, looking forward to your pull request, following code changes.

vjjan91 commented 2 months ago

@PaviS0102 To your question about habitat_type, I think including (whether a site is restored, unrestored, or a benchmark site) within a pglmm maybe worth exploring - essentially the site_type/habitat_type is a random effect here.

I came across this R code: https://daijiang.github.io/phyr/

[sorry for the barrage of comments, but I think we are getting closer to wrapping up the analysis!]

PaviS0102 commented 1 month ago

Hi Vijay,

I am so sorry for this delay in response, was travelling. Will get back to you with the Pgls script by this afternoon.

Thank you very much, Pavithra

On Tue, 28 May 2024 at 15:41, Vijay Ramesh @.***> wrote:

@PaviS0102 https://github.com/PaviS0102 To your question about habitat_type, I think including (whether a site is restored, unrestored, or a benchmark site) within a pglmm maybe worth exploring - essentially the site_type/habitat_type is a random effect here.

I came across this R code: https://daijiang.github.io/phyr/

[sorry for the barrage of comments, but I think we are getting closer to wrapping up the analysis!]

— Reply to this email directly, view it on GitHub https://github.com/vjjan91/diurnal-Acoustics/issues/8#issuecomment-2135981452, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5ORAZMLWHXHOZEROIOQKGDZETMVPAVCNFSM6AAAAABIGHITE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZVHE4DCNBVGI . You are receiving this because you were mentioned.Message ID: @.***>

PaviS0102 commented 1 month ago

Vijay, the script looked great- thank you for editing it! I have edited it and specified the changes in the pull request.

1) Could there be a difference in median_startTime results because of the log? Anyway, I have changed it in the latest script- please let me know. 2) I am not about the plot because we are not getting any significant results right now (in the edited script). 3) Sure, exploring habitat_type as a random effect in a pglmm model would be great- thanks for sharing the code. Would you like me to start a new script?

vjjan91 commented 1 month ago

@PaviS0102 Thanks for your work on this!

I pulled your script and reran some analyses (made some minor modifications) a) I removed the logging of median peak frequency and just scaled it b) I removed all the univariate models, after realizing that the AIC of all of them are far higher than the multivariate approach. c) I ran two models: one with percent_normalized_detections and the other with just percent_detections and both of them show a marginal, yet significant association with weakly territorial species and median start time, respectively. [the second model has a lower AIC compared to the first model, by about a value of 2].

I am trying to wrap my head around what maybe the best approach here and sent both outputs to Laurel.

Could you include a PGLMM as a code chunk below the same? I think it would be a single/two models you would run.

And please let me know what you think?

I pushed the scripts.

vjjan91 commented 1 month ago

I am still convinced that there is something going on between light levels and detections. See below

Screenshot 2024-05-29 111205 Screenshot 2024-05-29 111016

PaviS0102 commented 1 month ago

Vijay, thanks for this! Sure, I will code for PGLMM, include it as a chunk below this, and push the script soon. I will go over the script and get back to you.

I just chatted with Meghana about this project. She suggested a few points: 1) PGLMM would be easier to interpret and help account for habitat type differences. It could help account for differences in vocal activity of ground-level and canopy-level birds as well. 2) There could be some interaction between trophic niche and light availability. 3) If going ahead with PGLS, look at which model (Brownian/Pagel/one or two others) would be best suited. 4) Could it be worth exploring models for dawn and dusk data separately?

Oh! This is so cool- yes! The correlation seems to be fairly high as well!

On Wed, 29 May 2024 at 11:13, Vijay Ramesh @.***> wrote:

I am still convinced that there is something going on between light levels and detections. See below

Screenshot.2024-05-29.111205.png (view on web) https://github.com/vjjan91/diurnal-Acoustics/assets/20208291/acb2081c-1a0c-457b-800a-2552b7893eca Screenshot.2024-05-29.111016.png (view on web) https://github.com/vjjan91/diurnal-Acoustics/assets/20208291/57170d29-82f3-47aa-a248-c5387c852576

— Reply to this email directly, view it on GitHub https://github.com/vjjan91/diurnal-Acoustics/issues/8#issuecomment-2137662509, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5ORAZNPR2DZH6Y3UAKM66TZEXWCTAVCNFSM6AAAAABIGHITE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZXGY3DENJQHE . You are receiving this because you were mentioned.Message ID: @.***>

vjjan91 commented 1 month ago

Sounds good:

PGLMM would be easier to interpret and help account for habitat type differences. It could help account for differences in vocal activity of ground-level and canopy-level birds as well.

Sure, I doubt that habitat type has a strong effect, but either which way - let's run this to be sure.

There could be some interaction between trophic niche and light availability.

Perhaps run a model and see what it shows? I am still convinced that we need to figure out what's happening with the linear predictors before we move on.

If going ahead with PGLS, look at which model (Brownian/Pagel/one or two others) would be best suited.

Shouldn't matter much - choose one of them and we just justify it in the methods. This may matter more for larger sample sizes ~ 1000s of species.

4) Could it be worth exploring models for dawn and dusk data separately?

I doubt it - the only model in which this may be worth exploring is a model with just start_times. The rest of the predictors and their values are all the same irrespective of dawn or dusk

vjjan91 commented 1 month ago

Thanks for the excellent work on the PGLMM @PaviS0102 - The model is running/has been running for the last 5 minutes on my 64gig desktop station and hasn't stopped/converged yet.

I am trying to synthesize what we have done so far in our shared ppt and will send an email to everyone soon. I think our paper so far shows a no-result/non result, which is fine, because we tested all potential hypotheses.

I haven't run into the error you ran into for the pglmm so far.

vjjan91 commented 1 month ago

Still running!!

vjjan91 commented 1 month ago

Closing this comment by pushing the pglmm as a supplementary script. I don't think we are gaining any novel information with that analysis for now, and we can always show this to reviewers if they ask/would like to see other analyses?

PaviS0102 commented 1 month ago

Vijay, I haven't been able to work on it as I was feeling a little unwell the past few days. Yes, that sounds good to me! Will go through the Word doc and reply to your email soon.

On Mon, 3 Jun 2024 at 11:29, Vijay Ramesh @.***> wrote:

Thanks for the excellent work on the PGLMM @PaviS0102 https://github.com/PaviS0102 - The model is running/has been running for the last 5 minutes on my 64gig desktop station and hasn't stopped/converged yet.

I am trying to synthesize what we have done so far in our shared ppt and will send an email to everyone soon. I think our paper so far shows a no-result/non result, which is fine, because we tested all potential hypotheses.

I haven't run into the error you ran into for the pglmm so far.

— Reply to this email directly, view it on GitHub https://github.com/vjjan91/diurnal-Acoustics/issues/8#issuecomment-2145514316, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5ORAZP73JWBPCYPKOPDYATZFSDVJAVCNFSM6AAAAABIGHITE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBVGUYTIMZRGY . You are receiving this because you were mentioned.Message ID: @.***>