Class Lagged
Lagged-class.Rd
Class Lagged.
Objects from the Class
This class serves as a base class for objects with natural indexing starting from zero. It is a virtual class, no objects can be created from it.
Arithmetic and other operations are defined. They return objects strictly from the core "Lagged" classes, even if the arguments are from classes inheriting from the core "Lagged" classes. Of course, for such classes specialised methods can be defined to keep the class when appropriate. For example, the sum of two autocovariance functions is an autocovariance function, but their difference may not be a valid one.
In arithmetic operations between "Lagged" objects the arguments are made of equal length by filling in NA's. When one of the operands is not "Lagged", the recycling rule is applied only if that argument is a singleton.
Methods
- [
signature(x = "Lagged", i = "missing", j = "ANY", drop = "ANY")
: In this case (i.e.,i
is missing)[]
, returns the underlying data. This is equivalent to usingx[1:maxLag(x)]
.- maxLag
signature(object = "Lagged")
: Gives the maximal lag in the object.- [[
signature(x = "Lagged", i = "numeric")
: ...- [[<-
signature(x = "Lagged", i = "numeric")
: ...
%\item{[<-}{\code{signature(x = "Lagged", i = "missing")}: ... }
- [<-
signature(x = "Lagged", i = "missing")
: ...- coerce
signature(from = "Lagged", to = "array")
: ...- coerce
signature(from = "Lagged", to = "matrix")
: ...- coerce
signature(from = "Lagged", to = "vector")
: ...- Math
signature(x = "Lagged")
: ...- Math2
signature(x = "Lagged")
: ...- maxLag<-
signature(object = "Lagged")
: ...- Ops
signature(e1 = "FlexibleLagged", e2 = "Lagged")
: ...- Ops
signature(e1 = "Lagged", e2 = "FlexibleLagged")
: ...- Ops
signature(e1 = "Lagged", e2 = "Lagged")
: ...- Ops
signature(e1 = "Lagged", e2 = "missing")
: ...- Ops
signature(e1 = "Lagged", e2 = "vector")
: ...- Ops
signature(e1 = "vector", e2 = "Lagged")
: ...- Summary
signature(x = "Lagged")
: ...
Examples
Lagged(1:12) # => Lagged1d
#> An object of class "Lagged1d"
#> Slot *data*:
#> Lag_0 Lag_1 Lag_2 Lag_3 Lag_4 Lag_5 Lag_6 Lag_7 Lag_8 Lag_9 Lag_10
#> 1 2 3 4 5 6 7 8 9 10 11
#> Lag_11
#> 12
Lagged(matrix(1:12, ncol = 3)) # => Lagged2d
#> An object of class "Lagged2d"
#> Slot *data*:
#> Lag_0 Lag_1 Lag_2
#> 1 5 9
#> 2 6 10
#> 3 7 11
#> 4 8 12
Lagged(array(1:24, dim = 2:4)) # => Lagged3d
#> An object of class "Lagged3d"
#> Slot *data*:
#> , , Lag_0
#>
#>
#> 1 3 5
#> 2 4 6
#>
#> , , Lag_1
#>
#>
#> 7 9 11
#> 8 10 12
#>
#> , , Lag_2
#>
#>
#> 13 15 17
#> 14 16 18
#>
#> , , Lag_3
#>
#>
#> 19 21 23
#> 20 22 24
#>
## equivalently:
new("Lagged1d", data = 1:12) # => Lagged1d
#> An object of class "Lagged1d"
#> Slot *data*:
#> Lag_0 Lag_1 Lag_2 Lag_3 Lag_4 Lag_5 Lag_6 Lag_7 Lag_8 Lag_9 Lag_10
#> 1 2 3 4 5 6 7 8 9 10 11
#> Lag_11
#> 12
new("Lagged2d", data = matrix(1:12, ncol = 3)) # => Lagged2d
#> An object of class "Lagged2d"
#> Slot *data*:
#> Lag_0 Lag_1 Lag_2
#> 1 5 9
#> 2 6 10
#> 3 7 11
#> 4 8 12
new("Lagged3d", data = array(1:24, dim = 2:4)) # => Lagged3d
#> An object of class "Lagged3d"
#> Slot *data*:
#> , , Lag_0
#>
#>
#> 1 3 5
#> 2 4 6
#>
#> , , Lag_1
#>
#>
#> 7 9 11
#> 8 10 12
#>
#> , , Lag_2
#>
#>
#> 13 15 17
#> 14 16 18
#>
#> , , Lag_3
#>
#>
#> 19 21 23
#> 20 22 24
#>