(PR#6452) Re: [Rd] predict.princomp fails if princomp was called

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Jan 22 13:48:27 MET 2004


Yes, and it should fail or return NA, as the required information is not
available. The problem is that it had logical NAs not numeric NAs for the
center component.

#3682 points out something that is on the help page: if you supply covmat 
as a matrix (and not a covariance list) there is no information on the 
centring done and x is ignored.

On Thu, 22 Jan 2004 joehl at gmx.de wrote:

> 
> Dear all,
> 
> predict.princomp seems to expect non-NA component $center which is not set
> by princomp.default.
> 
> 
> Best regards
> 
> 
> 
> Jens Oehlschlägel
> 
> 
> 
> > x <- matrix(rnorm(400), ncol=4)
> > predict(princomp(x, covmat=cov(x)), newdata=x[1:10, ])
> Error in if (center) { : missing value where TRUE/FALSE needed
> In addition: Warning message: 
> the condition has length > 1 and only the first element will be used in: if
> (center) { 
> > version
>          _              
> platform i386-pc-mingw32
> arch     i386           
> os       mingw32        
> system   i386, mingw32  
> status                  
> major    1              
> minor    8.1            
> year     2003           
> month    11             
> day      21             
> language R
> 
> 

-- 
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-devel mailing list