Questions tagged [dummy-variable]

Dummy or indicator variables are used to include categorical or qualitative variables in a regression model.

868 questions
0
votes
1 answer

Interpreting Summary Statistics with Categorical Variables

With this output, I know that intercept is when both factors are 0. I understand that factor(V1)1 means V1=1 and factor(V2)1 means V2=1. To get the slope for just V1 being = 1 I would add 5.1122 +(-0.4044). However, I am wondering how to interpret…
Lindsey Register
  • 145
  • 1
  • 2
  • 12
0
votes
2 answers

Dummy DATE field with NULL value

I am performing a union between two tables. In order to make the two tables consistent for a UNION, I need to add a dummy column. One table has DATE field whereas the other table does not have that field. How can I create the dummy DATE field which…
Rikin
  • 283
  • 3
  • 13
  • 29
0
votes
1 answer

Keeping the dummy nodes in linked list

I'd like to add new nodes into the list without removing/substituting the dummy node head, i.e. head is always null and the list would start from head.next (head -> node -> node -> node). I'm having trouble with the syntax of the dummy node and Im…
user4833678
0
votes
1 answer

Factors and Dummy Variables in R

I am new to data analytic and learning R. I have few very basic questions which I am not very clear about. I hope to find some help here. Please bear with me..still learning - I wrote a small function to perform basic exploratory analysis on a data…
Ranjan Pandey
  • 85
  • 2
  • 11
0
votes
1 answer

Can the subset() function within the lm() R function can be used to remove observations only of certain variables?

I am not sure my question makes sense. But, I am considering modifying an econometrics model using time series data. It is a multiple regression. One of the independent variables is the 5 year Treasury rate. This variable is split over two time…
Sympa
  • 125
  • 1
  • 1
  • 16
0
votes
1 answer

Transform many numerical variables to dummy variables at once

I'm stuck trying to convert a bunch of integer variables (with values from one to 10, plus a few NAs) into the same number of boolean variables, where values<=8 become FALSE, >8 become TRUE, and NAs remain as NAs. Based on other Q&As around, I tried…
Ignacio1981
  • 35
  • 1
  • 3
0
votes
1 answer

Nested Loops and If statements

So the code I have below attempts to find WIP in column H. If we find WIP: copy 3 cells and make 10 replicas of them in the next column either in the same row or the next available row. For some reason the code only runs the loop successfully for…
Ori Meir
  • 51
  • 1
  • 7
0
votes
1 answer

Using an EGARCH model with categorical data in R

I have a model which takes time series stock return data and categorises by the size of the return. The sizes of the categories are defined by number of standard deviations. I currently use the cut function to do this, my code is: Division <-…
0
votes
0 answers

Forecasting after adding dummy variable Using Tableau with R

I am able to forecast using Forecast() function in tableau. I have daily hourly data(demand electricity). Previously i was using following code: SCRIPT_REAL("library(forecast); jjearnts <- msts(.arg1, seasonal.periods=c(24, 7*24, 365*24)); …
0
votes
0 answers

Create dummy Variables based on 2 factors and paste in a new dataframe

I send all the data so you can reproduce it yourself example2<- as.data.frame(c("A", "A", "B", "B", "B", "G", "G", "E", "E", "F")) example3<- as.data.frame(c("1", "2", "1", "5", "4", "1", "2", "3", "1", "4"))…
0
votes
2 answers

Pandas Optimized Way to Create Dummy-Variable?

I am creating a new dummy variable based off of a given column and a criteria. Below is the code I am working with. It works but is too slow for what I would like to do. Is there a faster, maybe vectorized way do create dummies in pandas?…
sfortney
  • 2,075
  • 6
  • 23
  • 43
0
votes
1 answer

What does R's class.ind() function do and when would I use it?

R documentation says that nnet::class.ind() generates a class indicator function from a given factor. Does it convert a factor to some binary classification? When and why do we use this function? Please give me some examples. Any help…
user4745212
  • 51
  • 1
  • 3
  • 11
-1
votes
1 answer

How do I correct my code to create a new variable using two specifications in Stata?

Please correct my code so that the new variable takes on value 1 if column treatment ==1 and column category_assetprovision =="Accepted" and it takes on the value 0 if column treatment ==0 & column category_assetprovision =="Refused" in Stata. gen…
-1
votes
1 answer

creating a dummy variable with consecutive cases

I have a similar problem like this one: How can I create a dummy variable over consecutive values by group id? the difference is: as soon I have the Dummy = 1 I want my dummy for the rest of my group (ID) beeing 1 since year is in descending order. …
Sulz
  • 333
  • 1
  • 8
-1
votes
1 answer

Creating Dummy Variables based on string keyword using Python

I have a dataframe that looks like this: PROMOTED_PRODUCT__CREATIVE ROAS 0 Simple Green 1 Gal. Concentrated 0.027573 1 Simple Green 1 Gal. Concentrated 0.082969 2 Simple Green 1 Gal. Concentrated 0.056278 3 Simple…
mexicanRmy
  • 69
  • 7