Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

4
votes
0answers
141 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
2k 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
704 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
0answers
80 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 ...
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
0answers
114 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
373 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
60 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
36 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
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
18 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
27 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
0answers
66 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
73 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
17 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
113 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
61 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
220 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
40 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
58 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
39 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
24 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
33 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
166 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
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
30 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
674 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
316 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
371 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
0answers
83 views

When building a model with all categorical features, when do we use dummy variables and when do we use label encoding?

I am working with a dataset that is essentially all categorical data. I have 20-30 distinct columns of categorical data, with some columns having as many as 1000 different categorical values. If I use ...
1
vote
0answers
51 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
39 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
340 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
167 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
37 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 ...
1
vote
0answers
156 views

How to interpret impute indicators in a regression model?

Suppose I have imputed a variable in my data and that I’ve created an ‘imputed’ indicator/dummy variable, where 1 denotes that the value has been imputed and 0 if the value was ...
1
vote
0answers
1k views

Using deviation coding (effect coding) of factors in glmnet LASSO in R

Various sources have instructed me how to use deviation coding (aka effects coding) in R (see here, here, and here). My question though, is how to go about doing this for LASSO regression using ...
1
vote
0answers
26 views

Comparing results from reference coding and orthogonal coding in a linear model?

The problem: I'm trying to fit a zero-inflated negative binomial model to count data (catches of larval fish). I have three factors, and an offset variable, which is the volume of water filtered by ...
1
vote
0answers
63 views

PCA, reverse coding, TIPI questionnaire used as predictor, ANOVA vs Multiple Regression

I am in the process of analyzing a questionnaire measuring attitudes: recording as predictors 1) gender, 2) religion, AND 3) the 10-item personality inventory (TIPI, 2003); dependent variables ...
1
vote
0answers
22 views

Proper Method to Add weights to variables

Given a dataset with different fields of criteria, all coded as 1 or 0, and also with a target which can take a value of 1 or 0, how can I create weights into the fields. In a banking example, let say ...
1
vote
0answers
53 views

Dummy coding: code two values $a$ & $b$ instead of $0$ & $1$?

I know there are a lot of questions and answers related to dummy coding. But I still wonder if it matters to code a dichotomous variable d in this regression model $$y = \beta_1 + \beta_2 \cdot d + \...
1
vote
0answers
136 views

R Auto.arima Function - Question About Xreg Covariates

I am using the auto.arima function in R. I'm using this to forecast daily sales and am loading a number of covariates (mostly holiday/seasonal dummy variables) with Xreg. Question (I apologize if ...
1
vote
0answers
129 views

Hierarchical Bayesian Regression with an Indicator Variable, one group has all zeros for the IV Variable

I'm attempting to form a Bayesian Hierarchical Regression Model and one of my regressors is for an indicator variable. My hierarchy structure has separate group-level regressors related across-groups ...
1
vote
0answers
108 views

use of dummy variables in regression equation

I have data where the regressor of interest is 7-point Likert scale responses to a questionnaire regarding experiences. These people are answering questions regarding a group with which they have ...
1
vote
0answers
69 views

Using indicator variables to account for outlier values

I am using a fixed effects regression model to examine the relationship between diesel consumption in the US and the rates of motor accident over twenty year period. I have been told that I need to ...