I hope you are all good! I am asking for help to perform a 2-sided significance tests at the significance level of 0.05 to test whether the correlations are equal to 0.
This is the dataset I have, and these are the following results from the estimates of the Pearson correlation coefficient and the Spearman correlation coefficient of sys12 with whr and of sys12 with bmiB.
dat_link <- url("KiGGS03_06.RData")
load(dat_link)
dat <- KiGGS03_06
whr <- as.numeric(as.character(dat$whr))
bp <- as.numeric(as.character(dat$sys12))
cor.test(whr, bp, method = "pearson")
cor.test(dat$bmiB, bp, method = "pearson")
cor.test(whr, bp, method = "spearman")
cor.test(dat$bmiB, bp, method = "spearman")
However, after this I don't know how to calculate the 2-sided t-test. Could anyone help me please! I would really appreciate it
CodePudding user response:
Thank you very much for yourself. Indeed, this function helps, but also, I can perform the two-sided t-test directly with the correlation function, as follows:
cor.test(dat$whr, dat$sysBP, method = "pearson", alternative = "two.sided", conf.level = 0.95)
cor.test(dat$BMI, dat$sysBP, method = "pearson", alternative = "two.sided", conf.level = 0.95)
cor.test(dat$whr, dat$sysBP, method = "spearman", alternative = "two.sided", conf.level = 0.95)
cor.test(dat$BMI, dat$sysBP, method = "spearman", alternative = "two.sided", conf.level = 0.95)
Thanks for your help! :slight_smile:
CodePudding user response:
Please reframe your question. Correlation means two variables are ... well.. correlated to each other (i.e. one value to another is related to a value in the other). T-test and M-U test check for a difference in mean value.