docs/vignettes/03_Making_a_SPEARobject.md

'Making a SPEARobject'

What is a SPEARobject?

The SPEAR package has been written using the R6 package. This means the syntax for using SPEAR is more similar to object oriented programming (OOP) languages (i.e. Python, C++…) rather than typical R programming.

To use the SPEAR package, first generate a SPEARobject with the make.SPEARobject function…

SPEARobject <- SPEAR::make.SPEARobject(X = ...,
                                       Y = ...,
                                       family = ...,
                                       seed = ...,
                                       ...
                                       )

This SPEARobject will be essential to run SPEAR and analyze the results. Below are some key parameters…

Data:

Weights:

Factors:

SPEAR-specific Parameters:

Other:

SPEARobject structure

SPEARobjects have the following structure:

Saving and Loading a SPEARobject

Because SPEAR can take time to run with large datasets, it is wise to save the SPEARobject in a script after running $run.cv.spear() or $run.spear()

SPEARobject$save.model("_name_to_save_object_.rds")

# or more simply, just use
saveRDS(SPEARobject, "_name_to_save_object_.rds")

Then, when you would like to analyze the results, just load the trained SPEARobject…

SPEARobject <- SPEAR::load.SPEARobject("_name_to_save_object_.rds")

# or more simply, just use
SPEARobject <- readRDS("_name_to_save_object_.rds")

Other Vignettes

To return to the main SPEAR vignette, click here



jgygi/SPEAR documentation built on July 5, 2023, 5:35 p.m.