gmGeostats (version 0.10-6)

Maf: Generalised diagonalisations Calculate several generalized diagonalisations out of a data set and its empirical variogram

Description

Generalised diagonalisations Calculate several generalized diagonalisations out of a data set and its empirical variogram

Usage

Maf(x, ...)

# S3 method for data.frame Maf(x, vg, i = 2, ...)

# S3 method for rmult Maf(x, vg, i = 2, ...)

# S3 method for aplus Maf(x, vg, i = 2, ...)

# S3 method for rplus Maf(x, vg, i = 2, ...)

# S3 method for ccomp Maf(x, vg, i = 2, ...)

# S3 method for rcomp Maf(x, vg, i = 2, ...)

# S3 method for acomp Maf(x, vg, i = 2, ...)

UWEDGE(x, ...)

# S3 method for default UWEDGE(x, ...)

# S3 method for acomp UWEDGE(x, vg, i = NULL, ...)

# S3 method for rcomp UWEDGE(x, vg, i = NULL, ...)

RJD(x, ...)

# S3 method for default RJD(x, ...)

# S3 method for acomp RJD(x, vg, i = NULL, ...)

# S3 method for rcomp RJD(x, vg, i = NULL, ...)

Arguments

x

a data set, typically of class "data.frame" or of a compositional class

...

generic functionality arguments

vg

empirical variogram, of a kind fitting to the data provided

i

a slicer for the variogram, typically this will be one or more indices of the lag distance to take. %For other options see codegetEmpVariogramSlice.

Value

An object extending c("princomp.CLASSOF(x)","princomp") with classes "genDiag", and an extra class argument depending on the diagonalisation method chosen.

Function Maf results carry the extra class "maf", and they correspond to minimum/maximum autocorrelation factors (MAF) as proposed by Switzer and Green (XXXX) or XXXXX (XXXX). In this case, the slicer is typically just the index of one lag distance (defaults to i=2). MAF provides the analytical solution to the joint diagonalisation of two matrices, the covariance of increments provided by the slicing and the conventional covariance matrix (of the idt transformed values, if appropriate). Resulting factors are ordered in decreasing order of spatial continuity, which might produce surprising scree-plots for those who are used to see a screeplot of a principal component analysis.

Function UWEDGE (Uniformly Weighted Exhaustive Diagonalization with Gauss iterations) results carry the extra class "uwedge". The function is a wrapper on jointDiag::uwedge from package jointDiag. In this case the slicer is typically just a subset of indices of lag distances to consider (defaults to the nearest indexes to mininum, maximum and mean lag distances of the variogram). UWEDGE iteratively seeks for a pair of matrices (a mixing and a demixing matrices) diagonalises the set of matrices \(M_1, M_2, \ldots, M_K\) given, by minimizing the target quantity $$Q_{uwedge}(A, W) = \sum_{k=1}^K Tr[E_k^t\cdot E_k],$$ where \(E_k = (W^t\cdot M_k \cdot W- A\cdot \Lambda_k\cdot A^t)\) and \(\Lambda_k = diag(W^t\cdot M_k \cdot W)\) is the resulting diagonalized version of each matrix. Obtained factors are ordered in decreasing order of spatial continuity, which might produce surprising scree-plots for those who are used to see a screeplot of a principal component analysis.

Function RJD results carry the extra class "rjd". The function is a wrapper on JADE::rjd, implementing the Rotational joint diagonalisation method . In this case the slicer is typically just a subset of indices of lag distances to consider (defaults to the nearest indexes to mininum, maximum and mean lag distances). This algorithm also served for quasi-diagonalising a set of matrices as in UWEDGE, just that in this case the quantity to minimise is the sum of sequares of all off-diagonal elements of \(A^t\cdot M_k\cdot A\) for all \(k=1, 2, \ldots K\).

All these functions produce output mimicking princomp, i.e. with elements

sdev

contrary to the output in PCA, this contains the square root of the metric variance of the predictions obtained for each individual factor; this is the quantity needed for screeplot to create plots of explained variance by factor

loadings

matrix of contributions of each (cdt-transformed) original variable to the new factors

center

center of the data set (eventually, represented through cdt), in compositional methods

scale

the scalings applied to each original variable

n.obs

number of observations

scores

the scores of the supplied data on the new factors

call

the call to the function (attention: it actually may come much later)

and additionally some of the following arguments, in different order

invLoadings

matrix of contributions of each factor onto each original variable

Center

compositional methods return here the cdt-backtransformed center

InvLoadings

compositional methods return here the clr-backtransformed inverse loadings, so that each column of this matrix can be understood as a composition on itself

DownInvLoadings

compositional methods return here the clr-backtransformed "minus inverse loadings", so that each column of this matrix can be understood as a composition on itself; details in princomp.acomp

C1, C2

Maf returns the two matrices that were diagonalised

eigenvalues

Maf returns the generalized eigenvalues of the diagonalisation of C1 and C2

gof

UWEDGE returns the values of the goodness of fit criterion across sweeps

diagonalized

RJD returns the diagonalized matrices, in an array of (K,D,D)-dimensions, being D the number of variables in x

type

a string describing which package and which function was used as a workhorse for the calculation

NOTE: if the arguments you provide to RJD and UWEDGE are not of the appropriate type (i.e. data.frames or equivalent) the default method of these functions will just attempt to call the basis functions JADE:rjd and JointDiag:uwedge respectively. This will be the case if you provide x as a "matrix", or as an "array". In those cases, the output will NOT be structured as an extension to princomp results; instead they will be native output from those functions.

Functions

  • Maf: Generalised diagonalisations

  • Maf.rmult: Generalised diagonalisations

  • Maf.aplus: Generalised diagonalisations

  • Maf.rplus: Generalised diagonalisations

  • Maf.ccomp: Generalised diagonalisations

  • Maf.rcomp: Generalised diagonalisations

  • Maf.acomp: Generalised diagonalisations

  • UWEDGE: Generalised diagonalisations

  • UWEDGE.default: Generalised diagonalisations

  • UWEDGE.acomp: Generalised diagonalisations

  • UWEDGE.rcomp: Generalised diagonalisations

  • RJD: Generalised diagonalisations

  • RJD.default: Generalised diagonalisations

  • RJD.acomp: Generalised diagonalisations

  • RJD.rcomp: Generalised diagonalisations

See Also

Other generalised Diagonalisations: coloredBiplot.genDiag(), predict.genDiag()

Examples

Run this code
# NOT RUN {
require("magrittr")
require("gstat")
require("compositions")
data("jura", package="gstat")
gs = gstat(id="Cd", formula=log(Cd)~1, locations=~Xloc+Yloc, data=jura.pred) %>% 
gstat(id="Co", formula=log(Cd)~1, locations=~Xloc+Yloc, data=jura.pred) %>% 
gstat(id="Cr", formula=log(Cr)~1, locations=~Xloc+Yloc, data=jura.pred) %>% 
gstat(id="Cu", formula=log(Cu)~1, locations=~Xloc+Yloc, data=jura.pred) %>% 
gstat(id="Ni", formula=log(Ni)~1, locations=~Xloc+Yloc, data=jura.pred) %>% 
gstat(id="Pb", formula=log(Pb)~1, locations=~Xloc+Yloc, data=jura.pred) %>% 
gstat(id="Zn", formula=log(Zn)~1, locations=~Xloc+Yloc, data=jura.pred)
vg = variogram(gs)
mf = Maf(aplus(jura.pred[, -(1:6)]), vg=vg)
mf
mf$loadings
biplot(mf)
# }

Run the code above in your browser using DataLab