[R] Package 'MASS' (polr): Error in svd(X) : infinite or missing values in 'x'

Rune Haubo rhbc at imm.dtu.dk
Tue Jul 10 21:37:10 CEST 2012


Hi Jeremy,

I think Jessica is right that probably you could make polr converge
and produce a Hessian if the data are better scaled, but there might
also be other things not allowing you to get the Hessian/vcov. Could
be insightful if you showed us the result of
str(Jdata)

Also, I am thinking that perhaps the another implementation of ordinal
regression models might avoid the problem. You could try the ordinal
package (of which I am the author) -- the following should reproduce
the MASS::polr results:

install.packages(ordinal)
library(ordinal)
Global <- clm(JVeg5 ~  Elevation +  Lat_Y_pos + Coast_dist +
Stream_dist, data=Jdata)
summary(Global)

Another option would be Frank Harrell's lrm function in the rms package.

HTH,
Rune

On 9 July 2012 11:55, Jeremy Little <jeremy.little at my.jcu.edu.au> wrote:
> Hello,
>
> I am trying to run an ordinal logistic regression (polr) using the package
> 'MASS'.
>
> I have successfully run other regression classes (glm, multinom) without
> much problem, but with the 'polr' class I get the following error:
> " Error in svd(X) : infinite or missing values in 'x' "
> which appears when I run the "summary" command.
>
> The data file is large (585000 rows) and has no NA, -9999 or blank values.
>
> My script (in brief) is as follows, with results:
>
> ############
>> library(MASS)
>>
>> ## ADD DATA
>> Jdata<- read.delim("/Analysis/20120709 JLittle data file.txt", header=T)
>>
>> attach(Jdata)
>> names(Jdata)
>  [1] "POINTID"     "Lat_Y_pos"   "JVeg5"       "Subregion"   "Rock_U_Nam"
> "Rock_Name"   "Elevation"   "Slope"       "Aspect"      "Hillshade"
> "Stream_dist" "Coast_dist"  "Coast_SE"
> [14] "Coast_E"     "Wind_310"    "TPI"         "Landform"
>>
>> Global <- polr(JVeg5 ~  Elevation +  Lat_Y_pos + Coast_dist + Stream_dist,
>> data=Jdata)
>>
>> summary(Global)
> Error in svd(X) : infinite or missing values in 'x'
>>
> ##Try with omit NA command
>> Global <- polr(JVeg5 ~  Elevation +  Lat_Y_pos + Coast_dist + Stream_dist,
>> data=Jdata, na.action = na.omit, Hess = TRUE)
>>
>> summary(Global)
> Error in svd(X) : infinite or missing values in 'x'
> ############
>
> Does this imply an 'infinite value' and what would this mean?
>
> If anyone has any idea how to address this error, I would very much
> appreciate your response.
>
> Thank you in advance.
>
> Jeremy
>
> Date File Attachment (200 rows):
> http://r.789695.n4.nabble.com/file/n4635829/20120709_JLittle_data_file.txt
> 20120709_JLittle_data_file.txt
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Package-MASS-polr-Error-in-svd-X-infinite-or-missing-values-in-x-tp4635829.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Rune Haubo Bojesen Christensen

Ph.D. Student, M.Sc. Eng.
Phone: (+45) 45 25 33 63
Mobile: (+45) 30 26 45 54

DTU Informatics, Section for Statistics
Technical University of Denmark, Build. 305, Room 122,
DK-2800 Kgs. Lyngby, Denmark



More information about the R-help mailing list