The object builds the ALASCA model and contains the data
df
Data table/frame. The data to analyze
formula
An AlascaForula object
wide
Boolean. Whether the provided data is in wide format
scale_function
How to scale the data. Options are NULL
, custom function, or "sdall"
, "sdref"
, "sdt1"
, "sdreft1"
ignore_missing
If TRUE, ignore missing predictive values
ignore_missing_covars
If TRUE, ignore missing covariate values
version
Version number
update_date
Date of latest update
separate_effects
If TRUE, try to separate the effects
equal_baseline
If TRUE, remove interaction between baselines
effect_list
List. Contains info related to the effects
n_validation_folds
Integer. If using jack-knife validation, exclude 1/n_validation_folds of the participants at each iteration
n_validation_runs
Integer. Number of iterations to use for validation
validation_quantile_method
Integer between 1 and 9. See stats::quantile()
for details
save_validation_ids
If TRUE, save the participants in each validation iteration to a csv file
optimize_score
If TRUE, test all combinations of signs for the most important loadings, and choose the combination being the best fit
validate
If TRUE, validate the model
validate_regression
If TRUE, validate get marginal means
validation
Boolean. Synonym to validate
validation_method
String. Defines the validation method; "bootstrap"
(default) or "jack-knife"
validation_ids
A data frame where each row contains the ids for one validation iteration
validation_assign_new_ids
Logical. Assign new IDs during validation. Must be TRUE
for reduce_dimensions to work
limitsCI
Lower and upper quantile to use for validation
compress_validation
Integer between 0 and 100. See fst::write_fst()
for details
reduce_dimensions
Boolean. Use PCA to reduce data dimensions prior to analysis
pca_function
String or custom function. Which pca function to use for dimension reduction, either "prcomp" or "irlba" or "princomp" or custom function
save_to_disk
Write model data to disk to reduce memory usage
db_method
String. Use a "duckdb"
or a "SQLite"
database for validation data
filename
Filename for the saved model
filepath
Where to save the model. Defaults to ALASCA/<timestamp>
save
Save model data and plots
method
String. Can be "LM"
or "LMM"
max_PC
Integer. The maximal number of principal components to keep for further analysis
use_Rfast
Boolean. If TRUE
(default), use Rfast, else use lm or lme4
p_adjust_method
String. See stats::p.adjust()
participant_column
String. The column used for IDs. If not provided, it will guess based on random effect or ID
stratification_column
String. Name of the column to use for stratification during validation
explanatory_limit
Only validate components explaining more than explanatory_limit
of the variance
init_time
The time when the object is initialized
log_to
String deciding logging target: "all"
(default), "file"
, "console"
, "none"
log_level
String. What level of log messages to print; "DEBUG"
, "INFO"
, "WARN"
, "ERROR"
do_debug
Boolean. Log more details
finished
Boolean. Indicates whether the model has been successfully initiated
ALASCA
List. Contains all model outputs: score
, loading
, explained
and significant_PCs
get_plot_group
Name of the grouping factor (used for plotting)
effect_terms
List of the terms in the effect matrices
remove_embedded_data()
get_scaling_function()
get_pca_function()
build_model()
run_regression()
remove_covars()
get_effect_matrix()
do_pca()
do_reduce_dimensions()
clean_pca()
clean_alasca()
do_validate()
get_validation_percentiles()
get_regression_predictions()
prepare_validation_run()
get_bootstrap_data()
new()
AlascaModel$new(df, formula, effects, ...)
log()
Function for logging messages using the log4r package
plot()
Main function for plots
flip()
Switch the sign of scores and loadings
get_levels()
Returns all the levels of a given column
get_PCs()
Returns the most interesting principal components (i.e., components explaining more than a given limit of variance: explanatory_limit
)
get_predictions()
get_scores()
Return scores
get_loadings()
Return loadings
get_covars()
save_validation()
Write scores, loadings, covars and predictions from validation run to database and remove data from memory
rotate_matrix_optimize_score()
Rotate model loadings and scores with procrustes. This function checks all combinations of signs to minimize variation