Skip to contents

Compute a multi-companion matrix from its companion factors or from a periodic filter. Create the multi-companion matrix corresponding to a periodic filter by multiplying the relevant companion matrices in reverse order.

Usage

mc_from_factors(x)
mc_from_filter(x)

Arguments

x

a matrix with a row for each companion factor, see details.

Details

x is a matrix whose i-th row is the top row of the i-th companion factor (for mc_from_factors) or the filter coefficients for the i-th season (for mc_from_filter).

mc_from_factors is, effectively, the inverse of mc_factorize. The companion matrices specified by the argument are multiplied.

mc_from_filter is similar except that the relevant companion matrices are multiplied in reverse order. After all, it is natural to have the coefficients for the i-th season in the i-th row!

todo: add an argument to specify the "first" season.

Value

The top of the resulting multi-companion matrix.

References

Boshnakov GN (2002). “Multi-companion matrices.” Linear Algebra Appl., 354, 53--83. ISSN 0024-3795, doi:10.1016/S0024-3795(01)00475-X .

Author

Georgi N. Boshnakov

Level

Currently mc_from_factors calls mCompanion, which it probably should not do.

See also

Examples

x <- matrix(1:8, nrow = 2)
mc_from_factors(x)
#> 2 x 4 Matrix of class "dgeMatrix"
#>      [,1] [,2] [,3] [,4]
#>         5    9   13    8
#> wrk2    2    4    6    8
mCompanion(mc_from_factors(x))
#> 4 x 4 Matrix of class "MultiCompanion"
#>      [,1] [,2] [,3] [,4]
#>         5    9   13    8
#> wrk2    2    4    6    8
#>         1    0    0    0
#>         0    1    0    0

mc_from_filter(x)
#> 2 x 4 Matrix of class "dgeMatrix"
#>      [,1] [,2] [,3] [,4]
#>         6   12   18   14
#> wrk2    1    3    5    7
mCompanion(mc_from_filter(x))
#> 4 x 4 Matrix of class "MultiCompanion"
#>      [,1] [,2] [,3] [,4]
#>         6   12   18   14
#> wrk2    1    3    5    7
#>         1    0    0    0
#>         0    1    0    0