create_TRMF: Create a TRMF object

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/TRMF.R

Description

Creates a TRMF object from a data matrix. This function is always needed to initialize a TRMF model.

Usage

1
2
3
4
create_TRMF(dataM, weight = 1, 
      normalize = c("none", "standard", "robust", "range"),
      normalize.type = c("global", "columnwise", "rowwise"),
      na.action = c("impute", "fail"))

Arguments

dataM

The data matrix, each column represents a time series.

weight

An optional matrix of weights to be used in the fitting process. If used, sum(w^2*e^2) is minimized.

normalize

Type of scaling/centering for the data. Recommended to reduce bias when using regularization. none does nothing, standard centers with mean, and scales by sd(), robust centers with the median and scales by mad(,constant=1), range maps to [0-1] interval

normalize.type

how should normalization be applied. global scales and centers matrix by one value. columnwise and rowwise normalize each column or row separately.

na.action

what action to take when data contains NAs

Details

This function doesn't do any computation, it is the entry point for creating a TRMF model. To train the model or add additional details, see examples. Normalization is recommended in general. Regularization biases the factorization toward zero a little bit, centering changes that to bias towards the mean. Scaling makes the choosing of regularization parameters easier. If the factorization is to be used for forward forecasting, rowwise normalization is not recommended as it could remove some temporal information.

Value

create_TRMF returns an object of class "TRMF" to be passed to other TRMF functions.

Author(s)

Chad Hammerquist

References

Yu, Hsiang-Fu, Nikhil Rao, and Inderjit S. Dhillon. "High-dimensional time series prediction with missing values." arXiv preprint arXiv:1509.08333 (2015).

See Also

train.TRMF, TRMF_columns, TRMF_trend

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# create test data
xm = poly(x = (-10:10)/10,degree=4)
fm = matrix(runif(40),4,10)
Am = xm%*%fm+rnorm(210,0,.2)

# create model
obj = create_TRMF(Am)
obj = TRMF_columns(obj,reg_type ="interval")
obj = TRMF_trend(obj,numTS=4,order=2)
out = train(obj)
plot(out)

TRMF documentation built on Aug. 16, 2021, 5:06 p.m.