The StatisticEngine R6 class is a framework for performing statistical analysis on data.
Note
Note that only numeric values are accepted in data and the data column names are used as variable names and data row names are used as analyses names. The data is internally converted to StatisticAnalysis objects.
Note that the model must be created before prediction and data must have the same number of variables as the model. Also, any pre-processing applied to the model data should be applied to the data before prediction. Note that only numeric values are accepted in data and the data column names are used as variable names and data row names are used as analyses names.
Note that the classification must be prepared before using the method prepare_classification
and data
must have the same number of variables as the analyses in the engine.
Note that only the model MCR is valid for quantification and concentrations must be added to analyses.
Super class
StreamFind::CoreEngine
-> StatisticEngine
Active bindings
data
Matrix of the data, where rows represent analyses and columns variables.
model
Statistic model.
prediction_results
Prediction results from model.
classification_results
Classification results.
Methods
Inherited methods
StreamFind::CoreEngine$add_blank_names()
StreamFind::CoreEngine$add_headers()
StreamFind::CoreEngine$add_metadata()
StreamFind::CoreEngine$add_replicate_names()
StreamFind::CoreEngine$add_results()
StreamFind::CoreEngine$add_settings()
StreamFind::CoreEngine$export()
StreamFind::CoreEngine$export_analyses()
StreamFind::CoreEngine$export_headers()
StreamFind::CoreEngine$export_settings()
StreamFind::CoreEngine$get_analyses()
StreamFind::CoreEngine$get_analysis_names()
StreamFind::CoreEngine$get_blank_names()
StreamFind::CoreEngine$get_files()
StreamFind::CoreEngine$get_formats()
StreamFind::CoreEngine$get_headers()
StreamFind::CoreEngine$get_history()
StreamFind::CoreEngine$get_number_analyses()
StreamFind::CoreEngine$get_replicate_names()
StreamFind::CoreEngine$get_results()
StreamFind::CoreEngine$get_results_names()
StreamFind::CoreEngine$get_settings()
StreamFind::CoreEngine$get_settings_names()
StreamFind::CoreEngine$get_types()
StreamFind::CoreEngine$get_workflow_overview()
StreamFind::CoreEngine$has_analyses()
StreamFind::CoreEngine$has_results()
StreamFind::CoreEngine$has_settings()
StreamFind::CoreEngine$import()
StreamFind::CoreEngine$import_analyses()
StreamFind::CoreEngine$import_headers()
StreamFind::CoreEngine$import_settings()
StreamFind::CoreEngine$load()
StreamFind::CoreEngine$print()
StreamFind::CoreEngine$print_analyses()
StreamFind::CoreEngine$print_headers()
StreamFind::CoreEngine$print_results()
StreamFind::CoreEngine$print_workflow()
StreamFind::CoreEngine$process()
StreamFind::CoreEngine$remove_analyses()
StreamFind::CoreEngine$remove_headers()
StreamFind::CoreEngine$remove_results()
StreamFind::CoreEngine$remove_settings()
StreamFind::CoreEngine$run_app()
StreamFind::CoreEngine$run_workflow()
StreamFind::CoreEngine$save()
StreamFind::CoreEngine$subset_analyses()
Method new()
Creates an R6 class StatisticEngine. Child of CoreEngine R6 class.
Usage
StatisticEngine$new(
data = NULL,
headers = NULL,
settings = NULL,
analyses = NULL,
results = NULL
)
Arguments
data
Data.frame, data-table or matrix with data.
headers
A named list with headers or a ProjectHeaders S3 class object. Each list element must have length one. There is no type restrictions except for name (must be type character length 1), author (must be type character length 1), file (must be type character length 1) and date (must be class POSIXct or class POSIXt length 1). See more information in
?ProjectHeaders
.settings
A named list of ProcessingSettings objects or a single ProcessingSettings object. The list names should match the call name of each ProcessingSettings object. Alternatively, a named list with call name, algorithm and parameters to be transformed and added as ProcessingSettings object.
analyses
A numeric/character vector with the number/name of the analyses.
results
A named list of objects from processing methods.
Method add_analyses()
Adds analyses. Note that when adding new analyses, any existing results are removed.
Arguments
analyses
A StatisticAnalysis S3 class object or a list with StatisticAnalysis S3 class objects as elements (see
?StatisticAnalysis
for more information).
Method predict()
Predicts the data using the model.
Method plot_data()
Plots the raw data in analyses.
Method plot_model_explained_variance()
Plots the model explained cumulative variance.
Method plot_model_scores()
Plots scores of the model.
Usage
StatisticEngine$plot_model_scores(
analyses = NULL,
interactive = TRUE,
pcs = 1:2,
title = NULL,
showText = TRUE,
showLegend = TRUE
)
Arguments
analyses
A numeric/character vector with the number/name of the analyses.
interactive
Logical (length 1). When
TRUE
, the data is plotted interactively using plotly.pcs
A numeric vector (length 2) with the principle components to plot.
title
A string with the title.
showText
Logical (length 1), set to
TRUE
to show the text annotations.showLegend
Logical (length 1). Set to
TRUE
to show legend.
Method plot_model_residuals()
Plots residuals of the model.
Method plot_model_loadings()
Plots model loadings.
Usage
StatisticEngine$plot_model_loadings(
interactive = TRUE,
pcs = 1:2,
colorKey = NULL,
title = NULL,
showText = TRUE,
showLegend = TRUE
)
Arguments
interactive
Logical (length 1). When
TRUE
, the data is plotted interactively using plotly.pcs
A vector with the principle components to plot.
colorKey
A character vector with the color key for the loading variables.
title
A string with the title.
showText
Logical (length 1), set to
TRUE
to show the text annotations.showLegend
Logical (length 1). Set to
TRUE
to show legend.
Method plot_model_resolved_spectra()
Plots model resolved spectra.
Usage
StatisticEngine$plot_model_resolved_spectra(
interactive = TRUE,
pcs = NULL,
original = TRUE,
title = NULL,
showText = TRUE,
showLegend = TRUE
)
Arguments
interactive
Logical (length 1). When
TRUE
, the data is plotted interactively using plotly.pcs
Integer vectors with the principle component to use for categorization.
original
Logical, if TRUE the original data is plotted.
title
A string with the title.
showText
Logical (length 1), set to
TRUE
to show the text annotations.showLegend
Logical (length 1). Set to
TRUE
to show legend.
Method plot_model_contributions()
Plots model contributions.
Usage
StatisticEngine$plot_model_contributions(
interactive = TRUE,
pcs = NULL,
title = NULL,
showText = TRUE,
showLegend = TRUE
)
Arguments
interactive
Logical (length 1). When
TRUE
, the data is plotted interactively using plotly.pcs
Integer vectors with the principle component to use for categorization.
title
A string with the title.
showText
Logical (length 1), set to
TRUE
to show the text annotations.showLegend
Logical (length 1). Set to
TRUE
to show legend.
Method plot_predicted_distances()
Plots scores of the model.
Usage
StatisticEngine$plot_predicted_distances(
pc = NULL,
interactive = TRUE,
title = NULL,
showText = TRUE,
showLegend = TRUE
)
Arguments
pc
Integer (length 1) with the principle component to use for categorization.
interactive
Logical (length 1). When
TRUE
, the data is plotted interactively using plotly.title
A string with the title.
showText
Logical (length 1), set to
TRUE
to show the text annotations.showLegend
Logical (length 1). Set to
TRUE
to show legend.