Engine dedicated to statistical analysis
Source:R/class_Engine_StatisticEngine.R
StatisticEngine.RdThe StatisticEngine R6 class is a framework for managing statistical analysis on data. Data can be added as a character vector with a path to a csv file with variable names as first row and analyses names as first column or a data.frame or matrix object, where the row names are used as analyses names and the column names are used as variable names.
Note
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 model must be created before testing 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 testing. 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.
Super class
StreamFind::Engine -> StatisticEngine
Active bindings
dataData object.
modelStatistic model.
quantificationQuantification results.
prediction_resultsPrediction results.
classification_resultsClassification results.
Methods
Inherited methods
StreamFind::Engine$clear_cache()StreamFind::Engine$clear_results()StreamFind::Engine$get_cache_info()StreamFind::Engine$get_cache_size()StreamFind::Engine$has_analyses()StreamFind::Engine$has_results()StreamFind::Engine$load()StreamFind::Engine$print()StreamFind::Engine$run()StreamFind::Engine$run_app()StreamFind::Engine$run_workflow()StreamFind::Engine$save()
Method new()
Creates an R6 class StatisticEngine. Child of CoreEngine R6 class.
Usage
StatisticEngine$new(metadata = NULL, workflow = NULL, analyses = NULL)Arguments
metadataA named list or a
Metadataobject. Each list element must have length one. There is no type restrictions except for name (must be type character), author (must be type character) and date (must be class POSIXct or POSIXt). A file entry must be a character string with a full path to a file.workflowA
Workflowobject, a list ofProcessingStepobjects or a character string with a full path to a rds or json file containing aWorkflow.analysesA
StatisticAnalysesclass object or acharacter vectorwith full file path to.csvfile with variable names as first row and analyses names as first column or adata.frameormatrixobject, where the row names are used as analyses names and the column names are used as variable names.
Method add_analyses()
Adds analyses. Note that when adding new analyses, any existing results are removed. Note that the data must have the same number and names of variables (i.e., columns) as the model.
Method remove_analyses()
Removes analyses.
Method predict()
Predicts the data using the model.
Method plot_data()
Plots the data.
Usage
StatisticEngine$plot_data(
analyses = NULL,
features = NULL,
transpose = FALSE,
interactive = TRUE,
xLab = NULL,
yLab = NULL,
title = NULL,
colorGroups = NULL,
xTickLabelsShow = TRUE
)Arguments
analysesCharacter or numeric vector with names or indexes of analyses in the
Analysesobject.featuresA numeric vector with the features (columns of data matrix) to plot.
transposeLogical, if TRUE the data is transposed (i.e., column names are used as legend).
interactiveLogical (length 1). When
TRUE, the data is plotted interactively using plotly.xLabA string with the title for the x axis.
yLabA string with the title for the y axis.
titleA string with the title.
colorGroupsA factor character vector with the color groups for the data.
xTickLabelsShowLogical, if TRUE the x-axis tick labels are shown.
Method plot_explained_variance()
Plots the model explained cumulative variance.
Method plot_scores()
Plots scores of the model.
Usage
StatisticEngine$plot_scores(
analyses = NULL,
interactive = TRUE,
pcs = 1:2,
title = NULL,
colorGroups = NULL,
showText = TRUE,
showLegend = TRUE
)Arguments
analysesCharacter or numeric vector with names or indexes of analyses in the
Analysesobject.interactiveLogical (length 1). When
TRUE, the data is plotted interactively using plotly.pcsA numeric vector (length 2) with the principle components to plot.
titleA string with the title.
colorGroupsA factor character vector with the color groups for the scores.
showTextLogical (length 1), set to
TRUEto show the text annotations.showLegendLogical (length 1). Set to
TRUEto show legend.
Method plot_residuals()
Plots residuals of the model.
Usage
StatisticEngine$plot_residuals(
analyses = NULL,
interactive = TRUE,
xLab = NULL,
yLab = NULL,
title = NULL
)Arguments
analysesCharacter or numeric vector with names or indexes of analyses in the
Analysesobject.interactiveLogical (length 1). When
TRUE, the data is plotted interactively using plotly.xLabA string with the title for the x axis.
yLabA string with the title for the y axis.
titleA string with the title.
Method plot_loadings()
Plots model loadings.
Usage
StatisticEngine$plot_loadings(
interactive = TRUE,
pcs = 1:2,
colorKey = NULL,
title = NULL,
showText = TRUE,
showLegend = TRUE
)Arguments
interactiveLogical (length 1). When
TRUE, the data is plotted interactively using plotly.pcsA vector with the principle components to plot.
colorKeyA character vector with the color key for the loading variables.
titleA string with the title.
showTextLogical (length 1), set to
TRUEto show the text annotations.showLegendLogical (length 1). Set to
TRUEto show legend.
Method plot_resolved_spectra()
Plots model resolved spectra.
Usage
StatisticEngine$plot_resolved_spectra(
interactive = TRUE,
pcs = NULL,
original = TRUE,
title = NULL,
showText = TRUE,
showLegend = TRUE
)Arguments
interactiveLogical (length 1). When
TRUE, the data is plotted interactively using plotly.pcsInteger vectors with the principle component to use for categorization.
originalLogical, if TRUE the original data is plotted.
titleA string with the title.
showTextLogical (length 1), set to
TRUEto show the text annotations.showLegendLogical (length 1). Set to
TRUEto show legend.
Method plot_contributions()
Plots model contributions.
Usage
StatisticEngine$plot_contributions(
interactive = TRUE,
pcs = NULL,
title = NULL,
showText = TRUE,
showLegend = TRUE
)Arguments
interactiveLogical (length 1). When
TRUE, the data is plotted interactively using plotly.pcsInteger vectors with the principle component to use for categorization.
titleA string with the title.
showTextLogical (length 1), set to
TRUEto show the text annotations.showLegendLogical (length 1). Set to
TRUEto show legend.