Package 'MethodOpt'

Title: Advanced Method Optimization for Spectra-Generating Sampling and Analysis Instrumentation
Description: A graphical user interface to apply an advanced method optimization algorithm to various sampling and analysis instruments. This includes generating experimental designs, uploading and viewing data, and performing various analyses to determine the optimal method. Details of the techniques used in this package are published in Gamble, Granger, & Mannion (2024) <doi:10.1021/acs.analchem.3c05763>.
Authors: Benjamin Luke [aut], Stephanie Gamble [aut, cre], Battelle Savannah River Alliance [cph]
Maintainer: Stephanie Gamble <[email protected]>
License: GPL (>= 3)
Version: 1.0.0
Built: 2024-11-19 06:30:11 UTC
Source: CRAN

Help Index


Computes ANOVA test

Description

Runs an ANOVA test for any variables that were selected by the user.

Usage

anovaben(objectives, data, ffd, obj_results, alpha)

Arguments

objectives

User selected objectives.

data

Peak information (all times, heights, etc.).

ffd

Fractional factorial design

obj_results

Calculated objectives.

alpha

Alpha value.

Value

list containing the results of ANOVA on the data from the FFD (including p-values and which parameters are significant), the suggested changes to add a level for a BBD, suggested values for the BBD, row indices for the results, and the data frame of the FFD with objective results included


Computes areas of peaks

Description

Computes the areas beneath the specified maxima.

Usage

area(data, hts, tms)

Arguments

data

dataframe of time versus intensity.

hts

heights of peaks in chronological order.

tms

time locations of peaks in chronological order.

Value

area for each peak


Baseline correction

Description

Generates the baseline of the spectra, interpolates between points, and subtracts from the intensity to generate corrected baseline.

Usage

blc(frame, noise = 10^5, subtract = NULL)

Arguments

frame

data frame of time versus intensity.

noise

strength of the baseline subtraction.

subtract

how much intensity to initially subtract.

Value

data frame of of data that has been baseline corrected


Generate a Gaussian fit

Description

Generate a Gaussian fit with given parameters.

Usage

gauss(a, b, c, t)

Arguments

a

amplitute.

b

phase shift.

c

standard deviation.

t

time at which to fit.

Value

value of Gaussian function


Method optimization GUI

Description

'MethodOpt()' runs the GUI.

Usage

MethodOpt()

Details

No arguments are needed to initiate the GUI. 'MethodOpt()' is split into three main tabs.

Value

No return value, opens and runs the GUI

Fractional factorial design

The first step in method optimization is to build an experimental design. Hence, the first tab of the GUI is dedicated to designing a fractional factorial experimental design. Parameters are input with their corresponding low and high values. Pressing "Generate FFD" will yield the experimental design. The user will run experiments according to each method.

ANOVA

The second step in method optimization is to run an ANOVA test. This is carried out under the "Analysis" tab. Raw experimental screening data is uploaded, and the spectra can be viewed. In subtabs, the spectra peaks must be identified (either by an uploaded retention time file or by a built-in identification algorithm), objectives must be selected, and the initial experimental design must be uploaded; then the ANOVA test may be run. Statistically significant parameters are indicated.

Box-Behnken design

The third step is to generate a three-level Box-Behnken experimental design with the significant parameters. Low, middle, and high values are input with their corresponding parameters. The design can be generated by pressing "Generate BBD."

Optimization

The final step is to run the optimization with the results of the Box-Behnken design. Similarly to the second step, raw data is uploaded in the "Analysis" tab. Spectra peaks must be identified, objectives must be selected, and the experimental design must be uploaded; then the optimal values can be calculated.

Examples

# Please see the vignette for the MethodOpt package for a full example of how
# to use the GUI launched by MethodOpt::MethodOpt().

Optimization algorithm

Description

Calculate the optimal parameter values for given objectives.

Usage

opt(objectives, bbd, results, lim_fac, valid_range_data)

Arguments

objectives

objectives input by user.

bbd

Box-Behnken design.

results

objective results.

lim_fac

limiting factors.

valid_range_data

ranges of validity corresponding to the limiting factors.

Value

a list containing the parameters which cannot be set to the unbounded solution, the maximum value of the objectives, and the unbounded parameter solutions


Peak searching algorithm without retention times

Description

Returns the maxima, the times they occur at, the index location of the maxima, and the next viable peaks with times after the first 'keep'.

Usage

peaks(
  data,
  begin_search = NULL,
  end_search = NULL,
  keep = 11,
  precision = 15,
  factor = 10,
  bl_noise = 0
)

Arguments

data

time versus intensity dataframe.

begin_search

time at which to start the search for the peaks.

end_search

time at which to stop the search for the peaks.

keep

a whole number indicating how many peaks to search for and return.

precision

an integer indicating the size of the window for searching for local maxima.

factor

constant of proportionality indicating the cutoff peak height (i.e., peaks greater than 'factor' times height are not returned as viable peaks).

bl_noise

constant level at which response should be considered as noise.

Value

list containing spectra maxima,the times they occur at, the index location of the maxima, and the the same info for the next viable peaks with times after the first 'keep'.


peak calculations with retention times

Description

Locate the maxima of the peaks corresponding to the retention times.

Usage

peaks_rts(raw_data, retention_times, rt_index, bl_noise = 0)

Arguments

raw_data

time versus intensity dataframe.

retention_times

retention time file.

rt_index

which method to evaluate for.

bl_noise

constant level at which response should be considered as noise.

Value

list containing the peaks' heights, times where they occur, the full data TIC, full time index, and the peaks' widths


Calculate widths

Description

Calculate the widths (standard deviation) for each identified peak.

Usage

widths(data, hts, tms)

Arguments

data

time versus intensity dataframe.

hts

heights of peaks.

tms

times of peaks.

Value

width for each peak