All Questions
Tagged with categorical-encoding regression
311 questions
2
votes
0
answers
45
views
Dropped variable in regression output in R
I am running a linear regression trying to predict an outcome y that is a numeric, continuous variable based on a variable with three levels (A,B,C) and three more variables that represent the ...
4
votes
1
answer
86
views
Creating a dummy variable when the continuous variable is equal to 0
I'm actually trying to find the best explanatory variables in order to estimate the probability of deafult of the counterparties of my portfolio. After defined the Long List of variables, I'm testing ...
5
votes
2
answers
109
views
How to calculate the reference level interaction in regression in R?
I am very confused on calculating the reference level interaction in regression in R.
Here is the sample code:
...
0
votes
1
answer
35
views
Problems with Dummy Categorical Variable Coding in Logistic Regression [duplicate]
I am using SPSS 26. Whenever I conduct a binary logistic regression, the first group of the categorical independent variable does not get dummy coded, and thus, does not get included in the model. In ...
2
votes
2
answers
94
views
Recreate `lm` Categorical Regression
Consider the code, which contains regression using lm of two categorical and one continuous variables without interaction using data from the correct model:
...
1
vote
1
answer
192
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 ...
4
votes
2
answers
280
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 ...
2
votes
1
answer
85
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 ...
3
votes
1
answer
45
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 ...
0
votes
0
answers
28
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 ...
0
votes
3
answers
1k
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 ...
4
votes
2
answers
398
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 =
\...
6
votes
1
answer
91
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
$$
...
0
votes
0
answers
74
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 (...
4
votes
2
answers
125
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:
...
1
vote
0
answers
40
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 ...
1
vote
2
answers
62
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 ...
1
vote
1
answer
92
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 ...
2
votes
1
answer
58
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 ...
4
votes
1
answer
278
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 ...
0
votes
1
answer
57
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
...
2
votes
1
answer
49
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$
...
3
votes
1
answer
137
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 ...
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 ...
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
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'...
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:
...
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
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 ...
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 ...
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 ...
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 ...
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
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
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 ...
1
vote
1
answer
241
views
Understanding the process of tweaking contrasts in linear model fitting to show all levels
The accepted answer to this question on SO accomplishes exactly what I need: Comparing all factor levels to the grand mean: can I tweak contrasts in linear model fitting to show all levels?
However, I ...
0
votes
1
answer
28
views
Statistical test / model to assess what category (IV) leads to highest mean (DV)
What statistical tests and e.g. regression models or similar can be done in R to asses which category (=predictor/IV, variable is called strategy 5-level factor ,e.g., "extreme", "...
2
votes
0
answers
52
views
How to combine 2 ordinal variables?
I have an assignment that gives two ordinal variables: Education (1-poor, 2-medium, 3-high), Wealth (1-poor, 2-medium, 3-rich). The chi-square test rejects the independence of these 2 variables, so my ...
0
votes
0
answers
55
views
Does the high frequency of a dummy variable make it seem it is significant?
Looking at IMDb scores (dependent) and movie genres (independent), and coding genres to binary dummy variables (action yes=1, no action=0, drama yes=1, no drama=0, etc.). Dramas are highly popular ...
0
votes
1
answer
307
views
How to write a regression formula with dummy variables
my regression is relatively simple. I have a dependent variable, age (A), and its values for 8 types of employees (T) for 6 years (Y). I run it in R and get some meaningful results, which show how A ...
0
votes
1
answer
32
views
Finding model for categorical Data
I'm trying to find out a model that adequately describes effects of gender and length on food choice. For gender; 0=Male and 1=Female, length; 0=Subadult 1=Adult, Choice; F=Fish I=Invertebrates and O=...
1
vote
1
answer
301
views
What are the problems if you estimate a linear regression model using OLS, when the dependent is a dummy ? What Models are used to overcome it
What are the problems if you estimate a linear regression model using OLS, when the dependent is a dummy ? What Models are used to overcome it
0
votes
0
answers
23
views
Showing names of levels in glmer R [duplicate]
I have a simple question that would help me a lot in interpreting my results
I ran a glmer model in R with the following variables:
a binary DV that is dummy coded
a categorical IV1 named "...
0
votes
0
answers
106
views
Dummy Variables vs Categorical Variables
I'm trying to analyze political effects in US Presidential elections.
Red States= Republican wins by >=5%
Blue States = Democrat wins by >=5%
Battleground States = In-Between
Hypotheses:
H1 Null ...
16
votes
4
answers
3k
views
Why do we need so many dummy variables in a regression with categorical predictor? Why not use binary encoding instead of one-hot encoding?
If we have $k$ categories of a categorical variable, why do we need $k-1$ dummy variables?
For example, if there are 8 categories, why don't we code them as
...