Questions tagged [categorical-data]

Categorical (also called nominal) data can take on a limited number of possible values called categories. Categorical values "label", they do not "measure". Please use [ordinal-data] tag for discrete but ordered data types.

Filter by
Sorted by
Tagged with
189
votes
6answers
192k views

Can principal component analysis be applied to datasets containing a mix of continuous and categorical variables?

I have a dataset that has both continuous and categorical data. I am analyzing by using PCA and am wondering if it is fine to include the categorical variables as a part of the analysis. My ...
137
votes
6answers
265k views

Correlations with unordered categorical variables

I have a dataframe with many observations and many variables. Some of them are categorical (unordered) and the others are numerical. I'm looking for associations between these variables. I've been ...
89
votes
1answer
178k views

Correlation between a nominal (IV) and a continuous (DV) variable

I have a nominal variable (different topics of conversation, coded as topic0=0 etc) and a number of scale variables (DV) such as the length of a conversation. How can I derive correlations between ...
84
votes
6answers
25k views

Principled way of collapsing categorical variables with many levels?

What techniques are available for collapsing (or pooling) many categories to a few, for the purpose of using them as an input (predictor) in a statistical model? Consider a variable like college ...
66
votes
3answers
60k views

One-hot vs dummy encoding in Scikit-learn

There are two different ways to encoding categorical variables. Say, one categorical variable has n values. One-hot encoding converts it into n variables, while dummy encoding converts it into n-1 ...
60
votes
4answers
21k views

What is a contrast matrix?

What exactly is contrast matrix (a term, pertaining to an analysis with categorical predictors) and how exactly is contrast matrix specified? I.e. what are columns, what are rows, what are the ...
59
votes
8answers
49k views

Does it ever make sense to treat categorical data as continuous?

In answering this question on discrete and continuous data I glibly asserted that it rarely makes sense to treat categorical data as continuous. On the face of it that seems self-evident, but ...
55
votes
4answers
190k views

Correlations between continuous and categorical (nominal) variables

I would like to find the correlation between a continuous (dependent variable) and a categorical (nominal: gender, independent variable) variable. Continuous data is not normally distributed. Before, ...
54
votes
7answers
56k views

Graph for relationship between two ordinal variables

What is an appropriate graph to illustrate the relationship between two ordinal variables? A few options I can think of: Scatter plot with added random jitter to stop points hiding each other. ...
54
votes
6answers
102k views

Warning in R - Chi-squared approximation may be incorrect

I have data showing fire fighter entrance exam results. I am testing the hypothesis that exam results and ethnicity are not mutually independent. To test this, I ran a Pearson chi-square test in R. ...
52
votes
4answers
38k views

Multinomial logistic regression vs one-vs-rest binary logistic regression

Lets say we have a dependent variable $Y$ with few categories and set of independent variables. What are the advantages of multinomial logistic regression over set of binary logistic regressions (i....
41
votes
6answers
79k views

Improve classification with many categorical variables

I'm working on a dataset with 200,000+ samples and approximately 50 features per sample: 10 continuous variables and the other ~40 are categorical variables (countries, languages, scientific fields ...
34
votes
1answer
48k views

Doing principal component analysis or factor analysis on binary data

I have a dataset with a large number of Yes/No responses. Can I use principal components (PCA) or any other data reduction analyses (such as factor analysis) for this type of data? Please advise how I ...
31
votes
3answers
13k views

Is hour of day a categorical variable?

Is "hour of the day" where the value can be 0, 1, 2, ..., 23 a categorical variable? I would be tempted to say no, since 5, for example, is 'closer' to 4 or 6 than it is to 3 or 7. On the other hand,...
31
votes
2answers
20k views

Dropping one of the columns when using one-hot encoding

My understanding is that in machine learning it can be a problem if your dataset has highly correlated features, as they effectively encode the same information. Recently someone pointed out that ...
30
votes
4answers
67k views

Predicting with both continuous and categorical features

Some predictive modeling techniques are more designed for handling continuous predictors, while others are better for handling categorical or discrete variables. Of course there exist techniques to ...
27
votes
3answers
52k views

Interpreting interaction terms in logit regression with categorical variables

I have data from a survey experiment in which respondents were randomly assigned to one of four groups: ...
27
votes
4answers
9k views

With categorical data, can there be clusters without the variables being related?

When trying to explain cluster analyses, it is common for people to misunderstand the process as being related to whether the variables are correlated. One way to get people past that confusion is a ...
26
votes
3answers
29k views

Negative binomial distribution vs binomial distribution

What is the difference between the negative binomial distribution and the binomial distribution? I tried reading online, and I found that the negative binomial distribution is used when data points ...
26
votes
5answers
35k views

How do I study the “correlation” between a continuous variable and a categorical variable?

What's a meaningful "correlation" measure to study the relation between the such two types of variables? In R, how to do it?
26
votes
3answers
16k views

Feature importance with dummy variables

I am trying to understand how I can get the feature importance of a categorical variable that has been broken down into dummy variables. I am using scikit-learn which doesn't handle categorical ...
25
votes
4answers
35k views

Why do we need to dummy code categorical variables

I am not sure why we need to dummy code categorical variables. For instance, if I have a categorical variable with four possible values 0,1,2,3 I can replace it by two dimensions. If the variable had ...
24
votes
1answer
51k views

Regression with only categorical variables

Is it possible to conduct a regression if all dependent and independent variables are categorical variables?
24
votes
2answers
27k views

Interpretation of betas when there are multiple categorical variables

I understand the concept that $\hat\beta_0$ is the mean for when the categorical variable is equal to 0 (or is the reference group), giving the end interpretation that the regression coefficient is ...
24
votes
1answer
5k views

How to visualize an enormous sparse contingency table?

I have two variables: Drug Name (DN) and corresponding Adverse Events (AE), which stand in a many-to-many relation. There are 33,556 drug names and 9,516 adverse events. The sample size is about 5.8 ...
24
votes
1answer
9k views

How to treat categorical predictors in LASSO

I am running a LASSO that has some categorical variable predictors and some continuous ones. I have a question about the categorical variables. The first step I understand is to break each of them ...
23
votes
5answers
44k views

What is the best way to visualize relationship between discrete and continuous variables?

What is the best way to show a relationship between: continuous and discrete variable, two discrete variables ? So far I have used scatter plots to look at the relationship between continuous ...
23
votes
1answer
32k views

How to deal with an SVM with categorical attributes

I have a space of 35 dimensions (attributes). My analytic problem is a simple classification one. Out of 35 dimensions, more than 25 are categorical and each attribute takes more than 50+ types of ...
22
votes
8answers
32k views

How can you visualize the relationship between 3 categorical variables?

I have a dataset with three categorical variables and I want to visualize the relationship between all three in one graph. Any ideas? Currently I am using the following three graphs: Each graph is ...
21
votes
2answers
51k views

Significance of categorical predictor in logistic regression

I am having trouble interpreting the z values for categorical variables in logistic regression. In the example below I have a categorical variable with 3 classes and according to the z value, CLASS2 ...
21
votes
1answer
58k views

Regression for categorical independent variables and a continuous dependent one

I just realized I have always worked regression problem where the independent variables were always numerical. Can I use linear regression in the case where all independent variables are categorical?
21
votes
5answers
26k views

How to recode categorical variable into numerical variable when using SVM or Neural Network

To use SVM or Neural Network it needs to transform (encode) categorical variables into numeric variables, the normal method in this case is to use 0-1 binary values with the k-th categorical value ...
20
votes
3answers
1k views

Is building a multiclass classifier better than several binary ones?

I need to classify URLs into categories. Say I have 15 categories that I'm planning to zero down every URL to. Is a 15-way classifier better? Where I have 15 labels and generate features for each ...
19
votes
4answers
2k views

Non-transitivity of correlation: correlations between gender and brain size and between brain size and IQ, but no correlation between gender and IQ

I found a following explanation on a blog and I would like to get more information about the non-transitivity of correlation: We have the following indisputable facts: On average, there is a ...
19
votes
1answer
19k views

Can glmnet logistic regression directly handle factor (categorical) variables without needing dummy variables? [closed]

I'm building a logistic regression in R using LASSO method with the functions cv.glmnet for selecting the lambda and ...
19
votes
1answer
46k views

How to test the statistical significance for categorical variable in linear regression?

If in a linear regression I have categorical variable... how do I know the stastical signifance of the categorical variable? Let's say the factor $X_1$ has 10 levels... there will be 10 different ...
19
votes
3answers
44k views

Replacing Variables by WoE (Weight of Evidence) in Logistic Regression

This is a question regarding a practice or method followed by some of my colleagues. While making a logistic regression model, I have seen people replace categorical variables (or continuous variables ...
19
votes
2answers
8k views

Anomaly Detection with Dummy Features (and other Discrete/Categorical Features)

tl;dr What is the recommended way to deal with discrete data when performing anomaly detection? What is the recommended way to deal with ...
18
votes
2answers
21k views

Qualitative variable coding in regression leads to “singularities”

I have an independent variable called "quality"; this variable has 3 modalities of response (bad quality; medium quality; high quality). I want to introduce this independent variable into my multiple ...
18
votes
2answers
22k views

How to do regression with effect coding instead of dummy coding in R?

I am currently working on a regression model where I have only categorical/factor variables as independent variables. My dependent variable is a logit transformed ratio. It is fairly easy just to run ...
18
votes
5answers
71k views

What summary statistics to use with categorical or qualitative variables?

Just to clarify, when I mean summary statistics, I refer to the Mean, Median Quartile ranges, Variance, Standard Deviation. When summarising a univariate which is categorical or qualitative, ...
18
votes
2answers
17k views

Ordinal logistic regression in Python

I would like to run an ordinal logistic regression in Python - for a response variable with three levels and with a few explanatory factors. The statsmodels package ...
17
votes
3answers
30k views

centering and scaling dummy variables

I have a data set that contains both categorical variables and continuous variables. I was advised to transform the categorical variables as binary variables for each level (ie, A_level1:{0,1}, ...
17
votes
2answers
19k views

Can we use categorical independent variable in discriminant analysis?

In discriminant analysis, the dependent variable is categorical, but can I use a categorical variable (e.g residential status: rural, urban) along with some other continuous variable as independent ...
17
votes
1answer
8k views

Interpretation of .L & .Q output from a negative binomial GLM with categorical data

I just ran a negative binomial GLM and this is the output: ...
17
votes
2answers
5k views

Alternative to sieve / mosaic plots for contingency tables

I once stumbled across a type of plot for categorical data (i.e., contingency tables) on the internet, which I really liked, but I've never found it again, and I don't even know what it's called. It ...
17
votes
3answers
10k views

Problems with one-hot encoding vs. dummy encoding

I am aware of the fact that categorical variables with k levels should be encoded with k-1 variables in dummy encoding (similarly for multi-valued categorical variables). I was wondering how much of a ...
16
votes
2answers
8k views

Is it possible to create “parallel sets” plot using R?

Thanks to Tormod question (posted here) I came across the Parallel Sets plot. Here is an example for how it looks: (It is a visualization of the Titanic dataset. Showing, for example, how most of ...
16
votes
2answers
24k views

Mixing continuous and binary data with linear SVM?

So I've been playing around with SVMs and I wonder if this is a good thing to do: I have a set of continuous features (0 to 1) and a set of categorical features that I converted to dummy variables. ...
16
votes
3answers
8k views

Why is correlation not very useful when one of the variables is categorical?

This is a little bit of a gut check, please do help me see if I'm misunderstanding this concept, and in what way. I have a functional understanding of correlation but I'm feeling a little grasping-at-...

1
2 3 4 5
62