This function estimates the randomaccess 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.
1  LaplacesDemon.RAM(Model, Data, Iterations, Thinning, Algorithm="RWM")

Model 
This is a model specification function. For more
information, see 
Data 
This is a list of Data. For more information, see

Iterations 
This is the number of iterations for which

Thinning 
This is the amount of thinning applied to the chains
in 
Algorithm 
This argument accepts the name of the algorithm as a
string, as entered in 
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 abovementioned 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 nonadaptive 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
.
LaplacesDemon.RAM
returns a list with several components. Each
component is an estimate in MB for an object. The list has the
following components:
Covar 
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. 
Data 
This is the estimated size in MB of RAM required for the list of data. 
Deviance 
This is the estimated size in MB of RAM required for the deviance vector. 
Initial.Values 
This is the estimated size in MB of RAM required for the vector of initial values. 
Model 
This is the estimated size in MB of RAM required for the model specification function. 
Monitor 
This is the estimated size in MB of RAM required for
the N x J matrix 
post 
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 
Posterior1 
This is the estimated size in MB of RAM required for
the N x J matrix 
Posterior2 
This is the estimated size in MB of RAM required for
the N x J matrix 
Summary1 
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. 
Summary2 
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. 
Total 
This is the estimated size in MB of RAM required in total
to update one chain in 
Statisticat, LLC software@bayesianinference.com
BigData
,
LaplacesDemon
,
LML
, and
object.size
.
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.