1
$\begingroup$

In my dataset, I have one binary variable (Active/Inactive) and rest of the variables are continuous. I have converted a categorical variable into binomial (0,1) and then ran a correlogram plot in R among each variable. Am I right in calculating a correlation value between categorical and continuous variables by simply using corr_val <- cor(dataset) and corrplot(corr_val,type = "lower",order="hclust").

enter image description here

$\endgroup$
2
$\begingroup$

As long as the categorical variable has been converted to binary form beforehand, than using the R cor with the Pearson default command will work, and the correlation will be a point-biserial correlation. Note that when transforming your categorical variable to a binary one you should use logical points (as it seems you have via active/inactive).

$\endgroup$
0
$\begingroup$

In this way you lose the information related to the categorical variable. You can try using the featurePlot() function from the caret package to display a scatterplot matrix.

library(caret)
featurePlot(x = dataset[, continuous variables], y = dataset[, categorical variable], plot = "pairs")
$\endgroup$

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.