Last data update: 2014.03.03

R: Function to mix sample spectres.
mix.EMR Documentation

Function to mix sample spectres.

Description

This functions allows to mix grain-size distributions with specified proportions and defined noise levels, for example to test the goodness of the EMMA algorithm.

Usage

mix.EM(EM, proportion, noise, autocorrelation)

Arguments

EM

Numeric matrix containing the grain-size distribution definitions. Each definition is in a separate row with variable contributions in columns.

proportion

Numeric vector containing the relative proportions of each distribution per sample.

noise

Numeric scalar containing optional relative white noise levels.

autocorrelation

Numeric scalar specifying the degree of autocorrelation among classes. Autocorrelation is realised as running mean of the specified length. Only odd values are allowed.

Details

The function multiplies each end-member with the respective proportion value, sums the resulting variables, adds uniform noise and normalises the resulting mixed sample to 100 %.

Value

Numeric vector comprising a sample composed of known proportions of end-members.

Author(s)

Michael Dietze, Elisabeth Dietze

See Also

create.EM

Examples

## define end-member loadings and phi vector
EMa.1 <- create.EM(p1 = c(2, 8), p2 = c(1, 0.8), s = c(0.7, 0.3),
                   boundaries = c(0, 11), n = 80)
EMa.2 <- create.EM(p1 = c(4, 7), p2 = c(1.1, 1.4), s = c(0.5, 0.5),
                   boundaries = c(0, 11), n = 80)
EMa   <- rbind(EMa.1, EMa.2)

phi   <- seq(0, 11, length.out = 80)

## mix end-member loadings
sample1 <- mix.EM(EMa, proportion = c(0.3, 0.7))
sample2 <- mix.EM(EMa, proportion = c(0.5, 0.5), noise = 0.1,
                  autocorrelation = 3)

## plot end-member loadings (grey) and resulting samples (black)
plot(phi, EMa.1, type="l", col = "grey")
lines(phi, EMa.2, col = "grey")
lines(phi, sample1)
lines(phi, sample2)

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/mix.EM.Rd_%03d_medium.png", width=480, height=480)
> ### Name: mix.EM
> ### Title: Function to mix sample spectres.
> ### Aliases: mix.EM
> ### Keywords: EMMA
> 
> ### ** Examples
> 
> ## define end-member loadings and phi vector
> EMa.1 <- create.EM(p1 = c(2, 8), p2 = c(1, 0.8), s = c(0.7, 0.3),
+                    boundaries = c(0, 11), n = 80)
> EMa.2 <- create.EM(p1 = c(4, 7), p2 = c(1.1, 1.4), s = c(0.5, 0.5),
+                    boundaries = c(0, 11), n = 80)
> EMa   <- rbind(EMa.1, EMa.2)
> 
> phi   <- seq(0, 11, length.out = 80)
> 
> ## mix end-member loadings
> sample1 <- mix.EM(EMa, proportion = c(0.3, 0.7))
> sample2 <- mix.EM(EMa, proportion = c(0.5, 0.5), noise = 0.1,
+                   autocorrelation = 3)
> 
> ## plot end-member loadings (grey) and resulting samples (black)
> plot(phi, EMa.1, type="l", col = "grey")
> lines(phi, EMa.2, col = "grey")
> lines(phi, sample1)
> lines(phi, sample2)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>