Error In X * Object$coefficients Non-conformable Arguments
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 Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Calling predict after training with polr on multicollinear data problematic up vote 2 down vote favorite Take a look at the code below. This question has been asked before but shut down - presumably for lack of R code to reproduce the problem. Basically, when there is multicollinearity in the data, using Polr-trained model is problematic during the call to predict(). What am I missing here? The part in bold below is what R says to me. The rest is my code. 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+z, data=a, Hess=TRUE) Warning message: In polr(r ~ x + z, data = a, Hess = TRUE) : design appears to be rank-deficient, so dropping some coefs test = model.frame(r~x+ z, data=a) predict(model, test, type="class", s=model$lambda.min) Error in X %*% object$coefficients : non-conformable arguments test2 = model.frame(r~x, data=a) predict(model, test2, type="class", s=model$lambda.min) Error in X %*% object$coefficients : non-conformable arguments test3 = model.frame(~x, data=a) predict(model, test2, type="class", s=model$lambda.min) Error in X %*% object$coefficients : non-conformable arguments model2 = polr(r~x, data=a, Hess=TRUE) predict(model2, test, type="class", s=model$lambda.min) [1] 1 1 1 3 3 3 1 1 1 2 Levels: 1 2 3 predict(model2, test2, type="class", s=model$lambda.min) [1] 1 1 1 3 3 3 1 1 1 2 Levels: 1 2 3 predict(model2, test3, type="class", s=model$lambda.min) [1] 1 1 1 3 3 3 1 1 1 2 Levels: 1 2 3 r statistics logistic-regression ord
in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Plot with residuals in mgcv Hi, I am using the mgcv package (version 1.7-22.) running the model works fine, but when I want to have a plot with residuals I get an error. fit29<-gam(IV~s(G3)+s(V3)+factor(AAR)+s(D3)+s(RUTE,bs="re"),data=subsf,gamma=1.4,method="ML") plot(fit29,residuals=T) Error in X[, first:last] %*% object$coefficients[first:last] : non-conformable arguments does some one know what this error means? the subsf matrix is 35x27. Silje [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the http://stackoverflow.com/questions/32129353/calling-predict-after-training-with-polr-on-multicollinear-data-problematic posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code. Peter Ehlers Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Plot with residuals in mgcv On 2012-11-28 05:02, silje skår wrote: > Hi, > > I am using the mgcv package (version 1.7-22.) running the model works fine, > but when I want to http://r.789695.n4.nabble.com/Plot-with-residuals-in-mgcv-td4651129.html have a plot with residuals I get an error. > > fit29<-gam(IV~s(G3)+s(V3)+factor(AAR)+s(D3)+s(RUTE,bs="re"),data=subsf,gamma=1.4,method="ML") > > > plot(fit29,residuals=T) > Error in X[, first:last] %*% object$coefficients[first:last] : > non-conformable arguments > > does some one know what this error means? the subsf matrix is 35x27. > > Silje Well, the error means that the matrix X[, first:last] and the vector object$coefficients[first:last] don't have 'matching' dimensions. I don't see why, but since the 'residuals' argument to plot.gam() can be an array _of the correct length_ (see ?plot.gam), it just might be that you have an object called 'T' hanging around, in which case using 'T' in place of 'TRUE' is a bad idea. Actually, it's _always_ a bad idea. Peter Ehlers ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code. William Dunlap Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Plot with residuals in mgcv > > fit29<- gam(IV~s(G3)+s(V3)+factor(AAR)+s(D3)+s(RUTE,bs="re"),data=subsf,gamma=1.4,method ="ML") > > plot(fit29,residuals=T) > > Error in X[, first:last] %*% object$coefficients[first:last] : non-conformable arguments Those errors often come from omitting the drop=FALS
two frames at random. 1.Gain is one of the frames. The dependent variable is the difference between whether people thought it http://www.faqssys.info/tag/ordered-logit/ was a good idea after the frame and before the frame. I need help on how to read the coefficient Calling predict after training with polr on multicollinear data admin September 11, 2015 Comments Take a look at the code below. This question has been asked before but shut down - presumably for lack of R error in code to reproduce the problem. Basically, when there is multicollinearity in the data, using Polr-trained model is problematic during the call to predict(). What am I missing here? The part in bold below is what R says to me. The rest is my code. 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 error in x = c(0,0,0,4,5,6,0,-1,-1,1) a = data.frame(r,x,y,z) library(MASS) model <- polr(r~x+z, data=a, Hess=TRUE) Warning message: In polr(r ~ x + z, data = a, Hess = TRUE) : design appears to be rank-deficient, so dropping some coefs test = model.frame(r~x+ z, data=a) predict(model, test, type="class", s=model$lambda.min) Error in X %*% object$coefficients : non-conformable arguments test2 = model.frame(r~x, data=a) predict(model, test2, type="class", s=model$lambda.min) Error in X %*% object$coefficients : non-conformable arguments test3 = model.frame(~x, data=a) predict(model, test2, type="class", s=model$lambda.min) Error in X %*% object$coefficients : non-conformable arguments model2 = polr(r~x, data=a, Hess=TRUE) predict(model2, test, type="class", s=model$lambda.min) [1] 1 1 1 3 3 3 1 1 1 2 Levels: 1 2 3 predict(model2, test2, type="class", s=model$lambda.min) [1] 1 1 1 3 3 3 1 1 1 2 Levels: 1 2 3 predict(model2, test3, type="class", s=model$lambda.min) [1] 1 1 1 3 3 3 1 1 1 2 Levels: 1 2 3 Ordered Logit regression intrepretation admin September 1, 2015 1 Comment I hope the image is relatively clear… My dependent variable is the change
be down. Please try the request again. Your cache administrator is webmaster. Generated Tue, 11 Oct 2016 20:20:03 GMT by s_ac15 (squid/3.5.20)