fit_AR1_t: Fit Student's t AR(1) model to time series with missing...

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

View source: R/estimate_impute_AR1_t.R

Description

Estimate the parameters of a univariate Student's t AR(1) model to fit the given time series with missing values and/or outliers. For multivariate time series, the function will perform a number of indidivual univariate fittings without attempting to model the correlations among the time series. If the time series does not contain missing values, the maximum likelihood (ML) estimation is done via the iterative EM algorithm until converge is achieved. With missing values, the stochastic EM algorithm is employed for the estimation (currently the maximum number of iterations will be executed without attempting to check early converge).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
fit_AR1_t(
  y,
  random_walk = FALSE,
  zero_mean = FALSE,
  fast_and_heuristic = TRUE,
  remove_outliers = FALSE,
  outlier_prob_th = 0.001,
  verbose = TRUE,
  return_iterates = FALSE,
  return_condMean_Gaussian = FALSE,
  tol = 1e-08,
  maxiter = 100,
  n_chain = 10,
  n_thin = 1,
  K = 30
)

Arguments

y

Time series object coercible to either a numeric vector or numeric matrix (e.g., zoo or xts) with missing values denoted by NA.

random_walk

Logical value indicating if the time series is assumed to be a random walk so that phi1 = 1 (default is FALSE).

zero_mean

Logical value indicating if the time series is assumed zero-mean so that phi0 = 0 (default is FALSE).

fast_and_heuristic

Logical value indicating whether a heuristic but fast method is to be used to estimate the parameters of the Student's t AR(1) model (default is TRUE).

remove_outliers

Logical value indicating whether to detect and remove outliers.

outlier_prob_th

Threshold of probability of observation to declare an outlier (default is 1e-3).

verbose

Logical value indicating whether to output messages (default is TRUE).

return_iterates

Logical value indicating if the iterates are to be returned (default is FALSE).

return_condMean_Gaussian

Logical value indicating if the conditional mean and covariance matrix of the time series (excluding the leading and trailing missing values) given the observed data are to be returned (default is FALSE).

tol

Positive number denoting the relative tolerance used as stopping criterion (default is 1e-8).

maxiter

Positive integer indicating the maximum number of iterations allowed (default is 100).

n_chain

Positive integer indicating the number of the parallel Markov chains in the stochastic EM method (default is 10).

n_thin

Positive integer indicating the sampling period of the Gibbs sampling in the stochastic EM method (default is 1). Every n_thin-th samples is used. This is aimed to reduce the dependence of the samples.

K

Positive number controlling the values of the step sizes in the stochastic EM method (default is 30).

Value

If the argument y is a univariate time series (i.e., coercible to a numeric vector), then this function will return a list with the following elements:

phi0

The estimate for phi0 (real number).

phi1

The estimate for phi1 (real number).

sigma2

The estimate for sigma^2 (positive number).

nu

The estimate for nu (positive number).

phi0_iterates

Numeric vector with the estimates for phi0 at each iteration (returned only when return_iterates = TRUE).

phi1_iterates

Numeric vector with the estimates for phi1 at each iteration (returned only when return_iterates = TRUE).

sigma2_iterates

Numeric vector with the estimates for sigma^2 at each iteration (returned only when return_iterates = TRUE).

nu_iterate

Numeric vector with the estimates for nu at each iteration (returned only when return_iterates = TRUE).

f_iterates

Numeric vector with the objective values at each iteration (returned only when return_iterates = TRUE).

cond_mean_y_Gaussian

Numeric vector (of same length as argument y) with the conditional mean of the time series (excluding the missing values at the head and tail) given the observed data based on Gaussian AR(1) model (returned only when return_condMean_Gaussian = TRUE).

index_miss

Indices of missing values imputed.

index_outliers

Indices of outliers detected/corrected.

If the argument y is a multivariate time series (i.e., with multiple columns and coercible to a numeric matrix), then this function will return a list with each element as in the case of univariate y corresponding to each of the columns (i.e., one list element per column of y), with the following additional elements that combine the estimated values in a convenient vector form:

phi0_vct

Numeric vector (with length equal to the number of columns of y) with the estimates for phi0 for each of the univariate time series.

phi1_vct

Numeric vector (with length equal to the number of columns of y) with the estimates for phi1 for each of the univariate time series.

sigma2_vct

Numeric vector (with length equal to the number of columns of y) with the estimates for sigma2 for each of the univariate time series.

nu_vct

Numeric vector (with length equal to the number of columns of y) with the estimates for nu for each of the univariate time series.

Author(s)

Junyan Liu and Daniel P. Palomar

References

J. Liu, S. Kumar, and D. P. Palomar, "Parameter estimation of heavy-tailed AR model with missing data via stochastic EM," IEEE Trans. on Signal Processing, vol. 67, no. 8, pp. 2159-2172, 15 April, 2019.

See Also

impute_AR1_t, fit_AR1_Gaussian, fit_VAR_t

Examples

1
2
3
4
library(imputeFin)
data(ts_AR1_t) 
y_missing <- ts_AR1_t$y_missing
fitted <- fit_AR1_t(y_missing)

imputeFin documentation built on Feb. 20, 2021, 9:07 a.m.