Re: [R] likelyhood maximization problem with polr
Hello, Thanks for your answer. I will try this function to see if it gives equivalent results that those obtained with polr()+dropterm() (in a case where polr() works). Many thanks -- View this message in context: http://r.789695.n4.nabble.com/likelyhood-maximization-problem-with-polr-tp2528818p3043137.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] likelyhood maximization problem with polr
Thank you for your answer. I have already tried lrm and it's true that it works better than polr in such a case. Nevertheless lrm does not work with the addterm and dropterm functions (to my knowledge) and I need to use them. Maybe do you know alternate functions that would do the same job and that would work with lrm ? Many thanks -- View this message in context: http://r.789695.n4.nabble.com/likelyhood-maximization-problem-with-polr-tp2528818p3034385.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] likelyhood maximization problem with polr
blackscorpio wrote: Thank you for your answer. I have already tried lrm and it's true that it works better than polr in such a case. Nevertheless lrm does not work with the addterm and dropterm functions (to my knowledge) and I need to use them. Maybe do you know alternate functions that would do the same job and that would work with lrm ? Many thanks I don't know of an exact equivalent. fastbw(Design) will do backwards elimination for an lrm model. -- View this message in context: http://r.789695.n4.nabble.com/likelyhood-maximization-problem-with-polr-tp2528818p3035248.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] likelyhood maximization problem with polr
blackscorpio wrote: Dear community, I am currently trying to fit an ordinal logistic regression model with the polr function. I often get the same error message : attempt to find suitable starting values failed, for example with : ... Does anyone have a clue ? Yes. The code that generates a starting value for the optimization is flakey. lrm in the Design library appear to be more robust. -- View this message in context: http://r.789695.n4.nabble.com/likelyhood-maximization-problem-with-polr-tp2528818p3030397.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] likelyhood maximization problem with polr
Ok, thanks a lot ! I tried to compute the inverse of the variance covariance matrix of the estimators with vcov, which gave me this error : require(MASS) data(iris) model=polr(Species~Sepal.Length+Sepal.Width+Petal.Length+Petal.Width,iris,start = rep(1, 6),method= logistic) require(stats) vcov(model) Re-fitting to get Hessian Erreur dans optim(s0, fmin, gmin, method = BFGS, hessian = Hess, ...) : la valeur initiale dans 'vmin' n'est pas finie which means Error in optim(...) : the initial value in 'vmin' is not finite ... -- View this message in context: http://r.789695.n4.nabble.com/likelyhood-maximization-problem-with-polr-tp2528818p2531045.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] likelyhood maximization problem with polr
Thanks a lot for your answer ! I had already tried to initialize the algorithm with a null vector by setting start=rep(0,6) or a random vector with start=runif(6), and I nearly found the same results as yours. But I am wondering if the solution obtained in this case wouldn't be too far from the best one ? Maybe the procedure will begin near a local minimum, which will make difficult to find the maximum at the end (if it does exist) ? I also tried to increase the number of permitted iterations with maxit in the glm.fit function used inside polr, which gave me almost the same results too... Or maybe it is better to modify the epsilon tolerance for convergence ? Many thanks ! -- View this message in context: http://r.789695.n4.nabble.com/likelyhood-maximization-problem-with-polr-tp2528818p2530450.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] likelyhood maximization problem with polr
If you can prove that the Fisher information matrix is positive definite, the resulting estimate is MLE. Otherwise you can only claim it a local MLE (the Hessian matrix at the estimate is negative definite). -- View this message in context: http://r.789695.n4.nabble.com/likelyhood-maximization-problem-with-polr-tp2528818p2530594.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
[R] likelyhood maximization problem with polr
Dear community, I am currently trying to fit an ordinal logistic regression model with the polr function. I often get the same error message : attempt to find suitable starting values failed, for example with : require(MASS) data(iris) polr(Species~Sepal.Length+Sepal.Width+Petal.Length+Petal.Width,iris) (I know the response variable Species should be nominal but I do as levels were ordered for the example). I think this is a likelyhood maximization problem ; I tried to solve this by setting the start option of polr to a null or a random vector by it doesn't garantee to find a good solution at the end. Does anyone have a clue ? Thanks a lot ! -- View this message in context: http://r.789695.n4.nabble.com/likelyhood-maximization-problem-with-polr-tp2528818p2528818.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] likelyhood maximization problem with polr
Since the default initial value is not good enough. You should choose one based on your experience or luck. I choose start=rep(1,5) since there are parameters in the model. polr(Species~Sepal.Length+Sepal.Width+Petal.Length+Petal.Width,iris, start=rep(1,6), method = logistic) Call: polr(formula = Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width, data = iris, start = rep(1, 6), method = logistic) Coefficients: Sepal.Length Sepal.Width Petal.Length Petal.Width -2.471271-6.675614 9.43275318.266280 Intercepts: setosa|versicolor versicolor|virginica 5.51322342.598774 Residual Deviance: 11.89856 AIC: 23.89856 -- View this message in context: http://r.789695.n4.nabble.com/likelyhood-maximization-problem-with-polr-tp2528818p2529174.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] likelyhood maximization problem with polr
sorry: start=rep(1,6) since there are 6 parameters in the model. -- View this message in context: http://r.789695.n4.nabble.com/likelyhood-maximization-problem-with-polr-tp2528818p2529176.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.