## Can you correlate a continuous variable with a categorical variable?

## Can you correlate a continuous variable with a categorical variable?

The point biserial correlation is the most intuitive of the various options to measure association between a continuous and categorical variable. It has obvious strengths — a strong similarity with Pearson correlation and is relatively computationally inexpensive to compute.

## What is an example of correlation between two variables?

An example of positive correlation would be height and weight. Taller people tend to be heavier. A negative correlation is a relationship between two variables in which an increase in one variable is associated with a decrease in the other.

**Which plots would be used to find relationship between continuous and categorical variable?**

One useful way to explore the relationship between a continuous and a categorical variable is with a set of side by side box plots, one for each of the categories. Similarities and differences between the category levels can be seen in the length and position of the boxes and whiskers.

### How do you find the correlation between categorical and continuous variables in Python?

If a categorical variable only has two values (i.e. true/false), then we can convert it into a numeric datatype (0 and 1). Since it becomes a numeric variable, we can find out the correlation using the dataframe. corr() function.

### How do you find the correlation between categorical and numerical data?

If your categorical variable is dichotomous (only two values), then you can use the point-biserial correlation. There is a function to do this in the ltm package. You could do a logistic regression and use various evaluations of it (accuracy, etc.) in place of a correlation coefficient.

**What are 3 examples of correlation?**

Common Examples of Positive Correlations

- The more time you spend running on a treadmill, the more calories you will burn.
- The longer your hair grows, the more shampoo you will need.
- The more money you save, the more financially secure you feel.
- As the temperature goes up, ice cream sales also go up.

## What is the best visualization technique to explore a categorical and a continuous variable?

A boxplot, sometimes called a box and whisker plot, is great for visualizing the central tendency and spread of a continuous variable across the levels of a categorical variable.

## Can Spearman correlation be used for categorical data?

If the categorical variable has two categories (dichotomous), you can use the Pearson correlation or Spearman correlation.

**How can I conduct a correlation test between a nominal variable and a scale or continuous variable?**

To do correlation between nominal variable and a scale, make sure the nominal is variable is dichotomy, then you can do point biserial correlation. When the nominal variable is more than 2 categories, correlation test violate the assumption of linearity.

### How do you determine correlation between categorical variables?

Checking if two categorical variables are independent can be done with Chi-Squared test of independence. This is a typical Chi-Square test: if we assume that two variables are independent, then the values of the contingency table for these variables should be distributed uniformly.