The StatisticEngine R6 class is a framework for performing 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.
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::CoreEngine
-> StatisticEngine
Active bindings
data
Data object.
model
Statistic model.
quantification
Quantification results.
prediction_results
Prediction results.
classification_results
Classification results.
Methods
Inherited methods
StreamFind::CoreEngine$export_analyses()
StreamFind::CoreEngine$export_headers()
StreamFind::CoreEngine$export_workflow()
StreamFind::CoreEngine$has_analyses()
StreamFind::CoreEngine$has_results()
StreamFind::CoreEngine$has_settings()
StreamFind::CoreEngine$import_analyses()
StreamFind::CoreEngine$import_headers()
StreamFind::CoreEngine$import_workflow()
StreamFind::CoreEngine$load()
StreamFind::CoreEngine$print()
StreamFind::CoreEngine$print_analyses()
StreamFind::CoreEngine$print_headers()
StreamFind::CoreEngine$print_workflow()
StreamFind::CoreEngine$run()
StreamFind::CoreEngine$run_app()
StreamFind::CoreEngine$run_workflow()
StreamFind::CoreEngine$save()
Method new()
Creates an R6 class StatisticEngine. Child of CoreEngine R6 class.
Usage
StatisticEngine$new(
file = NULL,
headers = NULL,
workflow = NULL,
analyses = NULL
)
Arguments
file
Character of length one with the full path to the
sqlite
/rds
save file of the engine.headers
A
ProjectHeaders
S7 class object.workflow
A
Workflow
S7 class object.analyses
A
StatisticAnalyses
S7 class object or acharacter vector
with full file path to.csv
file with variable names as first row and analyses names as first column or adata.frame
ormatrix
object.
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
)
Arguments
analyses
A numeric/character vector with the number/name of the analyses.
features
A numeric vector with the features (columns of data matrix) to plot.
transpose
Logical, if TRUE the data is transposed (i.e., column names are used as legend).
interactive
Logical (length 1). When
TRUE
, the data is plotted interactively using plotly.xLab
A string with the title for the x axis.
yLab
A string with the title for the y axis.
title
A string with the title.
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
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.
colorGroups
A factor character vector with the color groups for the scores.
showText
Logical (length 1), set to
TRUE
to show the text annotations.showLegend
Logical (length 1). Set to
TRUE
to show legend.
Method plot_residuals()
Plots residuals of the model.
Method plot_loadings()
Plots model loadings.
Usage
StatisticEngine$plot_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_resolved_spectra()
Plots model resolved spectra.
Usage
StatisticEngine$plot_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_contributions()
Plots model contributions.
Usage
StatisticEngine$plot_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.