[R] machine dependency [polr()/optim()]
B.Mao at cerep.com
Wed Jun 5 00:00:18 CEST 2002
Thanks so much for the hints. So I failed to monitor the convergence. Once
optim() gets "control=list(maxit=N)" from polr(), the results for the second
"mm" array are:
-0.049989871 -0.006739967 0.539374483 [IRIX]
-0.049996443 -0.006740587 0.539364033 [Linux]
with convergence code of 0, and the following iteration numbers,
289(f) 111(g) [IRIX]
289(f) 113(g) [Linux]
(Since the numbers for the 1st mm array are reproduced to all printed
digits, perhaps there are still other controls that can reduce the
difference -- I'll try to look up the functions some more).
From: ripley at stats.ox.ac.uk [mailto:ripley at stats.ox.ac.uk]
Sent: Tuesday, June 04, 2002 1:51 PM
To: Boryeu Mao
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] machine dependency [polr()/optim()]
On Tue, 4 Jun 2002, Boryeu Mao wrote:
> Dear R experts:
> I am running some calculations using polr() in MASS library, and found
> 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
> The polr() call is the following:
> 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.
> 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
> 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"
> 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