prep.tfun {dynr} | R Documentation |
Create a dynrTrans object to handle the transformations and inverse transformations of model paramters
prep.tfun(formula.trans, formula.inv, transCcode = TRUE)
formula.trans |
a list of formulae for transforming freed parameters other than variance-covariance parameters during the optimization process. These transformation functions may be helpful for transforming parameters that would normally appear on a constrained scale to an unconstrained scale (e.g., parameters that can only take on positive values can be subjected to exponential transformation to ensure positivity.) |
formula.inv |
a list of formulae that inverse the transformation on the free parameters and will be used to calculate the starting values of the parameters. |
transCcode |
a logical value indicating whether the functions in formula.trans need to be transformed to functions in C. The default for transCcode is TRUE, which means that the formulae will be translated to C functions and utilized during the optimization process. If transCcode = FALSE, the transformations are only performed at the end of the optimization process for standard error calculations but not during the optimization process. ##' |
Prepares a dynr recipe that specifies the names of the parameters that are to be subjected to user-supplied transformation functions and the corresponding transformation and reverse-transformation functions. This can be very handy in fitting dynamic models in which certain parameters can only take on permissible values in particular ranges (e.g., a parameter may have to positive). Note that all variance-covariance parameters in the model are automatically subjected to transformation functions to ensure that the resultant covariance matrices are positive-definite. Thus, no additional transformation functions are needed for variance-covariance parameters.
Object of class 'dynrTrans'
#Specifies a transformation recipe, r20, that subjects the parameters
#'r10' and 'r20' to exponential transformation to ensure that they are positive.
trans <-prep.tfun(formula.trans=list(r10~exp(r10), r20~exp(r20)),
formula.inv=list(r10~log(r10),r20~log(r20)))