This function estimates the random-access memory (RAM) required to
update a given model and data with the LaplacesDemon
function.
Warning: Unwise use of this function may crash a computer, so please read the details below.
LaplacesDemon.RAM(Model, Data, Iterations, Thinning, Algorithm="RWM")
This is a model specification function. For more
information, see LaplacesDemon
.
This is a list of Data. For more information, see
LaplacesDemon
.
This is the number of iterations for which
LaplacesDemon
would update. For more information,
see LaplacesDemon
.
This is the amount of thinning applied to the chains
in LaplacesDemon
.For more information, see
LaplacesDemon
.
This argument accepts the name of the algorithm as a
string, as entered in LaplacesDemon
.For more
information, see LaplacesDemon
.
LaplacesDemon.RAM
returns a list with several components. Each
component is an estimate in MB for an object. The list has the
following components:
This is the estimated size in MB of RAM required for the covariance matrix, variance vector, or both (some algorithms store both internally, creating one from the other). Blocked covariance matrices are not considered at this time.
This is the estimated size in MB of RAM required for the list of data.
This is the estimated size in MB of RAM required for the deviance vector.
This is the estimated size in MB of RAM required for the vector of initial values.
This is the estimated size in MB of RAM required for the model specification function.
This is the estimated size in MB of RAM required for
the \(N \times J\) matrix Monitor
, where \(N\) is
the number of thinned samples and J is the number of monitored
variables.
This is the estimated size in MB of RAM required for a
matrix of posterior samples. This matrix is used in some algorithms,
and is not returned by LaplacesDemon
.
This is the estimated size in MB of RAM required for
the \(N \times J\) matrix Posterior1
, where \(N\)
is the number of thinned samples and \(J\) is the number of
initial values or parameters.
This is the estimated size in MB of RAM required for
the \(N \times J\) matrix Posterior2
, where \(N\)
is the number of globally stationary thinned samples and \(J\) is
the number of initial values or parameters. Maximum RAM use is
assumed here, so the same \(N\) is used, as in Posterior1
.
This is the estimated size in MB of RAM required for the summary table of all thinned posterior samples of parameters, deviance, and monitored variables.
This is the estimated size in MB of RAM required for the summary table of all globally stationary thinned posterior samples of parameters, deviance, and monitored variables.
This is the estimated size in MB of RAM required in total
to update one chain in LaplacesDemon
for a given model
and data, and for a number of iterations and specified thinning.
The LaplacesDemon.RAM
function uses the
object.size
function to estimate the size in MB of RAM
required to update one chain in LaplacesDemon
for a
given model and data, and for a number of iterations and specified
thinning. When RAM is exceeded, the computer will crash. This function
can be useful when trying to estimate how many iterations to update a
model without crashing the computer. However, when estimating the
required RAM, LaplacesDemon.RAM
actually creates several large
objects, such as post
(see below). If too many iterations are
given as an argument to LaplacesDemon.RAM
, for example, then it
will crash the computer while trying to estimate the required RAM.
The best way to use this function is as follows. First, prepare the model specification and list of data. Second, observe how much RAM the computer is using at the moment, as well as the maximum available RAM. The majority of the difference of these two is the amount of RAM the computer may dedicate to updating the model. Next, use this function with a small number of iterations (important in some algorithms), and with few thinned samples (important in all algorithms). Note the estimated RAM. Increase the number of iterations and thinned samples, and again note the RAM. Continue to increase the number of iterations and thinned samples until, say, arbitrarily within 90% of the above-mentioned difference in RAM.
The computer operating system uses RAM, as does any other software
running at the moment. R is currently using RAM, and other functions
in the LaplacesDemon
package, and any other package that is
currently activated, are using RAM. There are numerous small objects
that are not included in the returned list, that use RAM. For example,
there may be a scalar called alpha
for the acceptance
probability, etc.
One potentially larger object that is not included, and depends on
the algorithm, is a matrix used for estimating LML
.
Its use occurs with non-adaptive MCMC algorithms, only with enough
globally stationary samples, and only when the ratio of parameters to
samples is not excessive. If used, then the user should create a
matrix of the appropriate dimensions and use the
object.size
function to estimate the RAM.
If the data is too large for RAM, then consider using either the
BigData
function or the SGLD algorithm in
LaplacesDemon
.
BigData
,
LaplacesDemon
,
LML
, and
object.size
.