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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
30 views

logistic regression with dummy regressors

I'm considering a logistic regression of $Y$ on $X_1,...,X_K$ where $X_1,...,X_K$ are all dummy variables. I'm wondering if the MLE of such a logistic regression is statistically valid since non of $X$...
user0131's user avatar
  • 355
0 votes
0 answers
15 views

Opinion about conversion of factor to numeric variable during model development using caret package

caret package automatically converts factor variables to one-hot encoding. We can also convert the factor variable to a numeric variable before training any model. ...
UseR10085's user avatar
  • 107
1 vote
0 answers
19 views

Calculating Expectation using the Linearity of Expectation law and sum of indicator random variables

I'm attempting to complete the problem sets for the Stanford CS109 Statistics course from 2021 as I follow along with the lectures. I'm stuck on a particular problem in one of these problem sets. I ...
fragorl's user avatar
  • 111
2 votes
2 answers
27 views

Partial Correlation and 1 Categorical Control Variable with 3 Categories

I'm trying to calculate the partial correlation between continuous variables $X$ and $Y$ while controlling for $Z$ (a categorical variable with three possible categories). Tutorials and answered ...
Yousif's user avatar
  • 21
0 votes
3 answers
59 views

How to choose reference category of predictors in logistic regression? [duplicate]

I am struggling to decide which reference category I should define in my logistic regression model. When I define "mandatory school" as a reference in the variable education the results seem ...
Gustav's user avatar
  • 107
3 votes
2 answers
320 views

Interpreting when a regression coefficient is significant

Consider the following regression model: $y_i=\beta_1+\beta_2x_{i,2}+\beta_3x_{i,3}+\beta_4x_{i,2}x_{i,3}+\epsilon_i,$ where $\epsilon_i\sim N(0,\sigma^2).$ Here, $x_2$ is binary variable $$X_2 = \...
user232597's user avatar
6 votes
1 answer
72 views

How to identify parameters to test asymmetric effect in a structural model

I am estimating an likelihood function (a structural model). A part of the likelihood function is that $$ p_t=p_{t-1}k_1+x_t(1-k_1) \quad if \ x_t=1 $$ $$ p_t=p_{t-1}k_2+x_t(1-k_2) \quad if \ x_t=0 $$ ...
jasmine's user avatar
  • 357
0 votes
0 answers
30 views

How to get an overall P-value for a categorical variable, If I know the t-values of its dummy variables?

I am doing ANCOVA: main categorical variable for the comparison is "Street" and it contains 3 categories (Street1, Street2 and Street3). The outcome variable is social interaction time (...
Hussain's user avatar
  • 141
0 votes
0 answers
11 views

Question about the effects of cardinality changing on the model's training

I'm analyzing a dataset that contains a feature 'street_name' with 5980 unique values. I used the LeaveOneOutEncoder class for encoding, but I noticed that the cardinality reduced a lot. There are now ...
Antonio Caipora's user avatar
2 votes
2 answers
60 views

Interpreting main effects with dummy coded and continuous predictors in regression

I have a logistic regression predicting probability of a 'yes' response given 'condition' (A,B,C,D; dummy coded, with 'A' as the reference level). This will produce estimates for the following: ...
SilvaC's user avatar
  • 452
1 vote
0 answers
36 views

How do I regress income quartiles against each other?

I'm looking to find out whether an attitude differs across income quartiles. My supervisor has mentioned dummy coding and regressing the quartiles against each other, however, I'm sort of at a loss as ...
Lucy S's user avatar
  • 11
0 votes
0 answers
23 views

How should I deal with an ordered logit model with numerous, mutually exclusive dummy variables?

I an trying to estimate an ordered logit model where the DV is a likert-scale response (1-5) and I have 6 independent dummy variables representing whether an observation belongs to one of six mutually-...
Haris's user avatar
  • 21
0 votes
2 answers
45 views

OLS Residuals sum to zero for each submodel for a model with categorical variable?

I understand that in OLS regression, the sum of the residuals for the entire model must be zero. However, does this property also guarantee that the sum of residuals within each subgroup defined by a ...
Jetty's user avatar
  • 23
1 vote
0 answers
21 views

Scalable unordered category encoders

I am trying to design a neuron network for an scalable target assignment problem and use RL to train it by reward feedback. My major concern is making the neuron network somehow adaptable to different ...
zhixin's user avatar
  • 11
1 vote
2 answers
27 views

Interpretation dummy variables Cox PH model

I'm curious about interpreting the coefficients of dummy variables within a Cox Proportional Hazards (PH) model. Consider a scenario where I have a sample comprising both male and female patients, and ...
John's user avatar
  • 247
2 votes
2 answers
60 views

Number of Phones in a word: Numerical or Categorical Data?

I'm trying to model a subset of the MALD dataset (language related) using Gaussian Distribution. MALD: https://link.springer.com/article/10.3758/s13428-018-1056-1 One of the variables I'm working with ...
karak87rt0's user avatar
1 vote
1 answer
88 views

Interpretation coefficients categorical variables

I am working with a large panel dataset studying many companies over a long period of time. Some of these companies receive a negative outlook from an analyst during the sample period. Similarly, some ...
John's user avatar
  • 247
0 votes
0 answers
12 views

Testing for mederation effect in a paired sample (before and after)

I am trying to test whether Covid-19 impacts the income of companies. For 10 companies, I have the income values for both December 2019 (before COVID) and March 2020 (During COVID). I also have the ...
Md. Maruf Hasan's user avatar
0 votes
0 answers
41 views

Can we have intercept in this model: mutually non-exclusive factors

Imagine we have an experiment, where each subject consumes 2 out of 3 different kinds of chocolate bars (Mars, Snickers, Bounty) and we measure blood sugar subsequently, that is, after 2 of the bars ...
GAMer's user avatar
  • 123
0 votes
0 answers
14 views

Knots in regression and the dummy variable trap

I am running a knot-like type of regression and have a couple of questions: Imagine that we are working with daily data that spans over $3$ years. Consider the following model: $y_t = \beta_{0, t} + ...
richard baws's user avatar
3 votes
1 answer
75 views

Ordinal vs multinominal classification in XGboost: differences in one-hot encoding

I have followed this post and tried to see if there will be any difference in predicted probabilities if I use different one-hot encoding in XGboost. This is my code with some dummy data, which is ...
deblue's user avatar
  • 231
3 votes
1 answer
110 views

Should I remove the intercept when I have one dummy variable that covers all the categories in a categorical variable?

I have a categorical variable that has $4$ categories, and I have two dummy variables, $x_1$ and $x_2$, that cover this categorical variable. The $x_1$ variable has values of only $1$ without any ...
user400487's user avatar
0 votes
1 answer
49 views

Interaction with dummy variable: How to access std. error, t value, p value, (and others) for the opposite manifestation of dummy

Preparation Using R-Libraries: library(dplyr) The situation Data Given the data ...
user1's user avatar
  • 101
0 votes
0 answers
22 views

Level Means Coding (LMC) and additive models

I read very helpful posts about LMC, a coding scheme which I am very new to. Related posts were : (1) How can logistic regression have a factorial predictor and no intercept? (2) Linear model in R ...
HYL's user avatar
  • 355
0 votes
0 answers
50 views

Interpreting coefficients in Linear regression with categorical variables and one hot encoding (drop first)

I am doing multiple linear regression where my independent variables are a mix of categorical and numerical variables. Obviously I need to one-hot-encode the categorical variables, and I need to "...
jgklsdjfgkldsfaSDF's user avatar
1 vote
1 answer
16 views

Can I add more than 2 independent groups to an Ancova and if so, do I need to create dummy variables in SPSS

I want to analyze the difference between 4 groups on one dependent variable while controlling for my covariate, age, and 3 different independent variables (sex, cancer type, metastasis) in SPSS. Can I ...
Rianna's user avatar
  • 11
2 votes
1 answer
43 views

Interaction with dummies - 2 distinct models

What exactly is the difference between those two models: model 1: $Income_i = \beta_0 + \beta_1 \text{female}_i + \beta_2 \text{experience}_i + \beta_3 \text{female}_i \cdot \text{experience}_i + u_i$ ...
Marlon Brando's user avatar
3 votes
1 answer
67 views

Dummy Variable Trap & Interaction Term?

Suppose we create a dummy variable male (1=male, 0=female) and dummy variable female (1=female, 0=male). Does the dummy variable trap, also occur, if we include them into interaction terms: $Y_i = β_0 ...
Marlon Brando's user avatar
2 votes
1 answer
209 views

When I change my reference level on my GLMER in R, why do the p-values change and why don't the estimates add up? Emmeans solution in answer

I am new to this. My study has three conditions (between subjects - low coordination, high coordination, high coordination with ostensive cues) and three repetitions of a game (within subjects - Game ...
Melissa D. Perring's user avatar
0 votes
0 answers
26 views

Interpretation ARIMA dummy variables

I'm doing an ARIMA analisys with monthly dummy variables and other covariables. I'm wondering how to interpret the coefficients of my month dummy variables, as I don't have 12 months and I haven't an ...
Clara Rodríguez's user avatar
1 vote
1 answer
65 views

meaning of drop in OneHotEncoder

I am having a tough time as a newbie understanding the drop argument in OneHotEncoder. Does it drop the column with the non-...
heretoinfinity's user avatar
0 votes
1 answer
27 views

Differences in Regression model for Dummy Coding (factor vs. recode) [closed]

I have the following problem: I generate Dummy Variables with the recode and the factor command. In my regression I got different output for the "lower middle" variable and couldn't explain ...
Marvin11's user avatar
0 votes
0 answers
18 views

discovering latent values, with extremely high cardinality categorical features

I think i know what I need to do here, but I want a gut check, and i might need some direction on specific packages and processing to use. My goal is to discover the latent value of products that ...
jrubins's user avatar
  • 13
0 votes
1 answer
16 views

Best way to "parse" survey data for predictive value?

Straightforward question. Kind of like bucketing too. Say you have a customer survey. The customer rates 1-10, or 1-5. Say you want to use this to predict other behaviors. Reorder rate, refund rate, ...
user45867's user avatar
  • 253
0 votes
0 answers
31 views

Should I use log transformation on Target Encoding values ​to avoid heteroscedasticity?

The dataset I'm working with contains categorical variables with several classes. To do its pre-processing I chose to use Target Encoder. With numerical variables I used MinMaxScaler. When training ...
Damodara's user avatar
0 votes
1 answer
50 views

Predict on continuous variable for Logistic Regression model in which feature was trained as a binary variable?

Let's say I have a binary logistic regression model trained on several binary categorical variables (i.e. the model is only trained on 0s and 1s for these variables). For example, Feature A can only ...
global_stats's user avatar
0 votes
1 answer
23 views

Working with subsets of values from single category in XGBoost

Since version 1.5, XGBoost supports categorical data out of the box, which is a convenient way to skip the one-hot pre-processing step and allow for if X in values ...
Alexandru Dinu's user avatar
0 votes
1 answer
597 views

Interpreting Correlations with Dummy Variables

I am working through a paper about grad student "satisfaction" (as measured by a survey), and descriptive statistics are given in a table that looks like this: The "experience of ...
flevinBombastus's user avatar
1 vote
0 answers
82 views

Treatment of blocking variables in LASSO regression

By reviewing the existing relevant questions I could not find the answer to this specific question. I have created blocking variables with the one-hot method (n - 1 binary variables for n categorical ...
Oculatus's user avatar
1 vote
0 answers
132 views

Interaction between two binary variables in lavaan

I have two binary variables (X1 and X2, coded 0/1) as predictors in a growth model in lavaan. I want to understand their individual contributions and their ...
Jeanne Sinclair's user avatar
0 votes
0 answers
37 views

When to use Label encoding

All the articles I read, it is clear that, Label Encoding should be avoided for the ordinal data. But, in one of my ML tutorial video of Artificial Neural Network, ...
mainak mukherjee's user avatar
0 votes
0 answers
8 views

Linear regression model: adding a boolean dependent on y [duplicate]

Ciao, I have to perform an estimation of price fluctations. There are some outliers in the price, namely above 350€ and above 950€. My first feeling is to add two booleans representing prices between ...
Sandra's user avatar
  • 1
0 votes
0 answers
20 views

Label encoding performing well despite data being non-ordinal

So I'm currently training a model where the dependent variable is continuous and 9/11 of the independent variables are categorical, some of these categorical variables have upwards of 10,000 classes ...
SDU100's user avatar
  • 1
0 votes
1 answer
101 views

Dummy Variable Trap in KMeans Clustering

My data set is having a column Gender, so I have to apply One Hot Encodingto perform KMeans Clustering. Q1. Should I take care about ...
mainak mukherjee's user avatar
0 votes
0 answers
37 views

How to properly add dummy variables as controls when the independent variable is a dummy variable?

I am writing a thesis where I investigate whether ESG/sustainable funds' decision to invest in fossil fuels/weapons affects fund flows. I am regressing a fund flow variable on a dummy variable x which ...
Christian's user avatar
0 votes
0 answers
18 views

How to express this repeated measures model with dummy variables?

I would like to fit a model to predict an outcome at a given time (t=1 in the attached plot) using covariates X. As I have many missings at that time I've thought of also using past information of X. ...
skan's user avatar
  • 1,064
0 votes
0 answers
34 views

Testing sum of dummy variables

Say that you had data for the point spread of a basketball game: Team A points - Team B points (where team A is the home team and team B the away, if there is no home and away team, then team A is ...
user389086's user avatar
0 votes
0 answers
24 views

Dummy variables in Caret for Random Forest and Gradient Boosting

Do caret 'creates' automatically the dummies for Random Forest and Gradient Boosting models, or do I have to do it previously with dummyVars()? When I predict with the model, does caret handle the ...
Kaikus's user avatar
  • 219
0 votes
0 answers
27 views

Coding dichotomous variables in multiple linear regression

Say I want to predict continuous Y with continuous X and dichotomous D1 and D2 with a multiple linear regression model. The hypothesis is that X negatively predicts Y on one level of D1 (the control ...
qxiao's user avatar
  • 1
1 vote
1 answer
38 views

How to detect categorical data masquerading as continuous? [closed]

Are there any known statistical methods or laws that can be applied towards the detection of categorical data masquerading as continuous? Categorical data can masquerade (or be "obfuscated" ...
Ian CT's user avatar
  • 111

1
2 3 4 5
17