[R] order() on vector with Inf's

Murray Jorgensen maj at stats.waikato.ac.nz
Thu Jan 23 03:24:03 CET 2003


I have a parameter vector, ibeta, and a corresponding vector of 
loglikelihoods, llbet. If llbet contains no NAs or Inf's then I can 
extract the best parameter by

index <- order(-llbet)[1]
beta <- ibeta[index]

or similar. The argument na.last of order() allows me to fix this up 
even if llbet contains some NAs which I wish to ignore.

Unfortunately my llbet contains Inf's, which are not points of infinite 
likelihood, if anything they should be -Inf's. Anyway na.last does not 
seem to help me with these. What should I do?

Murray
-- 
Dr Murray Jorgensen      http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: maj at waikato.ac.nz                                Fax 7 838 4155
Phone  +64 7 838 4773 wk    +64 7 849 6486 home    Mobile 021 1395 862




More information about the R-help mailing list