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
question
3 messages · Carolyn J Miller, Ebert,Timothy Aaron, PIKAL Petr
Can you please show us a small sample of your data? The first 5 or 10 lines should be good enough. Tim -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Carolyn J Miller via R-help Sent: Monday, January 30, 2023 1:16 PM To: r-help at r-project.org Subject: [R] question [External Email] 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 ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C01%7Ctebert%40ufl.edu%7Cdd5773a499934ef0fd3a08db032d0447%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638107264114367125%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=YxPstnNkhcAvtY7SdBGpW3LFFubZl2WKaEuc29qh40Y%3D&reserved=0 PLEASE do read the posting guide https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html&data=05%7C01%7Ctebert%40ufl.edu%7Cdd5773a499934ef0fd3a08db032d0447%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638107264114367125%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OxrAXBA2yjPy%2B94tKkiQ34adp%2BPrNPcpp2SE81ZEUZ4%3D&reserved=0 and provide commented, minimal, self-contained, reproducible code.
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> On Behalf Of Carolyn J Miller
via
R-help Sent: Monday, January 30, 2023 7:16 PM To: 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 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.