Error In Polar Response Must Be A Factor
Contents |
[ author ] Hi, I tried to do a logistic regression with r polr polr(MASS). I thought I already converted the response to factor, but
Design Appears To Be Rank-deficient, So Dropping Some Coefs
obvious I was wrong. Could anyone tell me what I did wrong and how to correct it? ordinal logistic regression r Thank you very much! > Lease=read.csv("LeaseDummy.csv", header=TRUE) > Lease$ID <- as.integer(factor(Lease$EarlyTermination)) > > RegA=polr(ID~1+MSA+SIC.Code+TenantOption+LLOption+TOExercised, + data=Lease, method=c("logistic")) Error in polr(ID ~ 1 + MSA + SIC.Code + factor in r TenantOption + LLOption + TOExercised, : response must be a factor > summary(RegA) Best, Ed. --- Jean Eid
Logistic Regression In R
> > HTH > > Jean > On Wed, 3 Aug 2005, Rangesh Kunnavakkam wrote: > > > I have a large vector of around 12597 elements > and I wish to calculate > > p-value for each element using a formula of > something like: > > p-value= 1- > exp^(kexp^(-labda)) > > I was wondering someone could give some ideas how > to implement for each element. > > thankyou very much > > Rangesh.K > > > > ______________________________________________ > > 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 > > > > ______________________________________________ > 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 > Previous message: [R] help regarding loops in R Next message: [R] Convert numeric to factor Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] More information about the R-help mailing list
design, start, ..., na.action = na.omit, method = c("logistic", "probit", "cloglog", "cauchit")) ## S3 method for class 'svyrep.design': https://stat.ethz.ch/pipermail/r-help/2005-August/076669.html svyolr(formula,design,...,return.replicates=FALSE, multicore=getOption("survey.multicore")) Arguments formula Formula: the response must be a factor with at least three levels design survey design object ... dots start Optional http://r-survey.r-forge.r-project.org/survey/html/svyolr.html starting values for optimization na.action handling of missing values multicore Use multicore package to distribute computation of replicates across multiple processors? method Link function return.replicates return the individual replicate-weight estimates Value An object of class svyolr Author(s) The code is based closely on polr() from the MASS package of Venables and Ripley. See Also svyglm Examples data(api) dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) dclus1<-update(dclus1, mealcat=cut(meals,c(0,25,50,75,100))) svyolr(mealcat~avg.ed+mobility+stype, design=dclus1) [Package survey version 3.18 Index]
Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About http://stats.stackexchange.com/questions/166566/multicollinearity-problems-with-polr-function-in-the-mass-package-for-ordinal Us Learn more about Stack Overflow the company Business Learn more about hiring developers http://r.789695.n4.nabble.com/Package-MASS-polr-Error-in-svd-X-infinite-or-missing-values-in-x-td4635829.html or posting ads with us Cross Validated Questions Tags Users Badges Unanswered Ask Question _ Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a logistic regression question Anybody can answer The best answers are voted up and rise to the top Multicollinearity problems with `polr` function in the MASS package for ordinal response [closed] up vote 1 down vote favorite I've been trying to use the polr function for a couple days now. The dataset has lot of features (~70) and some of them are factor variables. When I run a simple glm error in polar on a response threshold, some dummy variables as found to be making the design matrix multicollinear - 4 of them. When I run polr on the data, it finds the same variables and tries to leave them out. I added print statements to polr using trace to verify my assumption. However, when I run summary(polr), I get an error saying the start variable isn't long enough. Its actually 4 short. The exact error thrown is: "'start' is not of the correct length" I've experimented with the formula passed to polr() to be very sure that start is always found short by the same amount as the number of variables (dummy or otherwise) removed to avoid multicollinearity. Here's sample code to see this problem (I've made small print adds using trace()): r = c(2,2,2,3,3,3,1,1,1,1) r = as.factor(r) x = c(0,0,0,4,5,6,0,-1,-1,1) y = c(5,5,2,1,0,3,10,4,3,8) z = c(0,0,0,4,5,6,0,-1,-1,1) a = data.frame(r,x,y,z) library(MASS) model <- polr(r~x*y*z, data=a) [1] "Killing the following coefs." [1] "z" "y:z" Warning messages: 1: glm.fit: fitted probabilities numerically 0 or 1 occurred 2: In polr(r ~ x * y * z, data = a) : design appears to be rank-deficient, so dropping some coefs summary(model) Re-fitting to get Hessian [1]
messages Jeremy Little Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Package 'MASS' (polr): Error in svd(X) : infinite or missing values in 'x' 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): 20120709_JLittle_data_file.txt Jessica Streicher Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Package 'MASS' (polr): Error in svd(X) : infinite or missing values in 'x' Since its something about the Hessian, and occurs in the vcov() call, have you thought