fit_AR1_Gaussian: Fit Gaussian AR(1) model to time series with missing values...

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

View source: R/estimate_impute_AR1_Gaussian.R

Description

Estimate the parameters of a univariate Gaussian 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 individual 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 in one shot. With missing values, the iterative EM algorithm is employed for the estimation until converge is achieved.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
fit_AR1_Gaussian(
  y,
  random_walk = FALSE,
  zero_mean = FALSE,
  remove_outliers = FALSE,
  outlier_prob_th = 0.001,
  verbose = TRUE,
  return_iterates = FALSE,
  return_condMeanCov = FALSE,
  tol = 1e-08,
  maxiter = 100
)

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).

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_condMeanCov

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).

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).

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).

f_iterates

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

cond_mean_y

Numeric vector (of same length as argument y) with the conditional mean of the time series (excluding the leading and trailing missing values) given the observed data (returned only when return_condMeanCov = TRUE).

cond_cov_y

Numeric matrix (with number of columns/rows equal to the length of the argument y) with the conditional covariance matrix of the time series (excluding the leading and trailing missing values) given the observed data (returned only when return_condMeanCov = 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.

Author(s)

Junyan Liu and Daniel P. Palomar

References

R. J. Little and D. B. Rubin, Statistical Analysis with Missing Data, 2nd ed. Hoboken, N.J.: John Wiley & Sons, 2002.

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_Gaussian, fit_AR1_t

Examples

1
2
3
4
library(imputeFin)
data(ts_AR1_Gaussian)
y_missing <- ts_AR1_Gaussian$y_missing
fitted <- fit_AR1_Gaussian(y_missing)

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