Get access to the information stored in the slots `cpar`

, `nopars`

and
`pars`

in objects of class `stsm`

.

1 2 3 4 5 6 |

`x` |
an object of class |

`rescale` |
logical. If |

*Transformation of the parameters of the model.*
The method `transPars`

allows parameterizing the model
in terms of an auxiliar vector of parameters.
The output of `get.pars`

is returned in terms of the actual parameters of the model, i.e.,
the variances and the autoregressive coefficients if they are part of the model.
With the standard parameterization, `x@transPars = NULL`

, `get.pars(x)`

returns
the output stored in `x@pars`

.
When the model is parameterized in terms of an auxiliar set of parameters
*θ*, `get.pars`

return the variance parameters instead of the values of
*θ* that are stored in `x@pars`

.
For example, with `x@transPars = "square"`

(where the variances are *θ^2*),
`ger.pars`

returns *θ^2* while `x@pars`

contains the vector *θ*.

*Absolute and relative variances.*
The model can be defined in terms of relative variances.
In this case, the variance that acts as a scaling parameter is stored in the slot `cpar`

.
Otherwise, `cpar`

is null and ignored.
Typically, the scaling parameter will be chosen to be the variance parameter that is
concentrated out of the likelihood function.
If `rescale = TRUE`

, the relative variance parameters are rescaled into
absolute variance parameters (i.e., they are multiplied by `x@cpar`

)
and then returned by these methods.
If `rescale = FALSE`

, relative variance parameters are returned, that is,
the variances divided by the scaling parameter `cpar`

.
Since the scaling parameter is one of the variances, the relative variance stored
in `cpar`

is *1* (the parameter divided by itself).

*Transformation of parameters in a model defined in terms of relative
variances.* When a model is defined so that the parameters are the relative variances
(`cpar`

is not null) and a parameterization `transPars`

is also specified,
then the transformation of parameters is applied to the relative variances,
not to the absolute variances. The relative variances are first transformed and
afterwards they are rescaled back to absolute variances if requested by
setting `rescale = TRUE`

.
The transformation `transPars`

is applied to the parameters defined in
`pars`

; `cpar`

is assumed to be chosen following other rationale; usually,
it is the value that maximizes the likelihood since one of the variance parameters
can be concentrated out of the likelihood function.

*Note.*
When `cpar`

is not null, it is more convenient to store in the slots
`pars`

and `nopars`

the values of the relative variances, while
the slot `cpar`

stores the value of the scaling parameter rather than
the relative variance (which will be *1*).
If the relative values were stored, then the scaling parameter would
need to be recomputed each time the value is requested by `get.cpar`

.
Assuming that `cpar`

is the parameter that is concentrated out of the likelihood function,
the expression that maximizes the likelihood should be evaluated whenever
the value is requested to be printed or to do any other operation.
To avoid this, the scaling value is directly stored. This approach makes also
sense with the way the method `set.cpar`

works.

*Note for users.*
For those users that are not familiar with the design and internal structure of the
stsm.class package, it is safer to use the get and set methods
rather than retrieving or modifying the contents of the slots through the `@`

and
`@<-`

operators.

`get.cpar` |
named numeric of length one. |

`get.nopars` |
named numeric vector. |

`get.pars` |
named numeric vector. |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | ```
# sample models with arbitrary parameter values
# model in standard parameterization
# internal parameter values are the same as the model parameter
m <- stsm.model(model = "llm+seas", y = JohnsonJohnson,
pars = c("var1" = 2, "var2" = 15, "var3" = 30))
m@pars
get.pars(m)
# model parameterized, the variances are the square
# of an auxiliar vector of parameters
m <- stsm.model(model = "llm+seas", y = JohnsonJohnson,
pars = c("var1" = 2, "var2" = 15, "var3" = 30), transPars = "square")
# auxiliar vector of parameters
m@pars
# parameters of the model, variances
get.pars(m)
# model rescaled, variances are relative to 'var1'
m <- stsm.model(model = "llm+seas", y = JohnsonJohnson,
pars = c("var2" = 15, "var3" = 30), cpar = c("var1" = 2))
# internal values
m@pars
m@cpar
# relative variances
get.pars(m)
get.cpar(m)
# absolute variances
get.pars(m, rescale = TRUE)
get.cpar(m, rescale = TRUE)
# model defined in terms of relative variances
# and with the parameterization \code{transPars="square};
# the transformation is applied to the relative variances,
# the relative variances are first transformed and afterwards
# they are rescaled back to absolute variances if requested
m <- stsm.model(model = "llm+seas", y = JohnsonJohnson,
pars = c("var2" = 3, "var3" = 6), cpar = c("var1" = 2),
transPars = "square")
c(get.cpar(m, rescale = FALSE), get.pars(m, rescale = FALSE))
c(get.cpar(m, rescale = TRUE), get.pars(m, rescale = TRUE))
# when 'cpar' is defined, 'nopars' is also interpreted as a relative variance
# and therefore it is rescaled if absolute variances are requested
m <- stsm.model(model = "llm+seas", y = JohnsonJohnson,
pars = c("var2" = 3), cpar = c("var1" = 2), nopars = c("var3" = 6),
transPars = NULL)
v <- c(get.cpar(m, rescale = FALSE), get.pars(m, rescale = FALSE), get.nopars(m, rescale = FALSE))
v[c("var1", "var2", "var3")]
v <- c(get.cpar(m, rescale = TRUE), get.pars(m, rescale = TRUE), get.nopars(m, rescale = TRUE))
v[c("var1", "var2", "var3")]
# 'nopars' is rescaled as shown in the previous example
# but it is not affected by the parameterization chosen for 'pars'
m <- stsm.model(model = "llm+seas", y = JohnsonJohnson,
pars = c("var2" = 3), cpar = c("var1" = 2), nopars = c("var3" = 6),
transPars = "square")
v <- c(get.cpar(m, rescale = FALSE), get.pars(m, rescale = FALSE), get.nopars(m, rescale = FALSE))
v[c("var1", "var2", "var3")]
v <- c(get.cpar(m, rescale = TRUE), get.pars(m, rescale = TRUE), get.nopars(m, rescale = TRUE))
v[c("var1", "var2", "var3")]
``` |

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.