coerce-methods | R Documentation |
Methods for as() in package sarima.
This section shows the methods for converting objects from one class
to another, defined via setAs()
. Use as(obj, "classname")
to convert object obj
to class "classname".
signature(from = "ANY", to = "Autocorrelations")
signature(from = "ANY", to = "ComboAutocorrelations")
signature(from = "ANY", to = "ComboAutocovariances")
signature(from = "ANY", to = "PartialAutocorrelations")
signature(from = "ANY", to = "PartialAutocovariances")
signature(from = "ANY", to = "PartialVariances")
signature(from = "ArmaSpec", to = "list")
signature(from = "Autocorrelations", to = "ComboAutocorrelations")
signature(from = "Autocorrelations", to = "ComboAutocovariances")
signature(from = "Autocovariances", to = "ComboAutocorrelations")
signature(from = "Autocovariances", to = "ComboAutocovariances")
signature(from = "BJFilter", to = "SPFilter")
signature(from = "numeric", to = "BJFilter")
Convert a numeric vector to a BJFilter object. This is a way to state that the coefficients follow the Box-Jenkins convention for the signs, see the examples.
signature(from = "numeric", to = "SPFilter")
Convert a numeric vector to an SPFilter object. This is a way to state that the coefficients follow the signal processing (SP) convention for the signs, see the examples.
signature(from = "PartialVariances", to = "Autocorrelations")
signature(from = "PartialVariances", to = "Autocovariances")
signature(from = "PartialVariances", to = "ComboAutocorrelations")
signature(from = "PartialVariances", to = "ComboAutocovariances")
signature(from = "SarimaFilter", to = "ArmaFilter")
signature(from = "SarimaModel", to = "list")
signature(from = "SPFilter", to = "BJFilter")
signature(from = "vector", to = "Autocorrelations")
signature(from = "vector", to = "Autocovariances")
signature(from = "vector", to = "PartialAutocorrelations")
signature(from = "vector", to = "PartialAutocovariances")
signature(from = "VirtualArmaFilter", to = "list")
signature(from = "VirtualSarimaModel", to = "ArmaModel")
Georgi N. Boshnakov
## the default for ARMA model is BJ for ar and SP for ma: mo <- new("ArmaModel", ar = 0.9, ma = 0.4, sigma2 = 1) modelPoly(mo) ## here we declare explicitly that 0.4 uses the SP convention ## (not necessary, the result is the same, but the intention is clear). mo1 <- new("ArmaModel", ar = 0.9, ma = as(0.4, "SPFilter"), sigma2 = 1) modelPoly(mo1) identical(mo, mo1) ## TRUE ## if the sign of theta follows the BJ convention, this can be stated unambiguously. ## This creates the same model: mo2 <- new("ArmaModel", ar = 0.9, ma = as(-0.4, "BJFilter"), sigma2 = 1) modelPoly(mo2) identical(mo, mo2) ## TRUE ## And this gives the intended model whatever the default conventions: ar3 <- as(0.9, "BJFilter") ma3 <- as(-0.4, "BJFilter") mo3 <- new("ArmaModel", ar = ar3, ma = ma3, sigma2 = 1) modelPoly(mo3) identical(mo, mo3) ## TRUE ## The coefficients can be extracted in any particular form, ## e.g. to pass them to functions with specific requirements: modelCoef(mo3) # coefficients of the model with the default (BD) sign convention modelCoef(mo3, convention = "BD") # same result modelCoef(mo3, convention = "SP") # signal processing convention ## for ltsa::tacvfARMA() the convention is BJ, so: co <- modelCoef(mo3, convention = "BJ") # Box-Jenkins convention ltsa::tacvfARMA(co$ar, co$ma, maxLag = 6, sigma2 = 1) autocovariances(mo3, maxlag = 6) ## same
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.