Description Usage Arguments Details Value See Also Examples
Methods to check the validity of an object of class stsm.
1 2 3 4 | ## S4 method for signature 'stsm'
check.bounds(x)
## S4 method for signature 'stsm'
validObject(object)
|
x |
an object of class |
object |
an object of class |
check.bounds checks that the values in the slot pars
lie within the lower and upper bounds. These bounds are stored in the slots
lower and upper. Default values or specific values can be given
when creating the object by means of stsm.model.
check.bounds is called by validObject.
In some settings it may be required to check only that the parameters
are within the required bounds.
validObject checks additional requirements: e.g. all the parameters
taking part in the selected model are either in the slots pars,
nopars or cpar;
it is also checked that the parameters are no duplicated in those slots.
This method is called by stsm-set-methods defined
for the slots pars, nopars or cpar. That's why it is safer
to use the setter methods instead of a direct modification through the operator @<-.
If the input object is valid according to the class definition,
the logical TRUE is returned. Otherwise, an error message is
returned.
stsm and
examples in stsm-set-methods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | m <- stsm.model(model = "llm+seas", y = JohnsonJohnson,
pars = c("var1" = 2, "var2" = 15, "var3" = 30))
validObject(m)
# force a wrong value (negative variance)
m@pars[1] <- -1
try(validObject(m))
try(check.bounds(m))
# duplicates not allowed
m <- stsm.model(model = "llm+seas", y = JohnsonJohnson,
pars = c("var1" = 2, "var2" = 15, "var3" = 30))
# try to define 'var1', already in 'pars', in the slot 'nopars'
try(m <- set.nopars(m, c(var1=22)))
# force a duplicate
m@nopars <- c(m@nopars, var1 = 22)
try(validObject(m))
|
[1] TRUE
Error in check.bounds(object) :
some parameter values are outside lower-upper bounds.
Error in check.bounds(m) :
some parameter values are outside lower-upper bounds.
Error in validityMethod(object) : !any(duplicated(allnames)) is not TRUE
Error in validityMethod(object) : !any(duplicated(allnames)) is not TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.