0
$\begingroup$

Two continuous variables are correlated but not in linear relation. How can I categorize the Independent variable to make two or more groups based on the correlation. For example age is correlated with depression. How can I split age in a way to find the highest depressed age group. I tried this using R and iris dataset, but looping take time and don't give me what I really want.

attach(iris)
cor(Sepal.Length,Sepal.Width)

a<-integer()
for (i in Sepal.Width){
b<-cor(Sepal.Length[Sepal.Width>i],Sepal.Width[Sepal.Width>i])
a<-c(a,b)
}
sort(a)
$\endgroup$
2
$\begingroup$

This goal is inappropriate. Categorization should play no role. Study the continuous relationship between the two continuous variables using a scatterplot and for example the loess nonparametric smoother.

$\endgroup$
  • $\begingroup$ I want to identify the highest correlated subgroup of a variable with another variable. Can you please explain why doing this is inappropriate ? for example the highly correlated age group with depression or with response to drug x. $\endgroup$ – Elmahy Feb 20 '16 at 15:03
  • $\begingroup$ See the Information Loss chapter in Biostatistics for Biomedical Research at biostat.mc.vanderbilt.edu/ClinStat . What will shed light on the subject is to relate age with depression or age with drug response, continuously. The phenomenon you are studying has no discontinuities. $\endgroup$ – Frank Harrell Feb 20 '16 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.