[R] machine dependency [polr()/optim()]

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Tue Jun 4 22:50:37 CEST 2002


On Tue, 4 Jun 2002, Boryeu Mao wrote:

> Dear R experts:
>
> I am running some calculations using polr() in MASS library, and found some
> differences in results obtained on two different machines (IRIX 6.5, and
> Linux RH 7.1).  It is not clear to me whether this is due to some error in
> my programming the calculation and how to resolve the differences, if
> possible.
>
> The polr() call is the following:
>
> reg<-polr(dep~.,data=mm,start=c(1:(length(mm)-1+length(levels(dep))-1))/10.0
> ,Hess=TRUE)
>
> where mm, with 827 rows, has one column of dependent variable ("dep"), and
> 29 columns of independent variables; there are 6 levels for "dep", 0-5.  For
> a particular "mm", the following results (1st three coefficients) are
> produced on both machines:
>
> -0.07879468  0.05200974  0.57545475
>
> But for a different "mm", the coefficients are:
>
> -0.050742489 -0.006628615  0.537587536 [on IRIX]
> -0.050634191 -0.007433505  0.541055510 [on Linux]
>
> The only source for the difference (that I can find) is in "reg$niter":
> 256 (f.evals.function) and 100 (g.evals.function) [IRIX]
> 261 (f.evals.function) and 100 (g.evals.function) [Linux]

What did the convergence component of the fitted object say?
[Hint: your fits have not converged.]

> This somewhat dismissed my initial worry that some errors in my programs
> caused the different values for the coefficients; but if the differences are
> indeed due to machine differences, I am wondering if it is possible to
> program the calculations (eg. to somehow force the number of iterations ?)
> so that the results are reproduced for all cases.  Another observations is
> that polr() produces identical results more exclusively if the number of
> columns is smaller.

I've been lazy porting polr to R.  Add ... to the optim call in polr, and
pass it a control argument (see ?optim).

> (A few more details: For the IRIX, the R binary was built with "-O2 -64" for
> all compilers (f77 included), and on Linux, "-O2".)
>
> Help and suggestions/hints for further narrowing the sources are
> appreciated.  Thanks in Advance.
>
> Boryeu Mao

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list