impute_AR1_t: Impute missing values of time series based on a Student's t...

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

View source: R/estimate_impute_AR1_t.R

Description

Impute inner missing values (excluding leading and trailing ones) of time series by drawing samples from the conditional distribution of the missing values given the observed data based on a Student's t AR(1) model as estimated with the function fit_AR1_t. Outliers can be detected and removed.

Usage

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

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.

n_samples

Positive integer indicating the number of imputations (default is 1).

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_estimates

Logical value indicating if the estimates of the model parameters 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).

K

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

n_burn

Positive integer controlling the length of the burn-in period of the Gibb sampling (default is 100). The first (n_burn * n_thin) samples generated will be ignored.

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.

Value

By default (i.e., for n_samples = 1 and return_estimates = FALSE), the function will return an imputed time series of the same class and dimensions as the argument y with one new attribute recording the locations of missing values (the function plot_imputed will make use of such information to indicate the imputed values), as well as locations of outliers removed.

If n_samples > 1, the function will return a list consisting of n_sample imputed time series with names: y_imputed.1, y_imputed.2, etc.

If return_estimates = TRUE, in addition to the imputed time series y_imputed, the function will return the estimated model parameters:

phi0

The estimate for phi0 (numeric scalar or vector depending on the number of time series).

phi1

The estimate for phi1 (numeric scalar or vector depending on the number of time series).

sigma2

The estimate for sigma2 (numeric scalar or vector depending on the number of time series).

nu

The estimate for nu (numeric scalar or vector depending on the number of 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

plot_imputed, fit_AR1_t, impute_AR1_Gaussian

Examples

1
2
3
4
5
library(imputeFin)
data(ts_AR1_t) 
y_missing <- ts_AR1_t$y_missing
y_imputed <- impute_AR1_t(y_missing)
plot_imputed(y_imputed)

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