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
83
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 ...
137
votes
6answers
264k 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 ...
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, ...
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 ...
189
votes
6answers
191k 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 ...
9
votes
2answers
17k views

Preprocess categorical variables with many values [duplicate]

I have a dataset that consists of only categorical variables and a target variable. I want to predict the (binary) target variable with the categorical variables. I am trying to do this in Python and ...
15
votes
2answers
17k views

Correlation coefficient between a (non-dichotomous) nominal variable and a numeric (interval) or an ordinal variable

I've already read all the pages in this site trying to find the answer to my problem but no one seems to be the right one form me... First I explain you the kind of data I'm working with... Let's ...
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 ...
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. ...
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 ...
15
votes
1answer
18k views

What is the optimal distance function for individuals when attributes are nominal?

I do not know which distance function between individuals to use in case of nominal (unordered categorical) attributes. I was reading some textbook and they suggest Simple Matching function but some ...
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 ...
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 ...
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 ...
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 ...
11
votes
2answers
19k views

Regression based for example on days of week

I need a little help to move in the right direction. It's a long time since I studied any stats and the jargon seems to have changed. Imagine that I have a set of car-related data such as Journey ...
8
votes
1answer
8k views

Interpretation of interaction term

I have a model: $$ \ln({\rm earnings}) = a+b_1{\rm female}+b_2{\rm white}+b_3{\rm female}\times{\rm white} $$ ${\rm female}$ and ${\rm white}$ are dummy variables. I have interpreted $b_1$ and $b_2$: ...
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....
2
votes
1answer
9k views

Testing for moderation with continuous vs. categorical moderators

I am testing an interaction effect where $X$ and $Y$ are continuous variable and $M$ (Moderator) is a categorical variable (effects coding $+1$, $-1$). I have no clue about how to do a post-hoc ...
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 ...
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 ...
15
votes
2answers
56k views

Understanding dummy (manual or automated) variable creation in GLM

If a factor variable (e.g. gender with levels M and F) is used in the glm formula, dummy variable(s) are created, and can be found in the glm model summary along with their associated coefficients (e....
6
votes
2answers
7k views

Removing intercept from GLM for multiple factorial predictors only works for first factor in model

I am running a binomial logistic regression with a logit link function in R. My response is factorial [0/1] and I have two multilevel factorial predictors - let's call them $a$ and $b$ where $a$ has 4 ...
3
votes
3answers
6k views

Dealing with new Factor Levels in a Regression in R

I originally posted this in stackoverflow (as given here) but was told to try here since it might be more relevant here. I am very new to statistics and R in general so my question might be a bit dumb,...
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: ...
4
votes
1answer
2k views

How can logistic regression have a factorial predictor and no intercept?

I tried a regression in the form ${\rm logit}(Y) = {\rm coefficient}\times X + 0 + e$, where $Y$ is a binomial variable and $X$ is a factor variable with $n$ levels. I noticed that removing the ...
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 ...
8
votes
2answers
3k views

What is the justification for unsupervised discretization of continuous variables?

A number of sources suggest that there are many negative consequences of the discretization (categorization) of continuous variables prior to statistical analysis (sample of references [1]-[4] below). ...
9
votes
1answer
8k views

Coding for an ordered covariate

I am performing ordinal regression, I have 5 response categories and several predictors both continuous and categorical. I would like to add a predictor which is categorical but ordered (1, 2, 3, 4). ...
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?
7
votes
1answer
3k views

If a factor variable is to be dropped in model selection, should all levels be dropped simultaneously? If so, why? [duplicate]

In answer to a previous question factor pooling in model selection was discussed. If a factor or categorical variable is to be dropped in model selection, should all levels be dropped simultaneously? ...
13
votes
5answers
5k views

Why should binning be avoided at all costs?

So I've read a few posts about why binning should always be avoided. A popular reference for that claim being this link. The main getaway being that the binning points (or cutpoints) are rather ...
11
votes
2answers
3k views

Should types of data (nominal/ordinal/interval/ratio) really be considered types of variables?

So for instance here are the definitions that I get from standard text books Variable - characteristic of population or sample. ex. Price of a stock or grade on a test Data - actual ...
1
vote
3answers
3k views

Is it advisable to drop certain levels of a categorical variable? [duplicate]

Let's say that I have one categorical variable with six levels, and I then create five indicator variables in order to represent the six levels. If two of the five variables are insignificant, then do ...
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 ...
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 ...
13
votes
2answers
26k views

How to transform ordinal data from questionnaire into proper interval data?

Are there any straightforward methods of transforming ordinal level data into interval level (just as there are for doing it the other way round)? And performable in Excel or SPSS? Having the data, ...
8
votes
3answers
2k views

Testing paired frequencies for independence

I hope this isn't either far too basic or redundant. I have been looking around for guidance but so far I am still uncertain of how to proceed. My data consists of counts of a particular structure ...
9
votes
2answers
5k views

Correlation among categories between categorical nominal variables

I have a data set with two categorical nominal variables (both with 5 categories). I would like to know if (and how) I am able to identify potential correlations between the categories from these two ...
6
votes
1answer
790 views

What are LS means useful for?

I have recently learned about LS means (estimated marginal means, predicted marginal means) and I am trying to understand what they could be used for and under what circumstances. For concreteness, ...
1
vote
2answers
5k views

Regression with categorical predictors - use only some dummy variables [duplicate]

I am working on a regression and I have a factor variable "Marital Status" Marital status has 5 levels: Single, Married, Divored, Widowed, Other (don't ask me what constitutes someone being an 'other'...
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 ...
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 ...
12
votes
2answers
20k views

Collinearity between categorical variables

There's a lot about collinearity with respect to continuous predictors but not so much that I can find on categorical predictors. I have data of this type illustrated below. The first factor is a ...
7
votes
2answers
9k views

Can binary data be ordinal?

Binary data is often mentioned as a nominal sub-category, especially in such examples as female/male, smoker/non-smoker, etc. However, binary data with such values as pass/fail, correct/incorrect, ...
10
votes
1answer
2k views

What are dangers of calculating Pearson correlations (instead of tetrachoric ones) for binary variables in factor analysis?

I do research on educational games, and some of my current projects involve using data from BoardGameGeek (BGG) and VideoGameGeek (VGG) to examine relationships between design elements of games (i.e., ...
8
votes
1answer
2k views

Where to find a guide to encoding categorical features?

I am facing an ML task with various categorical variables. Some examples include the following: Binary variables (0,1). Multilevel factors that can be ordered (low, medium, high). Multilevel factors ...
7
votes
2answers
8k views

Factor analysis for ordinal variables that have different categories

I have a data set that contains about 40 categorical variables that are taken as independent variables (and believed to be related to some unobservable human resource factors) and 4 categorical ...
65
votes
3answers
59k 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 ...
12
votes
2answers
5k views

Should I run separate regressions for every community, or can community simply be a controlling variable in an aggregated model?

I am running an OLS model with a continuous asset index variable as the DV. My data is aggregated from three similar communities in close geographic proximity to one another. Despite this, I thought ...

1
2 3 4 5
9