Questions tagged [categorical-encoding]

Representing categorical variables as sets of numerical variables. Necessary in many types of analysis for them to process categorical data. A common example is using a categorical predictor in regression/ANOVA via dummy coding, effect coding, Helmert coding, user-defined contrasts, etc.

133 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
1answer
105 views

How to Deal with Categorical Variables that Allow Selection of Multiple Values per Observation?

Say you are dealing with a movie database that has movies and their genres. Genre is a categorical variable but each movie can belong to more than one genre. For example, Movie A may be Comedy and ...
4
votes
0answers
155 views

Dropping columns from an orthogonal design matrix?

Hello: I’m working with a three factor (ANOVA) design that I wish to use in an MCMC chain to estimate the parameters for the main effects and treatment interactions. I wish to run MCMC analyses ...
4
votes
0answers
3k views

Effects Coding in R

I am in interested in how do effect coding in R. I know that someone else has asked this question (i.e How to do regression with effect coding instead of dummy coding in R?). Here is the lm() model on ...
3
votes
0answers
866 views

AutoEncoder with one hot encoded vectors as input

I have a simple autoencoder model with one hidden layer and 32 as encoding dimension. The activation function for the encoder is Relu. The activation function for the decoder is the sigmoid function. ...
3
votes
1answer
203 views

Multi Categorical Features vs multiple Features for categories

Say I am discretizing continuous data based on percentiles. (I realize this is generally frowned upon, but I am doing this for the sake of experiment) I am trying different percentiles, eg breaking ...
2
votes
0answers
9 views

estimation inter rater reliability for strings of characters (i.e. URLs)

I have multiple raters extracting URLs from the internet based on search terms. The core issue is that a URL amounts to a string wherein two raters might come to the same URL but one string is a ...
2
votes
1answer
696 views

Creating dummy variables before or after splitting to train/test datasets

I have a data set with a few columns of categorical type. As part of modelling process, I need to convert them into dummy variables. My confusions is whether to do dummy creation before or after ...
2
votes
0answers
157 views

Unbalanced sample in dummy variable for OLS linear regression

I have a linear model with the following variables: Y = continuous X1 = continuous X2 = continuous X3 = dichotomous (dummy coded) X4 = categorical (3 levels, dummy coded) The X3 variable has ...
2
votes
0answers
406 views

Fitting multilevel categorical variables with neural nets

Most of the neural net algorithms I'm aware of require multilevel, ANOVA-type categorical features to be preprocessed into a set of dummy (0,1) variables. So, if one has a single categorical feature ...
2
votes
0answers
71 views

Is it possible to create collinearity issues when creating dummy variables?

I am relatively new to R and stats and am getting a little confused about multicollinearity. I am planning on carrying out ordinal logistic regression, and the majority of my independent variables are ...
2
votes
0answers
38 views

Performing ordered data encoding gives more accurate results than integer encoding or one-hot encoding

I have been playing around with the titanic data set from Kaggle. The aim of this data set is to predict if a person will survive from the given variables. I tried a few methods of encoding a persons ...
2
votes
1answer
87 views

Avoiding bias while dropping negative values (easy)

Apologies for the trivial question, but I am a relative beginner. I would like to create an index variable which sums up the responses of 7 other categorical variables which have answers ranging from ...
2
votes
0answers
2k views

Control variable in regression

I need to run multiple regression with 2 IVs and 1 DV and include a control variables. The control variable is "Type of House" and has 4 categories: 1=bungalow, 2=apartment, 3=penthouse and 4=...
1
vote
0answers
26 views

Does the isolation forest care about integer-encoded categorical variables?

The isolation forest (initial paper, follow-up paper) as well as the proposed extended isolation forest (paper) seem like very appealing unsupervised anomaly detection techniques. However, the ...
1
vote
1answer
21 views

Dummy code interaction among categorical variables

Do you know if there is a way of dummy coding the interactions among three independent categorical variables using SPSS? (with two levels each)
1
vote
0answers
31 views

Can I include an 'industry dummy' in my Relative Weight analysis? Bootstrapping produces error message!

I am analyzing the impact of 7 different employee satisfaction variables(x1, x2,...,x7) on financial performance in 200 companies over 3 years. Since these 7 predictor variables are highly correlated ...
1
vote
1answer
25 views

Transforming categorical variables

Can someone explain me in which cases is a good idea to convert a categorical variable to numerical in order to used it in our model (either regression or classification). I have seen cases where even ...
1
vote
0answers
29 views

Dummy variable reference category

As part of my thesis, I am exploring the effect of firm owner type on research and development, which is a ratio. I have a dummy variable of company owner type with 10 categories e.g. Bank, ...
1
vote
0answers
38 views

Is there a theoretical basis for using partial least squares with categorical responses

I am using what is called PLS-DA in JMP to find a model for predicting a categorical (Positive/Negative) response. The documentation says that the responses are simply coded as 0/1, thereby ...
1
vote
1answer
50 views

Linear Regression and High Dimensional Categorical Data

I've read that mean encoding is useful for classification tasks with high dimensional categorical data. My question: What kinds of encodings are effective for high dimensional categorical data in ...
1
vote
0answers
82 views

Dummy variables in Johansen cointegration analysis

I am doing cointegration analysis (all my macroeconomic series are I(1)). In addition, I want to include in all my cointegration analysis a dummy variable indicating the years where there were ...
1
vote
0answers
7 views

Can and should you avoid implicit pretesting for differences in group means?

Suppose I have a population with four (or more) disjoint sub-populations which differ from one another by traitishness, the union of which is the whole population. I have an outcome measure on the ...
1
vote
0answers
107 views

Dropping some levels of dummy-coded categorical variable in a linear regression due to too few observations

I want to run a linear regression in SPSS N = 1400 Outcome variable = rating from 0 to 800 (participants saw or heard a Mandarin speaker and had to rate how pleasant the speaker was feeling) ...
1
vote
0answers
18 views

Dummy Variable for different Person

I am a trying to analyse the relationship between the readability of financial reports (FOG Index) and the profitability. As independent variables I included next to the profitability also the ...
1
vote
0answers
147 views

Using granger causality test with dummy variable

I have a question whether Granger causality test can be performed if one of the variables is a dummy. I have two variables one continuous variable and then a dummy for an event that is 1 during the ...
1
vote
0answers
121 views

Custom contrasts in lmer - reference group?

I am a student working on data and am very confused about custom contrasts in a linear mixed model. I have tried it two ways. Method 1 (inverse contrast matrices): ...
1
vote
0answers
343 views

Random effects with dummy variables

In specification of a Linear Mixed Model (LMM) I encountered an issue with specifying the model, specifically the random effects. I fear I don't know whether the issue is about model specification in ...
1
vote
0answers
50 views

Avoiding multicollinearity with dummy encoding of ordinal variable

I was having trouble finding this exact circumstance; hopefully I haven't missed an obvious previous answer. I have a target variable, Y (discrete counts), and two ...
1
vote
0answers
72 views

Relative importance of dummy variables

I would like to identify the relative importance of each predictor variable in a regression model. It's simple enough to do if using just numeric independent variables. The "% influence / relative ...
1
vote
0answers
42 views

multiple linear regression, confounding, group level predictors

I'm investigating the influence of several independent variables (IVs) (measured on the party,district level and individual level) on individual level campaign behaviour of ordinary candidates (index ...
1
vote
0answers
25 views

Variable selection with tree-structured covariates?

Let's say I want to do regression and that there's a categorical variable which has an inherent tree structure. Using an example from my field of linguistics, let's say I'm trying to predict a binary ...
1
vote
0answers
34 views

Continuous or categorical data. Modeling depth, that is continuous through a range of values, but has a max depth that is discrete

I'm modeling depth to bedrock. These data are continuous through a range of depths, but have a max value that equates to as far as we could dig with our soil auger. So they are continuous through a ...
1
vote
0answers
177 views

Machine learning on JSON/XML/DOM data

What's the best approach for machine learning on deeply hierarchical JSON/XML/DOM documents (not counting text nodes)? Say I want to recognize and generate documents similar to a training set of ...
1
vote
1answer
78 views

Multiple categorical IVs in meta-regression

I'm running a meta-regression and am inputting at different study characteristics as IV's. The problem is some are continuous and some are categorical. The IV's are: Age Gender (2 values, dummy coded) ...
1
vote
0answers
31 views

What is the best way to categorize/code political affiliation? Can I make it an ordinal variable?

I have coded 'Political Leftness' as the variable and coded: 0=Right 1=Center 2=Left But I am not sure that this works or if there is a glaring error in coding it as ordinal data. Is there a ...
1
vote
0answers
32 views

interpretation of coefficient in pre/post study

Let's say the government wants to implement a policy that will reduce the difference between what a person pays for a house and the original ask price. If a house sells for 100k and the original ask ...
1
vote
0answers
768 views

The dummy variable trap

I find a lot of resources online which explains the dummy variable trap and that you should remove 1 category of your dummy variable before fitting it into a multilinear model to avoid ...
1
vote
0answers
330 views

Principal Component Analysis and Time Series

I'm a PhD student with a very superficial knowledge of statistics and econometrics. I am trying to build an index representing the intensity of rental regulation in my country from 1915 to the present....
1
vote
0answers
387 views

Odds ratio from logistic regression SPSS output different from what I calculate by hand + why should type of coding matter for odds ratio?

I'm having a couple logistic regression-related questions that I can't for the life of me figure out the answer to on my own. Disclaimer that I'm not super stats saavy, so thanks in advance for ...
1
vote
0answers
17 views

Checking for regional effects in survey that is stratified according to region

I have access to two surveys of the population in a specific country - one where the country is divided into 10 regions that are used as sampling strata, and another one where the country is divided ...
1
vote
0answers
25 views

Coding scheme for redundant levels in a linear model

I want to get the main effects of IV1, IV2 and IV3 as well as the interaction effect of IV2*IV3 on the outcome for the following three independent variables in a repeated measures anlysis: IV1 ...
1
vote
1answer
72 views

Include dummy variables in rmultiple regression equation?

I have runa multiple regression analysis and have three explanatory variables (two quantitative and one categorical). The categorical variable has 4 levels and therefore i have 3 dummy variables in ...
1
vote
0answers
57 views

Is is problematic to set same baseline for several dummy variables?

I'm trying to do research on the effect of job type, working day and job position on ...
1
vote
0answers
20 views

Regression Modeling with Secondary Categorical Values and Missingness

I am having a hard time making a decision with how to handle missing data under a specific set of circumstances and what it means to the model. Consider that I have the following fictitious dataset. ...
1
vote
0answers
40 views

Question regarding regression with binary/dummy variable

I am currently writing a thesis where I want to do a regression. Now I run into a problem and somehow I dont find any answer to it. Basicly explained, I have a list of firms and I identified ...
1
vote
0answers
17 views

Variance of regression coefficients with indicator variables

I'm not an expert in Mathese, so hopefully this makes some sense.... I have a least squares problem with a lot of predictors, many of which are indicator variables (0 or 1). I use a sparse matrix ...
1
vote
0answers
376 views

Find most similar sentence from one list of sentences to another

I have two lists of short sentences (List A and List B). For each short sentence in List A, I am trying to find the most similar short sentence in List B. Each list has a different count of elements ...
1
vote
0answers
194 views

Dummy variables in hedonic regression

I've been looking into this for quite some time, but unfortunately couldn't figure it out myself. I have some data on real estate transactions, both houses and apartments, and want to do a regression ...
1
vote
0answers
272 views

feature embedding for categorical features

I'm training a model and among the features, I have the language of the users. Right now I have done one-hot encoding on the language feature. But I think it would make more sense to have the language ...
1
vote
0answers
42 views

Coding categorical features for decision trees

Besides ease of implementation, due to the certainty of having binary splits, what are the advantages of coding categorical features into dummy variables in the context of decision trees? Does using ...