| Title: | Copula-Based Estimator for Long-Range Dependent Processes under Missing Data |
|---|---|
| Description: | Implements the copula-based estimator for univariate long-range dependent processes introduced in Pumi et al. (2024) <doi:10.1007/s00362-023-01418-z>. The estimator handles missing data and gaps directly without requiring prior imputation, and has been shown to perform well even when up to 70% of observations are missing (as reported in Pumi et al., 2023 <doi:10.48550/arXiv.2303.04754>), outperforming several commonly applied estimators. |
| Authors: | Taiane Schaedler Prass [aut, cre, com] (ORCID: <https://orcid.org/0000-0003-3136-909X>), Guilherme Pumi [aut, ctb] (ORCID: <https://orcid.org/0000-0002-6256-3170>) |
| Maintainer: | Taiane Schaedler Prass <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.2.0 |
| Built: | 2026-11-22 23:40:47 UTC |
| Source: | https://github.com/cran/PPMiss |
This function calculates the coefficients corresponding
to ,
up to a truncation point.
arfima.coefs(ar = NULL, ma = NULL, d = 0, trunc = 1)arfima.coefs(ar = NULL, ma = NULL, d = 0, trunc = 1)
ar |
the coefficients of the autoregressive polynomial. Default is
|
ma |
the coefficients of the moving average polynomial. Default is
|
d |
the long memory parameter. Default is |
trunc |
the truncation point. Default is |
The coefficients values up to order ‘trunc’.
cks <- arfima.coefs(d = 0.3, trunc = 5) cks cks <- arfima.coefs(d = 0.1, trunc = 5, ar = 0.5, ma = 0.6) ckscks <- arfima.coefs(d = 0.3, trunc = 5) cks cks <- arfima.coefs(d = 0.1, trunc = 5, ar = 0.5, ma = 0.6) cks
Let be the copula parameter associated with
and be an estimate of
based on pseudo-observations. Given a set of positive integer lags
(by default ),
the long memory parameter is estimated by
where denotes the sample variance of the observed series
and is the estimated constant returned by
k1fun.
d.fit( xt, copula = gauss, dCdtheta = dCtheta_gauss, theta.lower = -1, theta.upper = 1, optim.method = "Brent", method = "mpl", s = 1, m = 24, theta.start = 0.1, empirical = TRUE, r = 2, a = 0, d.interval = c(-0.5, 0.5), lags = NULL, na.action = c("omit", "approx"), thetas = NULL, full.output = FALSE )d.fit( xt, copula = gauss, dCdtheta = dCtheta_gauss, theta.lower = -1, theta.upper = 1, optim.method = "Brent", method = "mpl", s = 1, m = 24, theta.start = 0.1, empirical = TRUE, r = 2, a = 0, d.interval = c(-0.5, 0.5), lags = NULL, na.action = c("omit", "approx"), thetas = NULL, full.output = FALSE )
xt |
a numeric vector with the observed time series. Missing
observations ( |
copula |
an object of class ‘copula’. Readily available options
are |
dCdtheta |
a two-parameter function that returns the limit of the
copula derivative, with respect to |
theta.lower |
the lower bound for |
theta.upper |
the upper bound for |
optim.method |
a character string specifying the optimization method.
For all available options see |
method |
a character string specifying the copula parameter
estimator used. This can be one of ‘mpl’, ‘itau’,
‘irho’, ‘itau.mpl’, or ‘ml’. See
|
s |
integer. The smallest lag |
m |
integer. The largest lag |
theta.start |
starting value for the parameter optimization via
|
empirical |
logical. If |
r |
the exponent used in the Minkowski distance used to calculate
|
a |
the value of |
d.interval |
a numeric vector of length 2 giving the lower and upper
bounds for the long memory parameter |
lags |
optional integer vector specifying arbitrary lags |
na.action |
character string controlling how lags with no complete pairs
or failed copula fits are handled. If ‘omit’ (default), failed lags
are dropped from the objective sum. If ‘approx’, missing copula
estimates are linearly interpolated over |
thetas |
optional numeric vector of precomputed copula parameter
estimates |
full.output |
logical. If |
If full.output = FALSE, a numeric scalar giving .
If full.output = TRUE, a list with components:
the estimated long memory parameter .
named numeric vector of estimated copula parameters
.
integer vector of lags considered.
the estimated constant returned by
k1fun.
Pumi, G., Prass, T. S., & Lopes, S. R. C. (2024). A novel copula-based approach for parametric estimation of univariate time series through its covariance decay. Statistical Papers, 65(2), 1041–1063. doi:10.1007/s00362-023-01418-z
Pumi, G., Choque Ulloa, G., & Prass, T. S. (2023). Estimation of long-range dependent models with missing data: to impute or not to impute? arXiv preprint. doi:10.48550/arXiv.2303.04754
theta.fit, k1fun,
PPMiss.copulas
# Helper to fit all four built-in copulas to a series fit_all <- function(series) { c( FRANK = d.fit( xt = series, copula = frank, dCdtheta = dCtheta_frank, theta.lower = -100, theta.upper = 100 ), AMH = d.fit(xt = series, copula = amh, dCdtheta = dCtheta_amh), FGM = d.fit(xt = series, copula = fgm, dCdtheta = dCtheta_fgm), GAUSS = d.fit(xt = series, copula = gauss, dCdtheta = dCtheta_gauss) ) } #------------------------- # ARFIMA(0, d, 0) process #------------------------- set.seed(123) trunc <- 5000 n <- 1000 cks <- arfima.coefs(d = 0.25, trunc = trunc) eps <- rnorm(trunc + n) x <- sapply(1:n, function(t) sum(cks * rev(eps[t:(t + trunc)]))) # Complete series vs. 20% missing observations xt <- x xt[sample(1:n, size = round(0.2 * n))] <- NA rbind(Complete = fit_all(x), Missing = fit_all(xt)) # Estimation using arbitrary lags and returning full output res <- d.fit(xt = xt, lags = c(1, 2, 5, 10, 20), full.output = TRUE) res$d res$thetas #------------------------- # ARFIMA(1, d, 1) process #------------------------- # For a faster algorithm to generate ARFIMA processes, see package "arfima" cks <- arfima.coefs(d = 0.35, trunc = trunc, ar = -0.2, ma = 0.4) eps <- rnorm(trunc + n) x <- sapply(1:n, function(t) sum(cks * rev(eps[t:(t + trunc)]))) xt <- x xt[sample(1:n, size = round(0.2 * n))] <- NA rbind(Complete = fit_all(x), Missing = fit_all(xt))# Helper to fit all four built-in copulas to a series fit_all <- function(series) { c( FRANK = d.fit( xt = series, copula = frank, dCdtheta = dCtheta_frank, theta.lower = -100, theta.upper = 100 ), AMH = d.fit(xt = series, copula = amh, dCdtheta = dCtheta_amh), FGM = d.fit(xt = series, copula = fgm, dCdtheta = dCtheta_fgm), GAUSS = d.fit(xt = series, copula = gauss, dCdtheta = dCtheta_gauss) ) } #------------------------- # ARFIMA(0, d, 0) process #------------------------- set.seed(123) trunc <- 5000 n <- 1000 cks <- arfima.coefs(d = 0.25, trunc = trunc) eps <- rnorm(trunc + n) x <- sapply(1:n, function(t) sum(cks * rev(eps[t:(t + trunc)]))) # Complete series vs. 20% missing observations xt <- x xt[sample(1:n, size = round(0.2 * n))] <- NA rbind(Complete = fit_all(x), Missing = fit_all(xt)) # Estimation using arbitrary lags and returning full output res <- d.fit(xt = xt, lags = c(1, 2, 5, 10, 20), full.output = TRUE) res$d res$thetas #------------------------- # ARFIMA(1, d, 1) process #------------------------- # For a faster algorithm to generate ARFIMA processes, see package "arfima" cks <- arfima.coefs(d = 0.35, trunc = trunc, ar = -0.2, ma = 0.4) eps <- rnorm(trunc + n) x <- sapply(1:n, function(t) sum(cks * rev(eps[t:(t + trunc)]))) xt <- x xt[sample(1:n, size = round(0.2 * n))] <- NA rbind(Complete = fit_all(x), Missing = fit_all(xt))
Calculates an estimate for the constant given by
where , is the marginal
distribution function (with density and quantile function
), and is such that (the product
copula).
k1fun(dCdtheta, fun, data, empirical, mean = 0, sd = 1)k1fun(dCdtheta, fun, data, empirical, mean = 0, sd = 1)
dCdtheta |
a function providing the limit as |
fun |
optionally, a function providing an estimator for the probability density function. |
data |
the observed time series. Only used to obtain the quantile
function when |
empirical |
logical. If |
mean |
the mean of the Gaussian distribution. Only used if
|
sd |
the standard deviation of the Gaussian distribution. Only used if
|
Here and are replaced by sample estimators for these
functions or the Gaussian density and quantile functions are used, depending
on the context.
The function kdens is used as sample estimator of and
quantile is the sample estimator of .
The value of .
set.seed(123) trunc <- 500 n <- 200 cks <- arfima.coefs(d = 0.25, trunc = trunc) eps <- rnorm(trunc + n) x <- sapply(1:n, function(t) sum(cks * rev(eps[t:(t + trunc)]))) # kernel density function dfun <- kdens(x) # calculating K1 using four copulas and empirical estimates for F' & F^{-1} K1_frank_e <- k1fun( dCdtheta = dCtheta_frank, fun = dfun, data = x, empirical = TRUE ) K1_amh_e <- k1fun( dCdtheta = dCtheta_amh, fun = dfun, data = x, empirical = TRUE ) K1_fgm_e <- k1fun( dCdtheta = dCtheta_fgm, fun = dfun, data = x, empirical = TRUE ) K1_gauss_e <- k1fun( dCdtheta = dCtheta_gauss, fun = dfun, data = x, empirical = TRUE ) # calculating K1 using four copulas and Gaussian marginals K1_frank_g <- k1fun( dCdtheta = dCtheta_frank, fun = NULL, data = NULL, empirical = FALSE, mean = mean(x), sd = sd(x) ) K1_amh_g <- k1fun( dCdtheta = dCtheta_amh, fun = NULL, data = NULL, empirical = FALSE, mean = mean(x), sd = sd(x) ) K1_fgm_g <- k1fun( dCdtheta = dCtheta_fgm, fun = NULL, data = NULL, empirical = FALSE, mean = mean(x), sd = sd(x) ) K1_gauss_g <- k1fun( dCdtheta = dCtheta_gauss, fun = NULL, data = NULL, empirical = FALSE, mean = mean(x), sd = sd(x) ) # comparing results data.frame( MARGINAL = c("Empirical", "Gaussian"), FRANK = c(K1_frank_e, K1_frank_g), AMH = c(K1_amh_e, K1_amh_g), FGM = c(K1_fgm_e, K1_fgm_g), GAUSS = c(K1_gauss_e, K1_gauss_g) )set.seed(123) trunc <- 500 n <- 200 cks <- arfima.coefs(d = 0.25, trunc = trunc) eps <- rnorm(trunc + n) x <- sapply(1:n, function(t) sum(cks * rev(eps[t:(t + trunc)]))) # kernel density function dfun <- kdens(x) # calculating K1 using four copulas and empirical estimates for F' & F^{-1} K1_frank_e <- k1fun( dCdtheta = dCtheta_frank, fun = dfun, data = x, empirical = TRUE ) K1_amh_e <- k1fun( dCdtheta = dCtheta_amh, fun = dfun, data = x, empirical = TRUE ) K1_fgm_e <- k1fun( dCdtheta = dCtheta_fgm, fun = dfun, data = x, empirical = TRUE ) K1_gauss_e <- k1fun( dCdtheta = dCtheta_gauss, fun = dfun, data = x, empirical = TRUE ) # calculating K1 using four copulas and Gaussian marginals K1_frank_g <- k1fun( dCdtheta = dCtheta_frank, fun = NULL, data = NULL, empirical = FALSE, mean = mean(x), sd = sd(x) ) K1_amh_g <- k1fun( dCdtheta = dCtheta_amh, fun = NULL, data = NULL, empirical = FALSE, mean = mean(x), sd = sd(x) ) K1_fgm_g <- k1fun( dCdtheta = dCtheta_fgm, fun = NULL, data = NULL, empirical = FALSE, mean = mean(x), sd = sd(x) ) K1_gauss_g <- k1fun( dCdtheta = dCtheta_gauss, fun = NULL, data = NULL, empirical = FALSE, mean = mean(x), sd = sd(x) ) # comparing results data.frame( MARGINAL = c("Empirical", "Gaussian"), FRANK = c(K1_frank_e, K1_frank_g), AMH = c(K1_amh_e, K1_amh_g), FGM = c(K1_fgm_e, K1_fgm_g), GAUSS = c(K1_gauss_e, K1_gauss_g) )
The probability density function is estimated using a kernel
density approach. More specifically, first is
estimated using (default for the function
density) equally spaced points ,
, in the interval ,
where is the bandwidth for the Gaussian kernel density estimator,
chosen by applying Silverman's rule of thumb (the default procedure in
density). A cubic spline interpolation (the default
method for spline) is then applied to the pairs
to obtain for all
.
kdens(x)kdens(x)
x |
the data from which the estimate is to be computed. |
A function that approximates the probability density function.
# creating a time series set.seed(123) trunc <- 500 n <- 200 cks <- arfima.coefs(d = 0.25, trunc = trunc) eps <- rnorm(trunc + n) x <- sapply(1:n, function(t) sum(cks * rev(eps[t:(t + trunc)]))) # kernel density function dfun <- kdens(x) # plot curve(dfun, from = min(x), to = max(x))# creating a time series set.seed(123) trunc <- 500 n <- 200 cks <- arfima.coefs(d = 0.25, trunc = trunc) eps <- rnorm(trunc + n) x <- sapply(1:n, function(t) sum(cks * rev(eps[t:(t + trunc)]))) # kernel density function dfun <- kdens(x) # plot curve(dfun, from = min(x), to = max(x))
Implemented copulas and the corresponding derivative limits as
, where is such that .
An estimate for is obtained based on the copula object used,
and the derivatives are used to obtain an estimate for .
The objects ‘frank’, ‘amh’, ‘fgm’, and ‘gauss’
are shortcuts for copula::frankCopula(),
copula::amhCopula(),
copula::fgmCopula(), and
copula::normalCopula() from package
‘copula’, respectively.
frank dCtheta_frank(u, v) amh dCtheta_amh(u, v) fgm dCtheta_fgm(u, v) gauss dCtheta_gauss(u, v)frank dCtheta_frank(u, v) amh dCtheta_amh(u, v) fgm dCtheta_fgm(u, v) gauss dCtheta_gauss(u, v)
u |
a real number between 0 and 1. |
v |
a real number between 0 and 1. |
An object of class frankCopula of length 1.
An object of class amhCopula of length 1.
An object of class fgmCopula of length 1.
An object of class normalCopula of length 1.
The constant is given by
where and is the marginal
absolutely continuous distribution function (with density and
quantile function ).
Archimedean copula objects of class ‘frankCopula’ or
‘amhCopula’, a Farlie-Gumbel-Morgenstern copula object of class
‘fgmCopula’, or an elliptical copula object of class
‘normalCopula’. For details, see
archmCopula, fgmCopula, and
ellipCopula.
The derivative functions return the limit, as , of the
derivative with respect to , corresponding to each copula.
Estimates the bivariate copula parameter associated with
lagged pairs for a user-specified set of lags ,
based on empirical or Gaussian pseudo-observations.
theta.fit( xt, copula = gauss, theta.lower = -1, theta.upper = 1, optim.method = "Brent", method = "mpl", s = 1, m = 24, theta.start = 0.1, empirical = TRUE, lags = NULL, na.action = c("omit", "approx") )theta.fit( xt, copula = gauss, theta.lower = -1, theta.upper = 1, optim.method = "Brent", method = "mpl", s = 1, m = 24, theta.start = 0.1, empirical = TRUE, lags = NULL, na.action = c("omit", "approx") )
xt |
a numeric vector with the observed time series. Missing
observations ( |
copula |
an object of class ‘copula’. Readily available options
are |
theta.lower |
the lower bound for |
theta.upper |
the upper bound for |
optim.method |
a character string specifying the optimization method.
For all available options see |
method |
a character string specifying the copula parameter
estimator used. This can be one of ‘mpl’, ‘itau’,
‘irho’, ‘itau.mpl’, or ‘ml’. See
|
s |
integer. The smallest lag |
m |
integer. The largest lag |
theta.start |
starting value for the parameter optimization via
|
empirical |
logical. If |
lags |
optional integer vector specifying arbitrary lags |
na.action |
character string controlling how lags with no complete pairs
or failed copula fits are handled. If ‘omit’ (default), failed lags
are returned as |
A named numeric vector with the estimated copula parameters
, named by the corresponding lags.
Pumi, G., Prass, T. S., & Lopes, S. R. C. (2024). A novel copula-based approach for parametric estimation of univariate time series through its covariance decay. Statistical Papers, 65(2), 1041–1063. doi:10.1007/s00362-023-01418-z
set.seed(123) trunc <- 500 n <- 200 cks <- arfima.coefs(d = 0.25, trunc = trunc) eps <- rnorm(trunc + n) x <- sapply(1:n, function(t) sum(cks * rev(eps[t:(t + trunc)]))) # Estimate theta on arbitrary lags th <- theta.fit(xt = x, lags = c(1, 2, 5, 10)) th # Reuse the estimated thetas in d.fit() d.fit(xt = x, thetas = th)set.seed(123) trunc <- 500 n <- 200 cks <- arfima.coefs(d = 0.25, trunc = trunc) eps <- rnorm(trunc + n) x <- sapply(1:n, function(t) sum(cks * rev(eps[t:(t + trunc)]))) # Estimate theta on arbitrary lags th <- theta.fit(xt = x, lags = c(1, 2, 5, 10)) th # Reuse the estimated thetas in d.fit() d.fit(xt = x, thetas = th)