Skip to main content

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
0 answers
23 views

Normalizing the embedding space of an encoder language model with respect to categorical data

Suppose we have a tree/hierarchy of categories (e.g. categories of products in an e-commerce website), each node being assigned a title. Assume that the title of each node is semantically accurate, ...
mtcicero's user avatar
  • 123
0 votes
0 answers
31 views

Multiple Dependent Variables, One Independent - with dummy variables

I am trying to run regression models and don't know what type of regression to be running. I have one independent variable (binary variable) and 8 dependent variables (3 discrete, 3 categorical, 2 ...
Margot's user avatar
  • 1
0 votes
0 answers
23 views

Is the intercept of a complex sum-coded regression basically useless for interpretation? Maybe even for some simple models?

In regression analysis, one may choose to code categorical variables differently depending on interpretability considerations. One such coding scheme known as sum coding (a kind of effect coding ...
nsa's user avatar
  • 272
0 votes
0 answers
21 views

Understanding softmax as an activation function, and sparsity in data and gradients

I’m working on a project that includes a probabilistic model that uses one hots, and also occasionally partially freezes weights or zeros gradients to specific regions of the weights. In some parts of ...
Danny's user avatar
  • 1
3 votes
1 answer
77 views

What is the connection between lift and logistic regression?

I have noticed that there is an interesting connection between two (apparently different) measures. I am under a market basket analysis framework (aka frequent itemset mining, both are common names) , ...
Oscar Flores's user avatar
0 votes
0 answers
19 views

Firm Fixed Effects Model dropping Sector Dummies? Potential Solution?

For my thesis, I am using panel data with stock returns and other firm data. I first used an event study to calculate abnormal returns (with event window of 7 days so 7 observations for 500 firms) ...
mek1401's user avatar
0 votes
1 answer
48 views

Indicator variables/treatment variables as an independent variable?

Can a dummy variable or treatment variable be an independent variable? My independent variable take the value 1 if a flood occurs in a specific country in a specific year and 0 if no flood happens. ...
zeinab hassano's user avatar
0 votes
0 answers
12 views

Regression model on edge list

I would like to fit a regression in which my data is links (edges) from the network and the output is weight of each link. Income level is a node attribute and for each link two nodes are involved, so ...
Jina's user avatar
  • 1
0 votes
0 answers
26 views

Why does removing the offset change the F-statistic of an anova model in R?

When a linear model with only a single categorical variables is defined without an offset, the F-statistic reported by summary() and ...
meta7's user avatar
  • 1
1 vote
1 answer
89 views

Small sample in categorical explanatory variable vs overall sample size

In a statistical model e.g. regression, we have to ensure the sample size is sufficient to estimate a given number of parameters. Rules of thumb e.g. n=10 per parameter, or a power analysis, will ...
user167591's user avatar
4 votes
2 answers
217 views

Interpretation of dummy-coded variable

I have a dummy variable, with 1 meaning the years in which an historical event took place and 0 meaning the years in which it didn't take place. I used 0 as the reference category. When the regression ...
brian's user avatar
  • 75
1 vote
1 answer
66 views

Regression with single-observation dummies: F-test under heteroskedasticity

I have a linear regression model with an intercept and a few dummy variables. Each of the dummies indicate a single observation, so the fit is perfect for these observations. Having fit the model, the ...
Richard Hardy's user avatar
3 votes
1 answer
117 views

Warning when using sparse categorical values with LightGBM

When training a LightGBM model with lgbm.train, I get the following warning: [LightGBM] [Warning] Met categorical feature which contains sparse values. Consider ...
DustByte's user avatar
  • 131
0 votes
0 answers
13 views

What is the standard performance metric for categorical data clustering?

I performed a categorical clustering with some selected UCI datasets. I one-hot encoded the features, then directly used Binomial Mixture Model and KModes using this one-hot encoded data. On the ...
NOT-A-CS-GUY's user avatar
3 votes
1 answer
40 views

Logistic regression in R: Handling mixed numerical and categorical variables

I'm attempting to fit a logistic regression model in R and need some guidance on handling both numerical and categorical variables simultaneously, especially when looking for significant explanatory ...
kabin's user avatar
  • 131
0 votes
0 answers
22 views

Should I include a dummy variable for groups with few observations?

I am doing some analysis of US Senate races and in my regression I'm wondering if I should include a (party X state) indicator variable that essentially measures the average vote for the two major ...
Luke's user avatar
  • 1
0 votes
1 answer
47 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
  • 357
0 votes
0 answers
29 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
26 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
70 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
359 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
  • 127
4 votes
2 answers
355 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
7 votes
1 answer
83 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
  • 367
0 votes
0 answers
45 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
  • 151
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
90 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
  • 512
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
26 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
55 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
23 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
45 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
  • 277
2 votes
2 answers
76 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
90 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
  • 277
0 votes
0 answers
13 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
2 votes
1 answer
56 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
  • 163
0 votes
0 answers
17 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
268 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
  • 243
3 votes
1 answer
180 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
52 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
  • 377
0 votes
0 answers
103 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
19 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
45 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
108 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
320 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
36 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
138 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
34 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
20 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
21 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
  • 283

1
2 3 4 5
17