0
$\begingroup$

I want to predict the impact of oil price over a Colombian oil company's stock price. I plan to use a multinomial regression for this with a categorical variable (Up, Down or Neutral given the direction of the stock price). Here is part of my dataset:

Minute  ecopet  profit  sum_profit   direccion  cl1_chg   sum_cl1    direccion_cl1
571     2160     0       10           Up         -0.03     0.00      Down
572     2160     0        0           Neutral     0.07    -0.03      Down
573     2160     0       -5           Down       -0.08     0.04      Up
574     2160     0       -5           Down       -0.07    -0.04      Down
575     2160     5       -5           Down       -0.08    -0.11      Down
576     2165     0       -25          Down        0.00    -0.19      Down
577     2165     0       -25          Down       -0.05    -0.19      Down
578     2165     0       -15          Down       -0.17    -0.24      Down
579     2165     5       -15          Down       -0.06    -0.41      Down
580     2170     0       -20          Down        0.03    -0.47      Down
581     2170    -10       0           Neutral     0.04    -0.44      Down

My dependent variable is 'direccion'. But as you can see it has 3 response classes.the code I am using in R for the multinomial regression is:

glm.fit=multinomial(direccion~direccion_cl1, data=datos)

I am working with intraday information and plan to predict what happens when the oil moves up/ down (in the previous 10 minutes) and how it impacts the stock price in the next 10 minutes.

The problem is that once I run the regression, what I get for glm.fit does not include the Coefficients for the level "Down". Would you know why is that? I get this:

 Call:
 multinom(formula = direccion ~ direccion_cl1, data = datos)

 Coefficients:
          (Intercept) direccion_cl1Up     
 Neutral   1.0505813       0.1955194 
 Up       -0.2513035       0.3936570 

 Residual Deviance: 90752.54 
 AIC: 90764.54 

Additional to this, when I use the function predict to see how well my model works I get this error message:

 log.probs=predict(glm.fit, "probs")
 Error in eval(expr, envir, enclos) : object 'direccion_cl1' not found

Thanks a lot!

$\endgroup$
1
$\begingroup$

Note that there is a linear relationship between the following "indicators":

$$\{1,1_{direccion\_cl1Up},1_{direccion\_cl1Down}\}$$ Since : $1-1_{direccion\_cl1Up}-1_{direccion\_cl1Down}=0$.

Therefore, you cannot perform a linear regression on these variables directly (more than one solution propose the same results).

By default, when R expands factors having $n$ levels, it proposes $n-1$ dummy variables, encoded as $n-1$ columns.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ What would you recommend for me to fix this? Regressions are not my strong point. Nonetheless, I have to use it for this. Thanks! @RUser4512 $\endgroup$ – Juan Trujillo Oct 8 '15 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.