Perhaps, rather than looking to compress your observations into a single number,
you could simply visualize what you observed: use a boxplot to show the March
and December observations, and overlay the three animals that were recaptured as
individual points, connected with a line.
Feel free to ask again if you are not sure how to do that.
Cheers,
Boris
PS. Lets hope that the capture did not stress them to the degree that their
cortisol is elevated at recapture :-)
> On 2023-01-31, at 09:52, Carolyn J Miller via R-help <r-help at
r-project.org> wrote:
>
> Thank you!
>
> Carolyn J. Miller
> M.S. Student, Ecology
> SUNY-ESF, Environmental Biology
>
>
> ________________________________
> From: Ebert,Timothy Aaron <tebert at ufl.edu>
> Sent: Tuesday, January 31, 2023 9:50 AM
> To: Carolyn J Miller <cjmill04 at syr.edu>; PIKAL Petr <petr.pikal
at precheza.cz>; r-help at r-project.org <r-help at r-project.org>
> Subject: RE: question
>
>
> As indicated here:
https://www.geeksforgeeks.org/compute-the-correlation-coefficient-value-between-two-vectors-in-r-programming-cor-function/
>
> The cor() function needs two vectors. The only way that works is if you are
looking at the correlation between ?Month? and ?Cort.?
>
> If you interested in the correlation between Cort measured in month 3
versus month 12 then you are not getting the right answer.
>
>
>
> Animal ID is not relevant in this analysis (as presented).
>
> The animals that have been measured twice would be a repeated measures
analysis (by default) unless there is some reason to suspect that the six month
lag is too long for an outcome in month 3 to influence the outcome in month 12.
The remaining animals are an experimental design for avoiding a repeated
measures analysis. This would be something like a t-test to determine if the
animals in Month 3 are different than Month 12.
>
>
>
> Tim
>
>
>
> From: Carolyn J Miller <cjmill04 at syr.edu>
> Sent: Tuesday, January 31, 2023 9:30 AM
> To: PIKAL Petr <petr.pikal at precheza.cz>; r-help at r-project.org;
Ebert,Timothy Aaron <tebert at ufl.edu>
> Subject: Re: question
>
>
>
> [External Email]
>
> Hi Timothy,
>
>
>
> Here's some example data that might help to demonstrate how the data
currently looks.
>
>
>
> AnimalID
>
> Month
>
> Cort
>
> 1
>
> 12
>
> 0.00591
>
> 1
>
> 3
>
> 0.00583
>
> 2
>
> 3
>
> 0.005722
>
> 3
>
> 3
>
> 0.005838
>
> 4
>
> 3
>
> 0.005873
>
> 4
>
> 12
>
> 0.0059
>
> 5
>
> 3
>
> 0.005724
>
> 6
>
> 12
>
> 0.005924
>
> 7
>
> 12
>
> 0.005758
>
> 8
>
> 12
>
> 0.005901
>
> 9
>
> 12
>
> 0.005894
>
> 10
>
> 3
>
> 0.005731
>
> 11
>
> 3
>
> 0.005951
>
>
>
> So Animal ID represents individual, 3 or 12 for month represents either a
March capture event or a December capture event and then the corresponding cort
value (which I used a random number generator to create these values above).
Petr, I was afraid of that response, that by using cor() I'm fundamentally
just testing the correlation for the 3 individuals that have both March and
December samples.
>
>
>
> If you guys have other thoughts I'd appreciate any suggestions.
>
>
>
> Thanks for your help and clarifying that for me.
>
>
>
> Carolyn J. Miller
>
> M.S. Student, Ecology
>
> SUNY-ESF, Environmental Biology
>
>
>
>
>
>
>
>
>
> ________________________________
>
> From: PIKAL Petr
> Sent: Tuesday, January 31, 2023 2:36 AM
> To: Carolyn J Miller; r-help at r-project.org<mailto:r-help at
r-project.org>
> Subject: RE: question
>
>
>
> Hallo Carolyn
>
> From what you describe you cannot calculate correlations.
>
> You stated that you have two sets of data, one for December and one for
> March and that rows in one set is not related to the rows in another set
and
> even persons tested in both months do not have their values on the same
row.
> In that case cor is not appropriate. You should first adjust your data so
> that results of those 3 persons are on the same row but even after that
only
> those 3 values could be evaluated by "cor".
>
> From what you wrote I think that t.test or similar beast is the way you
> should take.
>
> But without same data sample I may be wrong.
>
> Cheers
> Petr
>
>> -----Original Message-----
>> From: R-help <r-help-bounces at
r-project.org<mailto:r-help-bounces at r-project.org>> On Behalf Of
Carolyn J Miller
> via
>> R-help
>> Sent: Monday, January 30, 2023 7:16 PM
>> To: r-help at r-project.org<mailto:r-help at r-project.org>
>> Subject: [R] question
>>
>> Hi guys,
>>
>> I am using the cor() function to see if there are correlations between
> March
>> cortisol levels and December cortisol levels and I'm trying to
figure out
> if the
>> function is doing what I want it to do.
>>
>> Each sample has it's own separate row in the CSV file that I'm
working out
> of.
>> March Cort and December Cort are different columns and they come from
>> separate samples, therefore their values would not be on the same row.
> There
>> are only 3 individuals that have both December cort values and March
> cortisol
>> values but they still have different sample ID values (from different
> seasons) so
>> they are also not on the same row.
>>
>> I ran the function twice: once as cor(cortphcor, use =
"complete.obs")
> first
>>
>> and then cor(cortphcor, use = "pairwise.complete.obs", method
> "pearson").
>>
>> I received the same output both times. I guess what I'm asking is,
is the
> output
>> simply the correlation just for those 3 samples or is the second
pairwise.
>> complete.obs version giving me the correlation for all of the cort
samples
> for
>> March against all of the samples for December despite not being on the
> same
>> row? I'm trying to figure out how many sample values are
contributing to
> the
>> correlation results I'm getting.
>>
>> Thanks,
>>
>> Carolyn
>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org<mailto:R-help at r-project.org> mailing
list -- To UNSUBSCRIBE and more, see
>>
https://stat.ethz.ch/mailman/listinfo/r-help<https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C01%7Ctebert%40ufl.edu%7C6ec695ba9b8e4c83e09708db0397a6cb%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638107722117850198%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=fGQmH7ad%2BtaJdZU4jenuac%2B46daPUmruBJp4ThoO7GM%3D&reserved=0>
>> PLEASE do read the posting guide
>
http://www.R-project.org/posting-guide.html<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html&data=05%7C01%7Ctebert%40ufl.edu%7C6ec695ba9b8e4c83e09708db0397a6cb%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638107722117850198%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=jBNNlhkoXABBzpl%2FpuW4QmIWfSHGQKUnQaoy1nmpVaQ%3D&reserved=0>
>> and provide commented, minimal, self-contained, reproducible code.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Boris Steipe MD, PhD
Professor em.
Department of Biochemistry
Temerty Faculty of Medicine
University of Toronto