Description objects from the Class Slots Details Methods Extends Examples
SM.dlm class contrains the model defition based on the timeseries structure.
Objects are created by the method buildClass
or by calls of the form SM.dlm(...). However,
the first form is recommended.
call
An object of class call
returning an unevaluated function call.
freq
Positive integer value indicating the stationality of the raw inputs. Set it to 1 if the inputs has no stationality.
indicators
A list containing outliers or human intervention indexes, see examples.
lagMax
An integer value indicating the maximum effect lag for each outlier, see Details.
verify
A logical value indicating whether the validation process should be applied, see Details.
parallel
A logical value indicating whether the parallel process should be applied.
Usually, outliers are happened in the data due to uncontrollable event or human intervention. In those cases, one should annotate the indexes where it presents to validate the model. check the example for more application detail.
Once outlier happended, its effect could be instant or remains some time period in case of timeseries. If lagMax is bigger than 1, then gridsearch will be applied: for each outlier index and for each possible lag between one and lagMax, the maximun likelihood estimation will be calculated for each possible combination. Then, best model will be returned after the gridsearch process which has the best MLE performance.
The number of models is determinated by follow equation:
number of models = lagMax ** number of indicators.
According to the formula, the gridsearch complexitity is an exponential function respect a #indicators with base lagMax. To avoid computation problem, it's best to assign verify equal to TRUE, where it returns FALSE if #indicators ** lagMax >= 200 in the class definition. To skip this validation process, kindly set verify to FALSE.
Available methods for this class are:
show
: the class display is simplyfied, each data input is limited to 25;
print
: displays the whole class;
get
('['): returns the value of a slot;
fit
: training the model and returning the SM.dlm.fitted
.
extractMeasures
: returning error, because the model hasn't trained.
From class SM-class
, directly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | n <- 50
rs.class <- RS(sigb = rnorm(n, mean = 0, sd = 1),
epsb = rnorm(n, mean = 0, sd = 2),
epsp = rnorm(n, mean = 1, sd = 1))
# The inputs we created are random variable,
# then they have non-stationality structure.
freq <- 1
# Suppose there is a rain at index 1 and 20, and irrigation at 5.
index <- list(rain = c(1, 20), watering = c(5))
lagMax <- 10
verify <- parallel <- TRUE
## Not run:
# it returns error because 10 ** 3 = 1000 which is bigger than 200.
dlm.class <- buildClass(object = rs.class, method = "dlm",
freq = freq, ind = index, lagMax = lagMax,
verify = verify, parallel = parallel)
## End(Not run)
lagMax <- 3
dlm.class <- buildClass(object = rs.class, method = "dlm",
freq = freq, ind = index, lagMax = lagMax,
verify = verify, parallel = parallel)
dlm.class
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.