Hi I am working with this data: my data summary is:> summary(spi)open high low close volume Min. :4315 Min. :4365 Min. :4301 Min. :4352 Min. : 0 1st Qu.:4480 1st Qu.:4497 1st Qu.:4458 1st Qu.:4475 1st Qu.:11135 Median :4609 Median :4631 Median :4594 Median :4614 Median :14439 Mean :4620 Mean :4640 Mean :4599 Mean :4620 Mean :16590 3rd Qu.:4773 3rd Qu.:4796 3rd Qu.:4753 3rd Qu.:4766 3rd Qu.:18294 Max. :4944 Max. :4954 Max. :4912 Max. :4937 Max. :73559 openInterest direction volatility volumeXdirection Min. : 0 Min. :-62.00000 Min. : 0.00 Min. :-2795242 1st Qu.:184685 1st Qu.:-19.25000 1st Qu.:30.00 1st Qu.: -248740 Median :193233 Median : -1.50000 Median :38.50 Median : -15905 Mean :188825 Mean : 0.01563 Mean :41.58 Mean : 6275 3rd Qu.:199800 3rd Qu.: 17.00000 3rd Qu.:50.00 3rd Qu.: 206325 Max. :236759 Max. : 74.00000 Max. :94.00 Max. : 2024470 volatilityXdirection upDown nextDay Min. : 0 Min. :0.0000 Min. :0.0000 1st Qu.: 362816 1st Qu.:0.0000 1st Qu.:0.0000 Median : 540187 Median :0.0000 Median :0.0000 Mean : 731595 Mean :0.4844 Mean :0.4844 3rd Qu.: 996650 3rd Qu.:1.0000 3rd Qu.:1.0000 Max. :3604391 Max. :1.0000 Max. :1.0000>and trying to do a glm like this:> logistic.model = glm(formula = as.factor(nextDay) ~ .,family=binomial, data=spi[1:50,])> summary(logistic.model)Call: glm(formula = as.factor(nextDay) ~ ., family = binomial, data spi[1:50, ]) Deviance Residuals: Min 1Q Median 3Q Max -1.9994 -0.8575 -0.0330 0.7961 1.8376 Coefficients: (2 not defined because of singularities) Estimate Std. Error z value Pr(>|z|) (Intercept) -3.016e+01 2.934e+01 -1.028 0.3040 open -2.514e-02 8.939e-02 -0.281 0.7785 high 7.598e-02 1.295e-01 0.587 0.5575 low -1.065e-01 1.176e-01 -0.905 0.3656 close 5.943e-02 7.995e-02 0.743 0.4573 volume 1.960e-04 1.977e-04 0.991 0.3215 openInterest 5.728e-05 5.266e-05 1.088 0.2767 direction NA NA NA NA volatility NA NA NA NA volumeXdirection 3.605e-06 3.765e-06 0.958 0.3383 volatilityXdirection -5.815e-06 5.708e-06 -1.019 0.3082 upDown -2.561e+00 1.259e+00 -2.034 0.0419 * --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 69.235 on 49 degrees of freedom Residual deviance: 55.000 on 40 degrees of freedom AIC: 75 Number of Fisher Scoring iterations: 7>I am getting NA for direction and volatility. I got it both before and after casting them as.numeric. Can anyone tell me what I am doing wrong? Thanks Stephen -- 20/02/2006 [[alternative HTML version deleted]]
From: Stephen Choularton> > Hi > > I am working with this data: > > > my data summary is: > > > > summary(spi) > open high low close > volume > > Min. :4315 Min. :4365 Min. :4301 Min. :4352 Min. : > 0 > 1st Qu.:4480 1st Qu.:4497 1st Qu.:4458 1st Qu.:4475 1st > Qu.:11135 > Median :4609 Median :4631 Median :4594 Median :4614 Median > :14439 > Mean :4620 Mean :4640 Mean :4599 Mean :4620 Mean > :16590 > 3rd Qu.:4773 3rd Qu.:4796 3rd Qu.:4753 3rd Qu.:4766 3rd > Qu.:18294 > Max. :4944 Max. :4954 Max. :4912 Max. :4937 Max. > :73559 > openInterest direction volatility > volumeXdirection > Min. : 0 Min. :-62.00000 Min. : 0.00 Min. > :-2795242 > 1st Qu.:184685 1st Qu.:-19.25000 1st Qu.:30.00 1st > Qu.: -248740 > Median :193233 Median : -1.50000 Median :38.50 Median > : -15905 > Mean :188825 Mean : 0.01563 Mean :41.58 Mean > : 6275 > 3rd Qu.:199800 3rd Qu.: 17.00000 3rd Qu.:50.00 3rd > Qu.: 206325 > Max. :236759 Max. : 74.00000 Max. :94.00 Max. > : 2024470 > volatilityXdirection upDown nextDay > Min. : 0 Min. :0.0000 Min. :0.0000 > 1st Qu.: 362816 1st Qu.:0.0000 1st Qu.:0.0000 > Median : 540187 Median :0.0000 Median :0.0000 > Mean : 731595 Mean :0.4844 Mean :0.4844 > 3rd Qu.: 996650 3rd Qu.:1.0000 3rd Qu.:1.0000 > Max. :3604391 Max. :1.0000 Max. :1.0000 > > > > and trying to do a glm like this: > > > > logistic.model = glm(formula = as.factor(nextDay) ~ ., > family=binomial, data=spi[1:50,]) > > summary(logistic.model) > > Call: > glm(formula = as.factor(nextDay) ~ ., family = binomial, data > spi[1:50, > ]) > > Deviance Residuals: > Min 1Q Median 3Q Max > -1.9994 -0.8575 -0.0330 0.7961 1.8376 > > Coefficients: (2 not defined because of singularities)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The answer is most likely here: You have multicollinearity. Andy> Estimate Std. Error z value Pr(>|z|) > (Intercept) -3.016e+01 2.934e+01 -1.028 0.3040 > open -2.514e-02 8.939e-02 -0.281 0.7785 > high 7.598e-02 1.295e-01 0.587 0.5575 > low -1.065e-01 1.176e-01 -0.905 0.3656 > close 5.943e-02 7.995e-02 0.743 0.4573 > volume 1.960e-04 1.977e-04 0.991 0.3215 > openInterest 5.728e-05 5.266e-05 1.088 0.2767 > direction NA NA NA NA > volatility NA NA NA NA > volumeXdirection 3.605e-06 3.765e-06 0.958 0.3383 > volatilityXdirection -5.815e-06 5.708e-06 -1.019 0.3082 > upDown -2.561e+00 1.259e+00 -2.034 0.0419 * > --- > Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 > > (Dispersion parameter for binomial family taken to be 1) > > Null deviance: 69.235 on 49 degrees of freedom > Residual deviance: 55.000 on 40 degrees of freedom > AIC: 75 > > Number of Fisher Scoring iterations: 7 > > > > > I am getting NA for direction and volatility. I got it both > before and > after casting them as.numeric. > > Can anyone tell me what I am doing wrong? > > Thanks > > Stephen > > -- > > > > 20/02/2006 > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >