Structural Time Series Models

Fit the basic structural time series model by maximum likelihood.


News

Changes in version 1.9 2016-10-23

o Added "using namespace std" (requested by CRAN maintainers).

o Added several "importFrom()" to the NAMESPACE.

Changes in version 1.8 2015-09-27

o Method "char2numeric" returns the element called "parsNames" containing the names of the vector "pars" (to be used by "KFKSDS::KF.deriv" so that the derivatives with respect to elements defined in "pars" are returned).

o Method "char2numeric" returns a list element called "id" containing the index in the vector "pars" of the variance parameters, AR coefficients or initial state vector.

Changes in version 1.7 2015-01-26

o Added argument "xreg" for external regressors in function "stsmFit". This function is the main interface to package "stsm" used by package "tsoutliers". "xreg" is defined within the "stsm" class object but having "xreg" as argument in "stsmFit" is more convenient for "tsoutliers".

Changes in version 1.6 2015-01-24

o Added "\VignetteIndexEntry" to "stsm.Rnw" file. It wasn't reported by "R CMD check --as-cran stsm" run under R-devel but it was reported by "R CMD check --as-cran stsm_1.6.tar.gz" as required by CRAN policies.

Changes in version 1.5 2015-01-24

o Packages "stsm.class" (version 1.3) and "stsm" have been merged. The S4 class from package "stsm.class" and related methods as well as the remaining functions of the package are now defined in package "stsm".

o Function "datagen.stsm" takes now the initial state vector from the input argument "model". If NULL, it is set to zeros. Suggested at http://stats.stackexchange.com/questions/125946/.

o Function "maxlik.td.optim" and "maxlik.fd.optim": The standard errors of parameter estimates are set to NULL for the optimization methods that do not return the Hessian matrix (e.g. "AB-NM"). In previous version an error was returned since for those methods no Hessian matrix could be found to be inverted.

o Fixed file 'index.html' in the 'doc' directory and validated at http://validator.w3.org/ as HTML 4.01 Transitional.

o pdf files attached to the package have been removed. Those files made the .tar.gz file a bit large in size. The information contained in those files has been moved to more appropriate places. A small vignette has been added containing a basic example and references to further material available from the author's website.

Changes in version 1.4 2014-07-22

o Added a document describing the package in vignettes directory. A duplicate of the document was required in directory "stsm/inst/doc" in order to pass the R CMD check. Other solutions can be possible
in order to include the pdf: for example the package "tsoutlies" provides an "index.html" file "doc" directory so that the suplementary pdf file is shown in the main help page of the package. But this way, the pdf is not detected as a vignette and is not shown on CRAN web site of the package.

o "mloglik.td" and "mloglik.fd": These functions have been adapted for the case where the input model contains external regressors. The argument "xreg" is removed and information from the slot "xreg" in the input model is used since this information has been added to the "stsm" class defined in package "stsm.class".

o "mloglik.td.deriv": Added argument "convergence = c(0.001, length([email protected]))".

o "mloglik.td.deriv" and "mloglik.td.grad": The gradient and the information matrix (in the former function) are now obtained with respect to the coefficients of external regressors that may be defined in the "stsm" object.

o "mloglik.fd.deriv" and "mloglik.fd.grad": The gradient, the Hessian and the information matrix are now obtained with respect to the coefficients of external regressors that may be defined in the "stsm" object.

o "maxlik.td.scoring" and "maxlik.fd.scoring": As the analytical derivatives are now available also for the coefficients of external regressors, they are used used in the scoring algorithms. The current approach seems to work better than in the previous version where the vector of parameters was split in two vectors (one for the variance parameters and other for the externa regressors). Before, the coefficients of the external regressors were obtained (at each step of the procedure) in a linear regression (OLS or frequency domain linear regression). Now, the availability of analytical derivatives allows including these coefficients in the updating equation of the scoring algorithm.

o "maxlik.td.optim" and "maxlik.fd.optim": - Removed argument "hessian" and set fixed to TRUE. The Hessian is returned and is used to compute the standard errors of parameter estimates. This way is more convenient because when printing the output the standard errors will be already available in the "stsmFit" object and do not need to be computed whenever the object is printed.

- These functions have been adapted for the case where external  
regressors are defined in the input model.

- The coefficients of external regressors (if any) are not removed 
from the slot "pars" of the output object, they are no longer placed 
separately in a list "xreg" containing the regressors, estimates and 
standard errors.

o "maxlik.td.optim": Fixed the sign of the value of the log-likelihood that was reported. The element "loglik" in the in output list stored the value of the minus log-likelihood function, changed to (not-minus) log-likelihood.

o Function "mll.step" defined within "maxlik.fd.scoring": set.pars(m, get.pars(m) + x * pd) changed to set.pars(m, [email protected] + x * pd), which is the correct
way if [email protected] is not null.

o "maxlik.td.scoring": the information matrix at the local optimum is now returned.

o Methods "fitted" and "residuals": the arguments "std.residuals" and "standardised" have been added, respectively in each method. By default, "fitted" returns the standardised residuals (as in previous versions); "residuals" does not standardise the residuals by default because that way is more convenient when used in package "tsoutliers".

o Method "print.stsmFit" has been simplified by taking advantage of new output (optimHessian, analytical Hessian or information matrix) returned by the functions that fit the structural time series model.

Changes in version 1.3 2014-05-29

o NAMESPACE: the functions "KalmanFilter", "KF", "KF.deriv.C", "KS" and "make.KF.args" are imported instead of importing the whole "KFKSDS" package.

o DESCRIPTION: packages "KFSKSD" and "stsm.class" are moved from the "Depends" field to the "Imports" field.

o The Expetation-Maximization algorithm can now be executed in parallel. The function "mclapply" from package "parallel" is used. The number of parallel processes can be specified in argument "num.cores". By default it is set equal to the number of CPU cores.

o Added argument "xreg" in functions "mloglik.fd" and "mloglik.td". External regressor variables can be passed to these functions.

o The concatenation of the elements in the list returned by "maxlik.fd.optim" and "maxlik.td.optim" has been corrected. Before, the Hessian matrix was not concatenated as a matrix element but each cell was split in different elements in the list. "res2 <- c(list(), hessian = res$hessian)" was changed to "res2 <- c(list(), list(hessian = res$hessian))".

o In order to reduce the size of the package, the data sets of simulated series "llm" and "llmseas" have been removed. The first series of "llmseas" is kept in the "data" directory because it is used in the examples of the documentation. The complete data sets can be generated by means of the scripts "datagen-llm.R" and "datagen-llmseas.R" of the "sims" directory.

Changes in version 1.2 2014-01-20

o Fixed the warning reported by compiler "ISO C++ forbids variable length array ‘v’ [-Wvla]" in file "KFKSDS-steady-v2.cpp".

o Removed some unused variables from files "KFKSDS-steady-v2.cpp" and "KFKSDS-steady.cpp".

Version 1.1 2014-01-26

o First version on CRAN.

Version 1.0 2014-01-25

o First version submitted to CRAN.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("stsm")

1.9 by Javier López-de-Lacalle, 5 years ago


http://jalobe.com


Browse source code at https://github.com/cran/stsm


Authors: Javier López-de-Lacalle <[email protected]>


Documentation:   PDF Manual  


Task views: Time Series Analysis


GPL-2 license


Imports KFKSDS, methods, parallel, stats

Suggests mvtnorm, numDeriv


Suggested by KFKSDS.


See at CRAN