R: Function to evaluate influence of model parameters.
test.parameters
R Documentation
Function to evaluate influence of model parameters.
Description
All possible combinations of number of end-members and weight transformation
limits are used to perform EMMA. The function returns matrices of absolute
and relative measures of individual model performance.
Usage
test.parameters(X, q, l = 0, c = 100, rotation = "Varimax",
plot = FALSE, legend, progressbar = FALSE, multicore = FALSE, ...,
pm = FALSE)
Arguments
X
Numeric matrix with m samples (rows) and n variables (columns).
q
Numeric vector of length two, specifying the minimum and maximum
number of end-members to be modelled.
l
Numeric vector specifying the weight tranformation limit, i.e.
quantile; default is 0.
c
Numeric scalar specifying the constant sum scaling parameter, e.g.
1, 100, 1000; default is 0.
rotation
Character scalar, rotation type, default is "Varimax" (cf.
Dietze et al., 2012). One out of the rotations provided in GPArotation is
possible (cf. rotations).
plot
Character scalar, optional graphical output of the results.
Specify which tested parameter will be plotted: "mEm" (mean absolute
row-wise error), "mEn" (mean absolute column-wise error), "mRm" (mean
relative row-wise error), "mRn" (mean relative column-wise error), "mRt"
(mean relative total error), "ol" (number of overlapping end-members). All
plots except "ol" are colour-coded bitmaps of q, l and the specified test
parameter and line-plots the specified parameter vs. q.
legend
Character scalar, specifying legend position (cf.
legend). If omitted, no legend will be plotted, default is no
legend.
progressbar
Logical scalar, optionally show a progress bar, default
is FALSE. Only available if option multicore is not used.
multicore
Logical scalar, optionally ditribute calculations to all
available cores of the computer, default is TRUE.
pm
Logical scalar to enable pm.
...
Additional arguments passed to the plot function. Since the
function returns two plots (except for plot option "ol"), additional
graphical parameters must be specified as vector with the first element for
the first plot and the second element for the second plot. If graphical
parameters are natively vectors (e.g. a sequence of colours), they must be
specified as matrices with each vector as a row. A legend can only be added
to the second plot. Colours only apply to the second plot as well. If
colours are specified, colour should be used instead of col.
See example section for further advice.
Details
The mean total explained variance mRt may be used to define a maximum number
of meaningful end-members for subsequent modelling, e.g. as the number of
end-members, which reaches the first local mRt maximum.
Overlapping is
defined as one end-member having its mode within the "area" of any other
end-member, which is genetically not explainable.
Special
acknowledgements go to Christoph Burow for his efforts to implement the
multicore functionality to this function.
Value
A list with result objects
mEm
Absolute row-wise model
error.
mEn
Absolute column-wise model error.
mRm
Mean
row-wise explained variance.
mRn
Mean column-wise explained
variance.
mRt
Mean total explained variance.
ol
Number of
overlapping end-member loadings.
q.max
Maximum number of meaningful
end-members.
Author(s)
Michael Dietze, Elisabeth Dietze
References
Dietze E, Hartmann K, Diekmann B, IJmker J, Lehmkuhl F, Opitz S,
Stauch G, Wuennemann B, Borchers A. 2012. An end-member algorithm for
deciphering modern detrital processes from lake sediments of Lake Donggi
Cona, NE Tibetan Plateau, China. Sedimentary Geology 243-244: 169-180.
See Also
EMMA
Examples
## load example data set
data(X, envir = environment())
## truncate the data set for faster computation
X.trunc <- X[1:20,]
## define test parameters
q <- 2:8 # number of end-members
l <- seq(from = 0, to = 0.3, by = 0.1)
## test parameter influence and plot mean total explained variance
TP <- test.parameters(X = X.trunc, q = q, l = l, plot = "mRt",
legend = "bottomright", cex = 0.7,
multicore = FALSE,
colour = rgb((1:7) / 7, 0.9, 0.2, 1))
## show maximum number of end-members
TP$q.max
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(EMMAgeo)
Loading required package: GPArotation
Loading required package: limSolve
Loading required package: shape
Loading required package: shiny
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/EMMAgeo/test.parameters.Rd_%03d_medium.png", width=480, height=480)
> ### Name: test.parameters
> ### Title: Function to evaluate influence of model parameters.
> ### Aliases: test.parameters
> ### Keywords: EMMA
>
> ### ** Examples
>
> ## load example data set
> data(X, envir = environment())
>
> ## truncate the data set for faster computation
> X.trunc <- X[1:20,]
>
> ## define test parameters
> q <- 2:8 # number of end-members
> l <- seq(from = 0, to = 0.3, by = 0.1)
>
> ## test parameter influence and plot mean total explained variance
> TP <- test.parameters(X = X.trunc, q = q, l = l, plot = "mRt",
+ legend = "bottomright", cex = 0.7,
+ multicore = FALSE,
+ colour = rgb((1:7) / 7, 0.9, 0.2, 1))
>
> ## show maximum number of end-members
> TP$q.max
[1] 5 4 5 4
>
>
>
>
>
> dev.off()
null device
1
>