[R-sig-Geo] making Principal Component Analysis with large raster

Paul Hiemstra paul.hiemstra at knmi.nl
Thu Feb 23 10:03:13 CET 2012


On 02/21/2012 02:22 PM, Josep M Serra diaz wrote:
> Dear listers!
>
> I am getting a bit crazy trying to perform a PCA of 6 raster layers. I
> tried using prcomp() by sampling a large dataset of points (around 70%)...
> but it is still way too large. Do you know any other way to perform such
> analysis??
>
> Pep
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Hi Pep,

Please provide us with more information:

- What errors are you getting? (e.g. out of memory)
- How large are your raster exactly? 6 layers to perform PCA on does not
sound as a lot, I've done it on 126 layers.
- Give a reproducible example of the code that fails. This allows us to
spot any mistakes in the structure of the program. Maybe you can even
upload your dataset somewhere.

One solution could be to use princomp instead of prcomp, this function
allows one to provide a covariance matrix. In this way you can
precalculate the cov. matrix in chunks, overcoming the memory issue. I
used this approach to calculate the cov. matrix of a 2 GB data file with
almost no memory usage.

cheers,
Paul

-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770



More information about the R-sig-Geo mailing list