mxComputeCheckpoint: Log parameters and state to disk or memory

View source: R/MxCompute.R

mxComputeCheckpointR Documentation

Log parameters and state to disk or memory

Description

Captures the current state of the backend. When path is set, the state is written to disk in a single row. When toReturn is set, the state is recorded in memory and returned after mxRun.

Usage

mxComputeCheckpoint(
  what = NULL,
  ...,
  path = NULL,
  append = FALSE,
  header = TRUE,
  toReturn = FALSE,
  parameters = TRUE,
  loopIndices = TRUE,
  fit = TRUE,
  counters = TRUE,
  status = TRUE,
  standardErrors = FALSE,
  gradient = FALSE,
  vcov = FALSE,
  vcovFilter = c(),
  sampleSize = FALSE,
  vcovWLS = FALSE,
  useVcovFilter = FALSE
)

Arguments

what

a character vector of algebra names to include in each checkpoint

...

Not used. Forces remaining arguments to be specified by name

path

a character vector of where to write the checkpoint file

append

if FALSE, truncates the checkpoint file upon open. If TRUE, existing data is preserved and checkpoints are appended.

header

whether to write the header that describes the content of each column

toReturn

logical. Whether to store the checkpoint in memory and return it after the model is run

parameters

logical. Whether to include the parameter vector

loopIndices

logical. Whether to include the loop indices

fit

logical. Whether to include the fit value

counters

logical. Whether to include counters (number of evaluations and iterations)

status

logical. Whether to include the status code

standardErrors

logical. Whether to include the standard errors

gradient

logical. Whether to include the gradients

vcov

logical. Whether to include the vcov in half-vectorized order

vcovFilter

character vector. Vector of parameters indicating which parameter covariances to include. Only the variance is included for those parameters not mentioned.

sampleSize

logical. Whether to include the sample size of the mxData. \lifecycleexperimental

vcovWLS

logical. Whether to include the vcov from WLS residualizing regressions in half-vectorized order

useVcovFilter

logical. Whether to use the vcovFilter (TRUE) or include all entries (FALSE)

See Also

mxComputeLoadData, mxComputeLoadMatrix, mxComputeLoadContext, mxComputeLoop

Other model state: mxRestore(), mxSave()

Examples

library(OpenMx)

m1 <- mxModel(
  "poly22", # Eqn 22 from Tsallis & Stariolo (1996)
  mxMatrix(type='Full', values=runif(4, min=-1e6, max=1e6),
           ncol=1, nrow=4, free=TRUE, name='x'),
  mxAlgebra(sum((x*x-8)^2) + 5*sum(x) + 57.3276, name="fit"),
  mxFitFunctionAlgebra('fit'))

plan <- mxComputeLoop(list(
  mxComputeSetOriginalStarts(),
    mxComputeSimAnnealing(method="tsallis1996",
                          control=list(tempEnd=1)),
    mxComputeCheckpoint(path = "result.log")),
  i=1:4)

m1 <- mxRun(mxModel(m1, plan)) # see the file 'result.log'

OpenMx documentation built on Oct. 19, 2024, 9:06 a.m.