Skip to contents

Allows the finite-difference interval to be altered for recomputation of the covariance estimate for fracdiff.

Usage

fracdiff.var(x, fracdiff.out, h)

Arguments

x

a univariate time series or a vector. Missing values (NAs) are not allowed.

fracdiff.out

output from fracdiff for time series x.

h

finite-difference interval length (\( > 0\)) for approximating partial derivatives with respect to the d parameter. Typically smaller than the one in fracdiff.out

Value

an object of S3 class "fracdiff", i.e., basically a list with the same elements as the result from fracdiff, but with possibly different values for the hessian, covariance, and correlation matrices and for standard error, as well as for h.

See also

fracdiff, also for references.

Examples

## Generate a fractionally-differenced ARIMA(1,d,1) model :
set.seed(5) # reproducibility; x86_64 Lnx: get warning
tst <- fracdiff.sim(500, ar = .2, ma = .4, d = .3)$series
## estimate the parameters in an ARIMA(1,d,1) model for the simulated series
fd.out <- fracdiff(tst, nar= 1, nma = 1) # warning ... maybe change 'h'
#> Warning: unable to compute correlation matrix; maybe change 'h'
summary(fd.out)## *** Warning ... {has been stored} --> h = 7.512e-6
#> 
#> Call:
#>   fracdiff(x = tst, nar = 1, nma = 1) 
#> 
#> *** Warning during (fdcov) fit: unable to compute correlation matrix; maybe change 'h'
#> 
#> Coefficients:
#>    Estimate
#> d     0.192
#> ar   -0.178
#> ma   -0.105
#> sigma[eps] = 1.004643 
#> [d.tol = 0.0001221, M = 100, h = 7.512e-06]
#> Log likelihood: -711.9 ==> AIC = 1431.791 [4 deg.freedom]

## Modify the covariance estimate by changing the finite-difference interval
(fd.o2 <- fracdiff.var(tst, fd.out, h = 1e-3))
#> Warning: unable to compute correlation matrix
#> 
#> Call:
#>   fracdiff(x = tst, nar = 1, nma = 1) 
#> 
#> *** Warning during (fdcov) fit: unable to compute correlation matrix
#> 
#> Coefficients:
#>          d         ar         ma 
#>  0.1918496 -0.1781438 -0.1049334 
#> sigma[eps] = 1.004643 
#> a list with components:
#>  [1] "log.likelihood" "n"              "msg"            "d"             
#>  [5] "ar"             "ma"             "covariance.dpq" "fnormMin"      
#>  [9] "sigma"          "h"              "d.tol"          "M"             
#> [13] "hessian.dpq"    "length.w"       "residuals"      "fitted"        
#> [17] "call"          
## looks identical as  print(fd.out),
## however these (e.g.) differ :
vcov(fd.out)
#>                 d          ar1           ma1
#> d    3.610981e-05 -0.000372514 -0.0003371863
#> ar1 -3.725140e-04 -0.725193019 -0.7230589205
#> ma1 -3.371863e-04 -0.723058921 -0.7189341733
vcov(fd.o2)
#>                d         ar1         ma1
#> d    0.001991375 -0.02054336 -0.01859511
#> ar1 -0.020543359 -0.51710714 -0.53470704
#> ma1 -0.018595112 -0.53470704 -0.54844481

## A case, were the default variance is *clearly* way too small:
set.seed(1); fdc <- fracdiff(X <- fracdiff.sim(n=100, d=0.25)$series)
fdc
#> 
#> Call:
#>   fracdiff(x = X <- fracdiff.sim(n = 100, d = 0.25)$series) 
#> 
#> Coefficients:
#>         d 
#> 0.1140946 
#> sigma[eps] = 0.8891445 
#> a list with components:
#>  [1] "log.likelihood"  "n"               "msg"             "d"              
#>  [5] "ar"              "ma"              "covariance.dpq"  "fnormMin"       
#>  [9] "sigma"           "stderror.dpq"    "correlation.dpq" "h"              
#> [13] "d.tol"           "M"               "hessian.dpq"     "length.w"       
#> [17] "residuals"       "fitted"          "call"           
# Confidence intervals just based on asymp.normal approx. and std.errors:
confint(fdc) # ridiculously too narrow
#>       2.5 %    97.5 %
#> d 0.1140919 0.1140973