s-news
[Top] [All Lists]

Re: convergence in polr

To: Spencer Graves <spencer.graves@pdf.com>
Subject: Re: convergence in polr
From: "C. Spanou" <cs369@cam.ac.uk>
Date: 24 Feb 2004 17:50:21 +0000
Cc: s-news@lists.biostat.wustl.edu
Thank you for your hints I tried what you said for the data in Venables&Ripley and I was getting the same command as you did. But when the dependent variable has three values it still gives the warning message about singularity.
hous3_housing[Sato,][1:56,]
hous3$Sat_ordered(as.character(hous3$Sat))
polr(Sat~.,data=hous3)
Warning messages:
singularity encountered in: nlminb.1(temp, p, liv, lv, objective, gradient, bounds, scale) Call: polr(formula = Sat ~ ., data = hous3)

Coefficients:
Infl1 Infl2 Type1 Type2 Type3 Cont Freq -0.09239883 -0.195098 0.563434 -0.2593354 0.08098704 0.573102 -0.05318413

Intercepts:
High|Low Low|Medium -3.273655 -0.8871573

Residual Deviance: 103.267 AIC: 121.267

I tried the same commands for my model and I was getting the warning message of singularities.




On Feb 24 2004, Spencer Graves wrote:

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




<Prev in Thread] Current Thread [Next in Thread>