Consider the following modification of the example on p. 204 of
Venables and Ripley (2002) Modern Applied Statistics with S, 4th ed.
(Springer):
> table(housing$Sat)
Low Medium High
24 24 24
> Sato <- order(housing$Sat)
> polr(Sat ~ ., data = housing[Sato, ][1:48, ])
Call:
singularity encountered in: nlminb.1(temp, p, liv, lv, objective,
gradient, bounds, scale)
polr(formula = Sat ~ ., data = housing[Sato, ][1:48, ])
Coefficients:
Infl1 Infl2 Type1 Type2 Type3 Cont
Freq
-0.09129172 -0.3353951 0.6927303 -0.3315645 -0.08863461 0.1617146
-0.0644605
Intercepts:
Low|Medium Medium|High
-1.342748 22.42373
Residual Deviance: 62.92803
AIC: 80.92803
The ordered factor Sat has 3 levels, only 2 of which are
represented in the data.frame passed to "polr". If this is the case,
please drop the extraneous levels, e.g. as follows:
hous2 <- housing[Sato,][1:48,]
hous2$Sat <- ordered(as.character(hous2$Sat))
When I then tried polr on hous2, I got the following:
> polr(Sat ~ ., data = hous2)
Problem in polr(Sat ~ ., data = hous2): response must have 3 or more levels
Use traceback() to see the call stack
However, I trust this error message is now more intelligible, and
you may not get the same message with your data.
hope this helps.
spencer graves
p.s. If you don't already have Venables and Ripley (2002), I highly
recommend it.
C. Spanou wrote:
Hello splus-users, I am trying to fit a regression model for an
ordered response factor. So I am using the function polr in
library(MASS). My data is a matrix of 1665 rows and 63 columns (one of
the column is the dependent variable). The code I use is
polr(as.ordered(q23p)~.,data=newdatap)
but I am getting the following warning message singularity encountered
in: nlminb.1(temp, p, liv, lv, objective, gradient, bounds, scale)
I looked in the MASS help for nlminb and I found that the function
nlminb(start, objective, gradient=NULL, hessian=NULL, scale=1,
control=NULL, lower=-Inf, upper=Inf)
returns a warning message of singularity means that the optimization
algorithm thinks it can't make any further progress because it has too
many degrees of freedom. It usually means that the objective function
is either not differentiable, or it may not have an optimum.
So for my data an optimum can't be obtained.
Is this true?
Can I ignore this warning message since what I want to find is values
for the boundaries? Will the values for the boundaries be accurate
even though I get the warning message?
Thank you
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|