[R-sig-Geo] spacetime EOF implementation - interpretation question

Edzer Pebesma edzer.pebesma at uni-muenster.de
Mon Oct 27 19:32:45 CET 2014


Thanks for bringing this up, Andrew, for the note, and for the example.
I looked into the note, into Wilks, and into Cressie & Wikle, which I
tried to follow when I wrote EOF.

I decided to deprecate spacetime::EOF. It computes principle component
scores from the m x p space-time matrix or its transpose, which might be
useful to some, but what it does is too far from the EOF literature to
be helpful. In particular, it confused "spatial" and "temporal" modes,
as C & W use these terms.

I added a new function, spacetime::eof, which should do what the
literature describes as EOF: return the eigenvector coefficients of the
rotation matrix. Argument returnEOFs = FALSE gives back the prcomp
object, feeding that to predict() gives the scores.

Reproducing the figures in C & W Ch 5 looks now better, up to expected
sign changes, but the numerical ranges are still different.

Please reinstall spacetime from github, use eof, and see if things now
work as expected. demo(CressieWikle) is now updated as well.

In your example below, you normalize by

> PCs = apply(seof$rotation, 2, function(x) (x - mean(x)) / sd(x))

but why? Eigenvectors are already standardized, but to unit length; is
this another convention of the EOF world?

With best regards,

On 10/24/2014 12:04 AM, Andrew Vitale wrote:
> Hello,
> 
> I'm performing an empirical orthogonal function analysis on sea level
> pressure using the spacetime package, and I'm having trouble determining
> which elements of the function output I should use to interpret the results.
> 
> It seems that most examples in the literature calculate empirical
> orthogonal functions (EOFs) and their associated principle component (PC)
> time series (e.g. http://www.met.reading.ac.uk/~han/Monitor/eofprimer.pdf ,
> pp 11-12, Fig. 2, 3).  As far as I can tell, I should be able to extract
> all of the relevant information using only the spatial mode in the
> spacetime:::EOF function.  However, the ambiguous terminology in the
> literature and the availability of the "temporal" mode in spacetime:::EOF
> have me uncertain of my interpretation.
> 
> I have been treating the output of spacetime:::EOF with
> returnPredictions=TRUE as the EOFs, and I have been treating the
> spacetime:::EOF $rotation element with returnPredictions=FALSE as the PCs.
> 
> Am I extracting the proper information from the spacetime:::EOF results?
> Are the results of the spatial and temporal modes of spacetime:::EOF both
> required to perform an EOF analysis of a sea level pressure field, or are
> these two separate analyses?
> 
> Below is a small example of how I am currently extracting the spatial EOFs
> and their associated PCs.
> 
> Thanks for any comments,
> Andrew Vitale
> 
> 
> library(raster)
> library(spacetime)
> 
> ## Create a raster object that mimics my data
> ## which is actually a raster stack of 20,718
> ## daily sea level pressure anomolies
> a = array(rnorm(9*9*100), c(9,9,100))
> b = brick(a)
> b = setValues(b, a)
> z = seq(as.Date('1980-01-01'), as.Date('1980-04-09'),
>         by = 'day')
> b = setZ(b, z)
> 
> ## coerce the raster stack to an STFDF object
> st = as(b, 'STFDF')
> 
> ## calculate EOFs in spatial mode using spacetime
> seof = EOF(st, how='spatial', returnPredictions=FALSE, scale.=TRUE)
> seof_preds = EOF(st, how='spatial', returnPredictions=TRUE, scale.=TRUE)
> 
> ## Create a raster stack of the predictions, which seem to be
> ## generally referred to as EOFs in the literature
> EOFs = stack(seof_preds)
> ## extract and standardize the rotation element of the
> ## seof object, which seems to be the eigenvectors, which seem
> ## to also be referred to as PCs in the literature
> PCs = apply(seof$rotation, 2, function(x) (x - mean(x)) / sd(x))
> 
> ## Plot the EOFs as maps (seof_preds)
> plot(EOFs)
> 
> ## Plot the first PC (seof$rotation [standardized])
> x11(height=7, width=10)
> plot(x=as.Date(row.names(PCs), format='X%Y.%m.%d'),
>      y=PCs[ , 1], type='l', xlab='Date', ylab='Standardized PC1')
> 
> 

-- 
Edzer Pebesma,  Co-Editor-in-Chief Computers & Geosciences
Institute for Geoinformatics (ifgi), University of Münster
Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
83 33081 http://ifgi.uni-muenster.de GPG key ID 0xAC227795

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20141027/86148ae8/attachment.bin>


More information about the R-sig-Geo mailing list