Dummy or indicator variables are used to include categorical or qualitative variables in a regression model.
Questions tagged [dummy-variable]
868 questions
0
votes
1 answer
Creating Dummy Vatiables in R analytics
i have a dataset for predicting the values that store will open in a certain area or not. I am confused to create dummy variables and want to know how to create dummies for variables Id,sales0,sales1,sales2,sales3,sales4,country,cosub,and many...if…
0
votes
3 answers
Creating dummy variables in SAS from a categorical variable
I am looking to create dummy variable for a categorical variable in SAS. The categorical variable includes information on sites and takes on values such as Manila, Rabat etc., all in all there are about 50 different sites. What would be the most…

bree
- 25
- 1
- 7
0
votes
1 answer
dummification throws an error.'x' must be atomic for 'sort.list'
My str(df) looks like below :
> str(categoricalVar)
'data.frame': 56660 obs. of 10 variables:
$ FavouriteSource : Factor w/ 3 levels "App","LF","None": 1 1 3 3 3 1 3 3 3 3 ...
$ FavouriteSource30 : Factor w/ 3 levels "App","LF","None": 1 1…
user8819809
0
votes
1 answer
Pandas: Matching values to get a complete route
I am trying to match values within the current dataframe to another dataframe to help determine if the value is part of the route. For Example:
DF1
Route Latitude Longitude
0 0C,5 1.23 1.23
1 2A,5,1 2.23 2.23
2 5,0C …

WhiteSolstice
- 641
- 2
- 7
- 20
0
votes
0 answers
Categorical variable in classification model
In a classification model, if I want to keep a categorical variable (e.g Gender), I need to create a dummy variable first.
My question is, this new dummy variable (e.g 1=male, 2=female) should be created as numeric vector? I tried to keep that dummy…

Ehtasham Billah Mymun
- 101
- 7
0
votes
1 answer
How to create new variables with information from 2 categorical and 1 numeric variable
I have a data set looking like this:
ID Meal Food Amount
1 Lunch Meat 50
1 Lunch Potato 10
1 Dinner Fish 105
1 Dinner Rice 100
1 Dinner Pulses 50
2 BF Cereal 100
2 BF Milk 200
2 Lunch Rice …
0
votes
0 answers
Formula regression discontinuity
I am looking for the formula of a regression discontinuity, where the independent variable is the dummy (0, 1) and the dependent variable is continuous. Furthermore, I would like to add several confounders to this formula.
Many books point me to…
user9235457
0
votes
1 answer
SPSS: Make dummy variable for ranges of date of birth
I have a dataset that includes per respondent three variables with his full date of birth (day, month, year). I want to create a dummy variable based on a range of date of birth. For example, those born between December 1, 1948 and August 31, 1949…
user9185732
0
votes
3 answers
I am having to create dummy variables in this very specific way. Can someone help me package this code into a function?
respect$BB6_cat5_0 <- ifelse(respect$BB6_cat5 == 1, 1, 0)
respect$BB6_cat5_1 <- ifelse(respect$BB6_cat5 == 2, 1, 0)
respect$BB6_cat5_2 <- ifelse(respect$BB6_cat5 == 3, 1, 0)
respect$BB6_cat5_3 <- ifelse(respect$BB6_cat5 == 4, 1,…

Rob Tala
- 13
- 3
0
votes
2 answers
Detect first occurrences between two variables in R
I would like to count the first occurrences of two variables (IPC and 2IPC) in R, leaving out cases in which the two variables are the same (e.g. !IPC == 2IPC).
Here is an example of dataset:
**date IPC 2IPC occurrence**
1968 G01S …

Amleto
- 584
- 1
- 7
- 25
0
votes
3 answers
create dummy indicator for each variable in a data frame with specific values
I have 115 variables in my data frame, and I need to create a dummy variable for each variable that has negative value or values of 999. The dummy indicator will take a value of 1 if the original x value is <0 or 999 and 0 otherwise. For example for…

sahboor
- 73
- 1
- 12
0
votes
1 answer
Create dataframe of fixed size with dummy variables for numerical values
I must create the dummy variables for the column that could have 16 values (0-15), but not necessary has all 16 values when I create dummy variables based on it:
my_column
0 3
1 4
2 7
3 1
4 9
I expect my dummy variables have 16 columns, or…

Andrew_457
- 87
- 8
0
votes
1 answer
After generating dummy variables?
I am trying to change the category variables into dummy variables. "season","holiday","workingday","weather","temp","atemp","humidity","windspeed", "registered","count","hour","dow" are all variables.
Here is my code:
#dummy
library(dummies)
#set…

grace
- 61
- 1
- 1
- 5
0
votes
2 answers
Creating a dummy with different arguments in R
I'm working on a big data set of corporate account data in order to solve a classification problem if a firm goes bankrupt or not.
The dataset contains a variable liquid which states the year when the liquidation started. This variable is…

Patrick
- 1
- 1
0
votes
2 answers
Custom Dummy Coding in Pandas
I have a dataframe with event data. I have two columns: Primary and Secondary. The Primary and Secondary columns both contain lists of tags (e.g., ['Fun event', 'Dance party']).
primary secondary …

Daniel
- 363
- 3
- 11