elmacartney / Postcop_MA

0 stars 0 forks source link

calculating r functions #5

Closed elmacartney closed 1 year ago

elmacartney commented 1 year ago

Hi @itchyshin I've looked at the functions to convert estimates and test stats to r, and am wondering if you can please write the function to take N rather than n1 and n2 as 16 out of 18 effects that were reported as estimates and sd had a continuous N (i.e., there was not n1 and n2). The two that have n1 and n2 appear to have a balanced design.

All studies that reported F and t had continuous traits rather than two groups.

Also, what should we do about N that are non-independent (i.e., the same focal male is competed multiple times against X competitors) or where the study doesn't take a single focal male from a competition trial but instead includes both males from the same trial?

itchyshin commented 1 year ago

@elmacartney

We need to chat about this - I think N would always fit into n1 and n2 (this is more flexible like this and we need this for many functions to work) - but I need to understand how you have N - either we need to split or you can put N = n1 and N = n2 -- it is fine for non-indepdedent design - it does not matter for point estimate but it matters for error which we calculate separately

elmacartney commented 1 year ago

Okay, cool. I had created a modified function with n1 and n2 as N/2 but wasn't sure if that was correct. I can assign n1 = N and n2 = N for now and we can discuss.

On Wed, Jan 11, 2023 at 10:05 AM Shinichi Nakagawa @.***> wrote:

@elmacartney https://github.com/elmacartney

We need to chat about this - I think N would always fit into n1 and n2 (this is more flexible like this and we need this for many functions to work) - but I need to understand how you have N - either we need to split or you can put N = n1 and N = n2 -- it is fine for non-indepdedent design - it does not matter for point estimate but it matters for error which we calculate separately

— Reply to this email directly, view it on GitHub https://github.com/elmacartney/Postcop_MA/issues/5#issuecomment-1378010116, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATGFCZWJMY26DMEAEWSFOJTWRXTLBANCNFSM6AAAAAATXKYUHM . You are receiving this because you were mentioned.Message ID: @.***>

elmacartney commented 1 year ago

@itchyshin also, the rep() function within the group4 function is causing issues due to the many NAs in the df as most studies do not present n1 - n4. I have tried to use na.rm when running the function but this doesn't seem to work.

I guess one option could be to subset the dataframe to only the studies with 4 groups then add the correlation coefficient back into the original dataframe, but not sure if there is a simpler way to adjust the function?

itchyshin commented 1 year ago

@elmacartney - we will need n1 - n4 for this function to work.

If the total N is 12 and they do not tell you what is in each - then we should assume 12/4 = 4 for each n1, n2, n3 and n4.

Do you know at least the total N?

elmacartney commented 1 year ago

I mean that only one study has four groups (I have n1, n2, n3, and n4 for this), but the other studies that report different stats (e.g., t, f, etc have NAs in the columns for n1 - n4; in my dataset they are called n_low, n_med1, n_med2, n_high) which means that the function doesn't run. I've screenshotted the dataset for you to see what I mean. Otherwise, we can go over it in our meeting.

Screen Shot 2023-01-11 at 12 34 03 pm
itchyshin commented 1 year ago

OK @elmacartney - I understand what you mean now

I think it is the easiest to do what you said.

"I guess one option could be to subset the dataframe to only the studies with 4 groups then add the correlation coefficient back into the original dataframe, but not sure if there is a simpler way to adjust the function?"

There is a clever way of just applying different functions to different rows but this may take longer than what you suggested.

Anyway, as much as you can do and I am happy to meet when you think is best to meet - we will find a time