Learn R Programming

tsmethods (version 1.0.2)

distribution_list: Multiple Distributions

Description

validates and returns an object of class ‘tsmodel.distribution_list’ which holds a validated list of tsmodel.distribution objects for use in multivariate models.

Usage

distribution_list(distributions = NULL, names = NULL)

Value

an object of class ‘tsmodel.distribution_list’

Arguments

distributions

a list with ‘tsmodel.distribution’ objects.

names

an optional vector of names for each slot in the list.

Details

The function will validate the distributions passed as belonging to class ‘tsmodel.distribution’, check whether they are similar in terms of number of draws (rows), horizon (columns) and dates. If the list is not named, then unless the “names” argument is passed, then will name the slots as series1, series2, etc.

Examples

Run this code
x1 <- matrix(rnorm(100), 10, 10)
colnames(x1) <- as.character(as.Date(1:10, origin = "1970-01-01"))
x2 <- matrix(rnorm(100), 10, 10)
colnames(x2) <- as.character(as.Date(1:10, origin = "1970-01-01"))
class(x1) <- class(x2) <- "tsmodel.distribution"
distributions <- list(s1 = x1, s2 = x2)
L <- distribution_list(distributions)
str(L)

Run the code above in your browser using DataLab