export_ecm: Saving and loading fitted ECM models

View source: R/data-management.R

export_ecmR Documentation

Saving and loading fitted ECM models

Description

export_ecm() saves an ECM model fit to training data for later use. The object can be the output of the cECM() or BayesECM() functions. Object saved in user specified location.

import_ecm() loads a previously exported ECM model into the global environment.

Usage

export_ecm(x = NULL, file = stop("'file' must be specified"), verb = TRUE)

import_ecm(file = NULL, verb = TRUE)

Arguments

x

Name of ECM model to be exported. class(x) should be either "cECM" or "BayesECM".

file

Character string containing absolute or relative path of ⁠*.rda⁠ file to be exported or imported.

verb

Logical indicating if a message indicating success should be printed to the console.

Value

Saves file or imports file into global environment.

Examples


x <- pval_gen(sims = 20, pwave.arrival = list(optim.starts = 5))
pval_cat <- cECM(x = x, transform = TRUE)

export_ecm(x = pval_cat, file = "example-ecm.rda", verb = FALSE)

reload_pval_cat <- import_ecm(file = "example-ecm.rda")

## The below code shouldn't be used,
## it deletes the file created during the example

unlink("example-ecm.rda")




ezECM documentation built on Oct. 18, 2024, 1:07 a.m.