getcm: Get a single model from the 'cube'

View source: R/gen_general.r

getcmR Documentation

Get a single model from the 'cube'

Description

Get a single model, referenced by its index and specified by the argument what from the 'cube' object, i.e. the object generated by gdmm.

Usage

getcm(cube, index, what = "pca")

Arguments

cube

An object as created by gdmm.

index

The index of the dataset to be obtained. See the leftmost rowname of the 'cube' object.

what

Character length one, see details.

Details

The default for what is "pca. Provide any of 'pca', 'simca', 'plsr', 'aquagr' to obtain its corresponding model. Possible values for what are:

pca

Gives the back the pca-model of the selected dataset from the cube

simca

Gives back the simca-model of the selected dataset from the cube

plsr

Gives back the plsr-model of the selected dataset from the cube

Extracting Vectors

To extract e.g. two loading vectors from a pca-model, you could use a code like loadingVectors <- pcaModel$loadings$[, c(1,2)] to extract the first two loading vectors from the model - see examples.

See Also

do_emsc, dpt_modules

Other Helper Functions: ap2_settings_setup(), ap2dme(), export_ap2_ToXlsx(), export_header_toXls(), genFolderStr(), genNoiseRecExp(), genTempCalibExp(), getcd(), getstn(), printStdColnames(), reColor(), saveAQdata(), siWlg(), updateSettings()

Other Extract Elements: getHeader(), getWavelengths,aquap_data-method, getcd(), siWl(), siWlg()

Examples

## Not run: 
fd <- gfd()
cube <- gdmm(fd)
# assumes that in the analysis procedure we have a split variable defined.
fd_3_pca <- getcm(cube, 3)
str(fd_3_pca)
ld12 <- fd_3_pca$model$loadings[, c(1,2)] # extract the first two loadings
ld24 <- fd_3_pca$model$loadings[, c(2,4)] # extract loadings 2 and 4
fd_2_pls <- getcm(cube, 2, "pls")
str(fd_2_pls)

## End(Not run)

bpollner/aquap2 documentation built on March 29, 2024, 7:33 a.m.