[R] svd error

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jan 27 19:39:11 CET 2005


On Thu, 27 Jan 2005, Spencer Graves wrote:

> Dear Prof. Ripley: 
>     With library(MASS), I got the following in R 2.0.1 under Windows 2000: 
>> X
>    [,1] [,2]
> [1,]    1    3
> [2,]    2   NA
>> ginv(X)
> Error in svd(X) : infinite or missing values in x
>
>     This may not relate to Tongtong Wu's problem, but it used "ginv" in 
> library(MASS) as you suggested and did produce the cited error message.

I said `introduce'.  The cause of the error is in X, not introduced by 
ginv. pseudoinverse can introduce NaNs/infinities.

Please do remember the care I take when writing things.

BDR


>     spencer graves
>
> Prof Brian Ripley wrote:
>
>> On Thu, 27 Jan 2005, WU,TONGTONG wrote:
>> 
>>> Hi,
>>> 
>>>  I met a probem recently and need your help.  I would really appreciate
>>> it.
>>> 
>>>  I kept receiving the following error message when running a program:
>>> 
>>> 'Error in svd(X) : infinite or missing values in x'.
>>> 
>>> However, I did not use any svd function in this program though I did
>>> include the function pseudoinverse.  Is the problem caused by doing
>>> pseudoinverse?
>> 
>> 
>> Where did you find that function?  It is not part of R as it ships, and it 
>> *may* be part of GeneTS, where it calls svd after squaring the matrix. But 
>> there are simpler pseudoinverse functions (e.g. ginv in MASS) that will not 
>> introduce that error.
>> 
>> The tool you needed was traceback(): try it to see what it tells you here.
>> 
>
>

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list