do_blowup: Increase the Numbers of Observation in Dataset

View source: R/gen_coreDataManip.r

do_blowupR Documentation

Increase the Numbers of Observation in Dataset

Description

Use random observations of the provided dataset (within a possible grouping), calculate their average and add the resulting spectrum as new observation to the dataset.

Usage

do_blowup(
  dataset,
  grp = NULL,
  tn = "x10",
  an = "100%",
  cst = TRUE,
  conf = TRUE,
  pred = TRUE,
  replace = TRUE
)

Arguments

dataset

An object of class 'aquap_data' as produced e.g. by gfd.

grp

Character. One ore more valid class-variable names that should be used to from subgroups within the dataset. Similar to the spl.var argument in the analysis procedure.

tn

Numeric or character length one. If numeric, tn is denoting the target-number, i.e. the desired number of observations in the expanded dataset. If a grouping is provided via grp, the target number is defining the desired number of observations within each subgroup obtained by the grouping. If tn is a character it hast to be in the format xN, with N being a positive integer. In this case it means an N-fold increase of the dataset resp. of each subgroup as defined by the grouping in grp. Defaults to x10.

an

Numeric or character length one. If numeric, an is denoting the "average-number", i.e. the number of observations resp. their spectra that should be drawn (with replacement) from the dataset resp. from the respective subgroup. These drawn samples then are averaged together into a new spectrum. If an is a character it has to be in the format N%, with N being a positive integer. In this case it denotes the percentage of observations in the dataset resp. in each of the subgroups possibly obtained via grp that should be drawn (with replacement) and averaged together into a new observation. Defaults to 100%, what is the recommended value.

cst

Logical. If consecutive scans should always be kept together. NOT YET IMPLEMENTED - value is ignored, and consec. scans are NOT kept together.

conf

Logical. If numbers should be presented and confirmation requested before commencing the actual calculations.

pred

Logical. If an estimation of the number of identical spectra should be made. Only presented if conf is TRUE.

replace

Logical. If the sample drawing should be done with replacement. Recommended value is TRUE.

Details

The random observations are sampled with replacement. The provenience of each observation is marked in an additional column in the header named 'blowup', where the character 'orig' denotes an original observation, while the character 'artif' is marking an artificially generated observation.

Value

The dataset with increased numbers of observations.

Warning

Do take care of a correct grouping, otherwise the inclusion of observations into the same group that do not belong together will destroy any information.

See Also

Other Data pre-treatment functions: [,aquap_data-method, do_addNoise(), do_avg(), do_detrend(), do_emsc(), do_gapDer(), do_msc(), do_resampleNIR(), do_sgolay(), dpt_modules, selectWls(), ssc()

Examples

## Not run: 
fd <- gfd()
fdPlus <- do_blowup(fd, tn="x4", an=4)
fdPlus <- do_blowup(fd, tn="x8", an="10%", grp=c("C_Foo", "C_Bar")) 
fdPlus <- do_blowup(fd, tn=1000, an=5)

## End(Not run)

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