Linked Questions
31 questions linked to/from What is a contrast matrix?
0
votes
1
answer
986
views
Coding three level categorical predictors [duplicate]
I am trying to do a regression analysis in which one of the predictors is a categorical variable that has three categories, say, A, B and C. These categories CANNOT be put in a specific order as e.g. ...
28
votes
2
answers
20k
views
Polynomial contrasts for regression
I cannot understand the usage of polynomial contrasts in regression fitting. In particular, I am referring to an encoding used by R in order to express an interval ...
15
votes
3
answers
12k
views
What algorithms require one-hot encoding?
I'm never sure when to use one-hot encoding for non-ordered categorical variables and when not to. I use it whenever the algorithm uses a distance metric to compute similarity. Can anyone give a ...
8
votes
2
answers
7k
views
How to calculate Helmert Coding
I am trying to understand how Helmert Coding works
I know it compares levels of a variable with the mean of the subsequent levels of the variable, but what are these levels and how can I calculate ...
13
votes
1
answer
3k
views
Computation of polynomial contrast variables
Please give me idea how to efficiently recode a categorical variable (factor) into the set of orthogonal polynomial contrast variables.
For many types of contrast variables (e.g. deviation, simple, ...
7
votes
2
answers
5k
views
Categorical variable coding to compare all levels to all levels
I am trying to determine the best coding system for my categorical variables to use in a regression with categorical and continuous variables. I have been using this page as a resource but none of the ...
3
votes
3
answers
1k
views
Inverse matrix for contrast coding
I'm trying to understand how "user defined contrast coding" works. My question refers to the example from http://www.ats.ucla.edu/stat/r/library/contrast_coding.htm#User:
...
2
votes
1
answer
2k
views
How to convert binary category feature to numeric feature, like 'Gender'?
In a machine learning or data mining problem, suppose I have a original feature named "Gender", and now I want to convert this feature to numeric feature, there are two ways to do that, but I realy do ...
7
votes
1
answer
194
views
Which categorical variable encoding should I use if I want the model intercept to have the interpretation of the global mean?
In a mixed effects model
$$ y_{ij} = \beta_{00} + \beta_{01} x_{1i} + \beta_{02} x_{2i} + \beta_{03} x_{3i} + u_i + \epsilon_{ij}$$
where $x_1, x_2, x_3$ are dummy variables coding the levels of a ...
2
votes
0
answers
2k
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
0
answers
2k
views
When do I have to use orthogonal contrasts instead of non-orthogonal ones?
This is the same question as asked here, but of course I think with a different twist.
A definition of orthogonal contrasts is given in another (great) answer to a popular question on Cross Validated ...
1
vote
1
answer
1k
views
How do you interpret SPSS output for reference groups with multiple levels?
I am using binary logistic regression. My dependent variable is referred or not referred. I have set a reference category for location of subjects. I have chosen to use the largest site with the ...
2
votes
2
answers
530
views
difference between dummy variable categories that weren't omitted
Assume we have a categorical variable (one-hot encoded) with three or more categories. {race1, race2, ..., race-n}
To avoid the dummy variable trap, assume we ...
1
vote
1
answer
1k
views
Dummy coding versus contrasts: which compares treatment with control?
I have a data set where I want to compare different treatments with a certain baseline. So I basically have a linear model (ANOVA) like this:
outcome = b_0 + sum_i(b_i * x_i)
with b_i the fitted ...