parameter_trans {pomp} | R Documentation |
parameter transformations
Description
Equipping models with parameter transformations to facilitate searches in constrained parameter spaces.
Usage
parameter_trans(toEst, fromEst, ...)
## S4 method for signature 'NULL,NULL'
parameter_trans(toEst, fromEst, ...)
## S4 method for signature 'pomp_fun,pomp_fun'
parameter_trans(toEst, fromEst, ...)
## S4 method for signature 'Csnippet,Csnippet'
parameter_trans(toEst, fromEst, ..., log, logit, barycentric)
## S4 method for signature 'character,character'
parameter_trans(toEst, fromEst, ...)
## S4 method for signature 'function,function'
parameter_trans(toEst, fromEst, ...)
Arguments
toEst , fromEst |
procedures that perform transformation of model parameters to and from the estimation scale, respectively. These can be furnished using C snippets, R functions, or via procedures in an external, dynamically loaded library. |
... |
ignored. |
log |
names of parameters to be log transformed. |
logit |
names of parameters to be logit transformed. |
barycentric |
names of parameters to be collectively transformed according to the log barycentric transformation. Important note: variables to be log-barycentrically transformed must be adjacent in the parameter vector. |
Details
When parameter transformations are desired, they can be integrated into the ‘pomp’ object via the partrans
arguments using the parameter_trans
function.
As with the other basic model components, these should ordinarily be specified using C snippets.
When doing so, note that:
The parameter transformation mapping a parameter vector from the scale used by the model codes to another scale, and the inverse transformation, are specified via a call to
parameter_trans(toEst,fromEst)
.
The goal of these snippets is the transformation of the parameters from the natural scale to the estimation scale, and vice-versa. If
p
is the name of a variable on the natural scale, its value on the estimation scale isT_p
. Thus thetoEst
snippet computesT_p
givenp
whilst thefromEst
snippet computesp
givenT_p
.Time-, state-, and covariate-dependent transformations are not allowed. Therefore, neither the time, nor any state variables, nor any of the covariates will be available in the context within which a parameter transformation snippet is executed.
These transformations can also be specified using R functions with arguments chosen from among the parameters.
Such an R function must also have the argument ‘...
’.
In this case, toEst
should transform parameters from the scale that the basic components use internally to the scale used in estimation.
fromEst
should be the inverse of toEst
.
Note that it is the user's responsibility to make sure that the transformations are mutually inverse.
If obj
is the constructed ‘pomp’ object, and coef(obj)
is non-empty, a simple check of this property is
x <- coef(obj, transform = TRUE) obj1 <- obj coef(obj1, transform = TRUE) <- x identical(coef(obj), coef(obj1)) identical(coef(obj1, transform=TRUE), x)
One can use the log
and logit
arguments of parameter_trans
to name variables that should be log-transformed or logit-transformed, respectively.
The barycentric
argument can name sets of parameters that should be log-barycentric transformed.
Note that using the log
, logit
, or barycentric
arguments causes C snippets to be generated.
Therefore, you must make sure that variables named in any of these arguments are also mentioned in paramnames
at the same time.
The logit transform is defined by
\mathrm{logit}(\theta)=\log\frac{\theta}{1-\theta}.
The log barycentric transformation of variables \theta_1,\dots,\theta_n
is given by
\mathrm{logbarycentric}(\theta_1,\dots,\theta_n)=\left(\log\frac{\theta_1}{\sum_i \theta_i},\dots,\log\frac{\theta_n}{\sum_i \theta_i}\right).
Note for Windows users
Some Windows users report problems when using C snippets in parallel computations.
These appear to arise when the temporary files created during the C snippet compilation process are not handled properly by the operating system.
To circumvent this problem, use the cdir
and cfile
options to cause the C snippets to be written to a file of your choice, thus avoiding the use of temporary files altogether.
See Also
More on implementing POMP models:
Csnippet
,
accumvars
,
basic_components
,
betabinomial
,
covariates
,
dinit_spec
,
dmeasure_spec
,
dprocess_spec
,
emeasure_spec
,
eulermultinom
,
pomp-package
,
pomp_constructor
,
prior_spec
,
rinit_spec
,
rmeasure_spec
,
rprocess_spec
,
skeleton_spec
,
transformations
,
userdata
,
vmeasure_spec