[R] question

Carolyn J Miller cjm|||04 @end|ng |rom @yr@edu
Tue Jan 31 15:30:03 CET 2023


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 using 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 using r-project.org> On Behalf Of Carolyn J Miller
via
> R-help
> Sent: Monday, January 30, 2023 7:16 PM
> To: r-help using 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 using 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.

	[[alternative HTML version deleted]]



More information about the R-help mailing list