Timeline for Regression for categorical independent variables and a continuous dependent one
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 27, 2018 at 23:40 | comment | added | rahs | @IWS What happens if I have an independent variable that is categorical with which the dependent variable does not vary monotonically. For example, to predict the price of a toy, one of the features is colour (which can take the values blue, red or yellow). If blue=0, red = 1 and yellow =2, but price of a blue toy is higher than that of an equivalent red toy and price of a yellow toy is higher than that of an equivalent blue (and red toy). Can I still use colour as a feature? | |
S Jul 12, 2017 at 8:47 | history | suggested | famargar | CC BY-SA 3.0 |
The text corresponding to the core of the answer is now in bold
|
Jul 12, 2017 at 8:44 | review | Suggested edits | |||
S Jul 12, 2017 at 8:47 | |||||
Mar 13, 2017 at 12:50 | comment | added | IWS | In the case of an ordinal variable one can always chose to assume it is "continuous enough" to use it as if it were a continuous predictor (by simply not using dummies, but entering the variable as a numerical version). However, if you do this and you have only few levels, you are fitting a straight line (thus assuming linearity) through only a few points (so note that the amount of levels is important here). A Likert scale is a good example of a variable used this way, which regrettably creates problems on various occasions. | |
Mar 13, 2017 at 12:47 | comment | added | smci | What purpose is the 'smoothing' for? Just for visually trying to interpret the output as a (continuous) curve? If there are K input binary categoricals, there will only be 2^K discrete output points. Likewise if they were ordinals, you would multiply together the number of levels. | |
Mar 13, 2017 at 12:44 | comment | added | famargar | I deleted the second question as you fully answered the original one. To answer your question, if I feed $n$ new "events" ($x_i$) to the model, I would get $n$ different $y$ values that would all take one of four regressed values. I guess I am saying that if the categorical variables were actually ordinal, I would like to introduce some (logit?) smoothing between values. | |
Mar 13, 2017 at 11:43 | history | edited | IWS | CC BY-SA 3.0 |
fixed grammar
|
Mar 13, 2017 at 10:08 | comment | added | IWS | I see you have edited the question to add a second question, and posted a similar quesiton here: stats.stackexchange.com/questions/267137/… . Additionally, I'd ask you what you mean by smoothing your predictions, or what you mean by predicting discrete values. AFAIK a linear regression will give you the mean value of the continuous dependent based on your predictor variables (through the regression formula). Please elaborate | |
Mar 13, 2017 at 9:58 | vote | accept | famargar | ||
Mar 13, 2017 at 9:39 | comment | added | famargar | Thanks! This is brilliant. However, I am still puzzled that in this case the values I would predict are discrete, while my dependent variable is actually continuous. Is there any way to "smooth" my predictions? | |
Mar 13, 2017 at 9:37 | comment | added | IWS | yes that is what I was saying. | |
Mar 13, 2017 at 9:29 | comment | added | famargar | thanks. as I write in the question title, the dependent variable is continuous. So I take your answer as "you can use linear regression, provided you do dummy encoding". Please correct me if I am wrong. | |
Mar 13, 2017 at 8:58 | history | answered | IWS | CC BY-SA 3.0 |