All Questions
Tagged with dummy-variables or categorical-encoding
851 questions
2
votes
1
answer
454
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 ...
1
vote
1
answer
263
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-...
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 ...
0
votes
1
answer
29
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, ...
0
votes
1
answer
58
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 ...
0
votes
1
answer
47
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 ...
1
vote
1
answer
2k
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 ...
1
vote
0
answers
115
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 ...
1
vote
0
answers
285
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 ...
0
votes
0
answers
48
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, ...
0
votes
1
answer
337
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 ...
0
votes
0
answers
40
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 ...
1
vote
1
answer
39
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" ...
2
votes
1
answer
7k
views
How to use categorical features in lightGBM? [closed]
I am working on an attrition dataset which has a large number of categorical parameters. Each categorical parameter has a high cardinality, so one-hot encoding them is out of question. I was looking ...
2
votes
1
answer
500
views
Why doesn't CatBoost Encoding cause target leakage?
I'm currently working on a fraud detection problem with a dataset of 300,000 rows and 500 columns, 70 of which are categorical with over 10 categories each. I'm facing memory constraints and exploring ...
1
vote
1
answer
292
views
Interpretation of coefficient of dummy variable in regression
I have a regression where the dependent variable is the difference in income between towns i and j. The independent variable is a dummy variable which takes value 0 if both towns have the same ruling ...
1
vote
1
answer
114
views
Do you lose information when you encode numerical columns with two values?
Sometimes I have numerical columns that are composed of two unique values. For example, a value from the set $\{0.1, 5.4\}$ in every cell, or $\{-1, 0\}$ in every cell. I typically scale these columns ...
1
vote
1
answer
933
views
Dummy variable coefficients are getting automatically omitted by Stata : what to do to keep them? [closed]
I am trying to replicate Section 4.1. of a paper "On the Heterogeneous Effects of Sanctions on Trade and Welfare: Evidence from the Sanctions on Iran and a New Database" by Felbermayr et al. ...
4
votes
3
answers
906
views
Choice of coding scheme/planned contrasts using race as a categorical variable
Generally, my default practice in regression for nominal categorical variables, including race, is to use dummy coding, with the majority/plurality level as reference. Interpretation of the model ...
0
votes
0
answers
214
views
Bias towards categorical data when one-hot encoding and standardizing (for machine learning)
I have a dataset containing a fair amount of continuous and categorical variables. I one-hot encode these variables to be used in various machine learning algorithms.
Let's presume a variable has n ...
0
votes
1
answer
156
views
Why is the last level not reported in R's `summary()`, if its coefficient is not 0? [closed]
In section 4.7.7 of Introduction to Statistical Learning (version 2), the authors code regression contrasts where the last level of a predictor sums to the remaining levels.
My question is, why doesn'...
0
votes
0
answers
52
views
Can you use a Z-Test with a sample size of 1?
Background
I'm performing a feature selection process on a fraud dataset.
The dataset is made up of roughly 300 columns and 40,000 rows. It has a single binary indicator for a target.
A lot of the ...
0
votes
1
answer
42
views
Dummy coding of linear regression, intercept and constraint
Let the following multilevel problem, where we try to predict the credit card balance of individuals $y_i$:
$$
x_{i 1}= \begin{cases}1 & \text { if } i \text { th person is from the South } \\ 0 &...
2
votes
1
answer
39
views
Regression predictor from count of categorical variables?
Let's say I have the following strings and associated target variables:
...
1
vote
1
answer
171
views
Dummy interaction term in an ARIMA model
How to include a dummy interaction term in an ARIMA model? Can we use the dependent variable (in this case, say the log return of an asset price at time $t$) to multiply with the dummy variable as an ...
0
votes
1
answer
45
views
add the sign of the independent variable in a linear regression
I would like to include the sign of X in a linear regression to highlight the impact it has on Y (see the scatter plot below). I first thought of a dummy, taking the value of 1 if positive and 0 if ...
0
votes
1
answer
120
views
Interpreting regression coefficients with partial dummy vs. effects coding and multiple factors
I have been working with a data file in R that contains two primary categorical variables : study location (study, 19 levels) which is a nuisance variable and race (4 levels) which is the outcome of ...
1
vote
1
answer
60
views
Dummy / Reference variable in LASSO (group lasso)
I am performing group lasso and need to double check if I include a dummy variable for the reference answer or not. For example:
original question : no (0), Yes (1), Unknown (9).
If I create 3 dummy ...
0
votes
0
answers
34
views
Dataset has no candidates for prophet add_regressor
I'm a student working with https://www.kaggle.com/aksha17/superstore-sales, primarily as an exercise in resampling and using prophet and it was suggested to me to create dummy variables and use the ...
1
vote
1
answer
2k
views
ARIMA or SARIMA scale and normalize data
Good evening everyone,
I am here to ask a question regarding the statistical models ARIMA & SARIMA use to build predictive models based on past values and with the intent of predicting future ...
0
votes
1
answer
384
views
Order of pre-processing the dataset
suppose I have categorical dataset, I'm doing data pre-processing.
what is the correct order of applying these 3 techniques
Train Test split
SMOTEN to over sampler the minority class
Categorical ...
1
vote
0
answers
82
views
Difference between using a categorical variable vs separate dummy variables
I have 2 drug treatment groups, namely Cis and RT. So, a cell is either exposed to none, Cis only, RT only, or a combination of Cis+RT. There is also another cancer modality group.
I would like to ...
1
vote
0
answers
409
views
Numeric categorical variables as factors or one hot encoded before using random forest?
I am performing a random forest model in R using caret = rf method. I have 20 explanatory variables and most are continuous but a few are categorical and numeric. For example, there are 6 categories ...
4
votes
3
answers
174
views
What would be the effect of modeling a binary predictor in an OLS model as [-1, 1] instead of [0, 1]?
I am using an OLS model to predict a continuous variable using several continuous predictors and one binary categorical predictor. I know that usually binary variables are modeled as [0, 1], but I am ...
0
votes
1
answer
69
views
OLS model specification that includes all dummy variables with a predetermined coefficient
I'm working with a OLS model that includes dummy variables (quarters of year). Here's what I would specify it:
$$y = \beta X + \gamma_1Q_1 + \gamma_2Q_2 + \gamma_3Q_3 + \epsilon$$
However, in the ...
2
votes
0
answers
35
views
Should I exclude dummy variable created from independent variable in multivariate regression model?
I have the following model:
$ \ln(wage) = \beta_0 + \beta_1educ + \beta_2educ*college $
the variable $college$ is from the condition that if $educ \geq 16$.
Should I include the variable $college$ in ...
3
votes
2
answers
131
views
How to interpret dummy variables and interactions terms on dummy variables in a regression?
Suppose I have a linear regression form of
$$
\log(Y) = \beta_0 + \beta_1X_2 + \beta_2X_3 + \beta_3X_1Z + \beta_4X_2Z + \epsilon
$$
where $X_1, X_2, X_3$ are binary and $X_1$ is omitted as a reference ...
0
votes
0
answers
57
views
How to test H0 that two coefficients associated with dummy variables of same categorical variable are equal?
I have a variable $X$ which I predict with a nominal categorical variable $Y$ with category labels $\{0,1,\dots,m \}$ using a linear model. I use standard dummy coding which gives me the regression ...
6
votes
2
answers
164
views
Analyse categorial data where best outcome is middle level
I have a dataset where the outcome variable is the result of a blood test that ranges from 10 to 40.
A person is healthy if the result is between 20 and 30. Under 20 and over 30 are equally bad ...
1
vote
0
answers
137
views
Finding a latent representation of a high-cardinality one-hot encoded variable [duplicate]
I am working on a clustering project on a dataset that has some numerical variables, and one categorical variable with very high cardinality (~200 values). I was thinking if it is possible to create ...
2
votes
1
answer
342
views
Multiple linear regression with one binary variable
Can I add 3 continuous independent variables and one binary categorical variable (without making dummy variables, as a dummy variable is created for more than 3 categories?) For example: one dependent ...
1
vote
0
answers
115
views
Fractional factorial design with mixed categorical and numerical variables analysis for more than two levels
I have an experiment setup that consists of multiple continuous and multiple categorical variables. Right now, I am just using two levels for the categorical variables, allowing me to encode them as -...
2
votes
1
answer
77
views
Interaction with indicator function instead of dummy
I am running a regression of Y on X (both are continuous variables). I'd like to measure how the effect differs between two groups of individuals, coded by a dummy variable Z. The traditional way of ...
3
votes
1
answer
362
views
Categorical variable disappears in Poisson GLM summary?
For the variable SelfEthnicity there is meant to be 4 levels.
I have made it so there should not be a reference category, but the R output still only shows 3 Ethnicities.
...
1
vote
1
answer
60
views
Small number of positives in a large dataset
I have a panel dataset with a very large number of observations 300,000. I am testing to see if a dummy variable is positive and significant using regular OLS. I have only about 1500 obs where the ...
0
votes
1
answer
124
views
Linear regression with ARIMA errors and seasonal dummy covariates: how does differencing works?
To model my daily time-series data, I want to use linear regression with ARIMA errors. I also want to introduce several seasonal dummy covariates (day of the week, month of the year). I read in ...
1
vote
1
answer
150
views
Can you combine a categorical variable with a numeric variable?
I have multivariate(?) time series data where I am trying to model coral populations over time. Measurements were taken at discrete timepoints for specific individuals within a population, and I am ...
0
votes
0
answers
107
views
GLM specifying a subset of contrast matrix for factor variable
I'm fitting a binomial GLM with the following formula:
glm(outcome ~ categorical:continuous:factor)
I would like to see the interaction of categorical and ...
1
vote
1
answer
249
views
How to encode categorical variable with multiple categories per datapoint?
Consider this question on a survey:
What desserts have you eaten?
Apple pie
Banana pudding
Coconut cake
Doughnut holes
The user can pick as many of the options as they like. How would one encode ...
0
votes
1
answer
100
views
Linear regression with binary variable
Good day,
I hope you could help me.
My problem: I'm doing a linear regression with SPSS. Among other things, I am interested in gender differences. Since a distinction is only made between men and ...