Simulation of spectroscopic data: Loadings (spectra of spectroscopic components), Scores (amplitudes of these components) an Spectra (mixture of the spectroscopic components multiplied by the amplitudes with random noise added).

simSpectra(
  x = 300:800,
  nGr = 2,
  nInGr = c(50, 50, 50),
  N = sum(nInGr),
  nDim = 4,
  w.possile = 5:150,
  plots = FALSE
)

Arguments

x

Values for x axis ("wavelengths").

nGr

Number of groups.

nInGr

Number of samples in a group (vector of values for each group).

N

Total number of samples.

nDim

Number of spectral components (dimensions).

w.possile

A vector of possible values of Gaussian curve parameter "w' (i.e., width). Values of w will be randomly sampled from this vector.

plots

Logical. If TRUE - makes plots. Default is FALSE.

Value

List of hyperSpec objects:

Spectra

Spectra of each observation, made of (Scores * Loadings) + NOISE.

Loadings

Normalized spectra of components.

Scores

Amplitudes of components for each observation.

In the list the hyperSpec objects contain spectroscopic data and additional variables.

Additional variables for Spectra and Scores:

class

A factor variable for classification.

gr

A factor variable for other type classification.

Additional variables for Loadings:

PeakAt

Position of components top peak.

cNames

Names of components.

order.of.rows

Original order of components before sorting.

Details

[This function works, but is not well documented yet.]

Author

Vilmantas Gegzna

Examples


simSpectra()
#> $Spectra
#> hyperSpec object
#>    150 spectra
#>    3 data columns
#>    501 data points / spectrum
#> 
#> $Loadings
#> hyperSpec object
#>    4 spectra
#>    4 data columns
#>    501 data points / spectrum
#> 
#> $Scores
#> hyperSpec object
#>    150 spectra
#>    3 data columns
#>    4 data points / spectrum
#> 

simSpectra()$Spectra
#> hyperSpec object
#>    150 spectra
#>    3 data columns
#>    501 data points / spectrum