lalma / RacoonOlyLarvalSurvival

Osstrea lurida larval survial
0 stars 0 forks source link

while loop #2

Open pmcelhany opened 2 years ago

pmcelhany commented 2 years ago

@lalma I made an R script to hold bits fo sample code. In it, I put in some code example for the while loop. It is not complete code - just shows the basic way to use the loop.

lalma commented 2 years ago

Thank you Paul! I added the output file containing my simulated data for my real dataset. In this code, should I insert my sim_decreasing data? Is the if statement in this code also pulling out the monotonically decreasing lines?

pmcelhany commented 2 years ago

I'm going to edit RaccoonLikelyhoodLarvaeInJar.R for a few minutes if you can hold off making changes

pmcelhany commented 2 years ago

@lalma I fixed the while loop - it seems to work now

pmcelhany commented 2 years ago

sure. If the is a way to map the data in the output (eg. jar_id) to site, you could make a jar_id & site df, then join them.

On Mon, Oct 11, 2021 at 3:21 PM Lindsay Alma @.***> wrote:

@pmcelhany https://github.com/pmcelhany Looks like the "site" column on the output was populated with the treatment data instead. Any way to add the site to the data without re-running the whole thing?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lalma/RacoonOlyLarvalSurvival/issues/2#issuecomment-940487792, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOOQSPT34IM65RTPWX7LH3UGNPP3ANCNFSM5E6DJQ5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

lalma commented 2 years ago

@pmcelhany Thanks Paul! I figured it out. I just matched the jar numbers with the sites. I am having a hard time writing a code to format the data into KM/cox formatting. I actually made my last dataset by hand on excel and cant do that this time. Any tips?

pmcelhany commented 2 years ago

Push your latest code github and I'll pop in some bits to get started.

On Tue, Oct 12, 2021 at 9:55 AM Lindsay Alma @.***> wrote:

@pmcelhany https://github.com/pmcelhany Thanks Paul! I figured it out. I just matched the jar numbers with the sites. I am having a hard time writing a code to format the data into KM/cox formatting. I actually made my last dataset by hand on excel and cant do that this time. Any tips?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lalma/RacoonOlyLarvalSurvival/issues/2#issuecomment-941193972, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOOQSOBGNGHAHULJSTMHGTUGRR57ANCNFSM5E6DJQ5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

lalma commented 2 years ago

@pmcelhany Pushed! Thank you!! I also noticed that on the good jars (d_sim_gj) The data appears to have doubled itself in jars 1-32. So each event has 2 simulated data points instead of 1. I can fix this really easily, but not surer why it would have done that.

pmcelhany commented 2 years ago

Ok. I'll put in some ideas. It looks like it somehow ran twice on each jar. The sim values are not the same on the copies. I think you are OK if you make sure to take the first (or second) copy or they may not be decreasing. Not sure why that happened.

On Tue, Oct 12, 2021 at 11:08 AM Lindsay Alma @.***> wrote:

@pmcelhany https://github.com/pmcelhany Pushed! Thank you!! I also noticed that on the good jars (d_sim_gj) The data appears to have doubled itself in jars 1-32. So each event has 2 simulated data points instead of 1. I can fix this really easily, but not surer why it would have done that.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lalma/RacoonOlyLarvalSurvival/issues/2#issuecomment-941249748, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOOQSLYQEQMPI4PCHTQHMDUGR2QRANCNFSM5E6DJQ5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

pmcelhany commented 2 years ago

I pushed some example code. It just does one jars so you will need to loop through all of them. It also has an odd bug in that the last count is off by one larvae. Shouldn't be too tricky to fix.

On Tue, Oct 12, 2021 at 9:55 AM Lindsay Alma @.***> wrote:

@pmcelhany https://github.com/pmcelhany Thanks Paul! I figured it out. I just matched the jar numbers with the sites. I am having a hard time writing a code to format the data into KM/cox formatting. I actually made my last dataset by hand on excel and cant do that this time. Any tips?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lalma/RacoonOlyLarvalSurvival/issues/2#issuecomment-941193972, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOOQSOBGNGHAHULJSTMHGTUGRR57ANCNFSM5E6DJQ5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

lalma commented 2 years ago

@pmcelhany Thank You! I just wanted to let you know that I am still working on this code. I think I've almost figured it out. TA-ing this quarter has been a real time suck. The professor of the class got COVID so a lot of weight was put on us TAs this last week.

lalma commented 2 years ago

@pmcelhany I crowd sourced help from my lab to write a code with 3 imbedded for loops in order to create the big database with the 500 reps + 48 jars + count days + status. It ended up being 17.5 million lines, and github wont upload it because it is too big. Here is a google drive link to the big database if you'd like to take a look. https://drive.google.com/file/d/1o8hry4KnJhrliFH84loCxe7oBzc-7lby/view?usp=sharing

Next steps are to run the cox model. According to your instructions, we want to run 500 different cox models. So we will run the first model with all of the #1 replicates, then all the #2s, and so on. Am I interpreting that correctly? Then we will save their summary(cox) outputs together onto one data frame.

pmcelhany commented 2 years ago

Hi Lindsay - great you were able to get the dataset. Yes, next is making 500 cox models. Save the whole model output, not just the summary - you can always make the summary from the whole model results later. You will also probaby want to make mixed effects models, but make the plain cox models first. FYI. I can't open google drive link - not sure why. -paul

On Thu, Nov 11, 2021 at 1:17 PM Lindsay Alma @.***> wrote:

@pmcelhany https://github.com/pmcelhany I crowd sourced help from my lab to write a code with 3 imbedded for loops in order to create the big database with the 500 reps + 48 jars + count days + status. It ended up being 17.5 million lines, and github wont upload it because it is too big. Here is a google drive link to the big database if you'd like to take a look. https://drive.google.com/file/d/1o8hry4KnJhrliFH84loCxe7oBzc-7lby/view?usp=sharing http://url

Next steps are to run the cox model. According to your instructions, we want to run 500 different cox models. So we will run the first model with all of the #1 https://github.com/lalma/RacoonOlyLarvalSurvival/issues/1 replicates, then all the #2s, and so on. Am I interpreting that correctly? Then we will save their summary(cox) outputs together onto one data frame.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lalma/RacoonOlyLarvalSurvival/issues/2#issuecomment-966630288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOOQSMDU2POOSF4QWCG5CTULQW57ANCNFSM5E6DJQ5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.