fit.pci: Fits the partial cointegration model to a collection of time...

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


Fits the partial cointegration model to a collection of time series


fit.pci(Y, X, 
  pci_opt_method = c("jp", "twostep"), 
  par_model = c("par", "ar1", "rw"), 
  lambda = 0, 
  robust = FALSE, nu = 5)



The time series that is to be modeled. A plain or zoo vector of length n.


A (possibly zoo) matrix of dimensions n x k. If k=1, then this may be a plain or zoo vector.


Specifies the method that will be used for finding the best fitting model. One of the following:

  • "jp" The joint-penalty method (see below)

  • "twostep" The two-step method (see below)

Default: jp


The model used for the residual series. One of the following:

  • "par" The residuals are assumed to follow a partially autoregressive model.

  • "ar1" The residuals are assumed to be autoregressive of order one.

  • "rw" The residuals are assumed to follow a random walk.

Default: par


The penalty parameter to be used in the joint-penalty (jp) estimation method. Default: 0.


If TRUE, then the residuals are assumed to follow a t-distribution with nu degrees of freedom. Default: FALSE.


The degrees-of-freedom parameter to be used in robust estimation. Default: 5.


The partial cointegration model is given by the equations:

Y[t] = beta[1] * X[t,1] + beta[2] * X[t,2] + ... + beta[k] * X[t,k] + M[t] + R[t]

M[t] = rho * M[t-1] + epsilon_M[t]

R[t] = R[t-1] + epsilon_R[t]

-1 < rho < 1

epsilon_M[t] ~ N(0, sigma_M^2)

epsilon_R[t] ~ N(0, sigma_R^2)

Given the input series Y and X, this function searches for the parameter values beta, rho that give the best fit of this model when using a Kalman filter.

If pci_opt_method is twostep, then a two-step procedure is used. In the first step, a linear regression is performed of X on Y to determine the parameter beta. From this regression, a series of residuals is determined. In the second step, a model is fit to the residual series. If par_model is par, then a partially autoregressive model is fit to the residual series. If par_model is ar1, then an autoregressive model is fit to the residual series. If par_model is rw then a random walk model is fit to the residual series. Note that if pci_opt_method is twostep and par_model is ar1, then this reduces to the Engle-Granger two-step procedure.

If pci_opt_method is jp, then the joint-penalty procedure is used. In this method, the parameterbeta are estimated jointly with the parameter rho using a gradient-search optimization function. In addition, a penalty value of lambda * sigma_R^2 is added to the Kalman filter likelihood score when searching for the optimum solution. By choosing a positive value for lambda, you can drive the solution towards a value that places greater emphasis on the mean-reverting component.

Because the joint-penalty method uses gradient search, the final parameter values found are dependent upon the starting point. There is no guarantee that a global optimum will be found. However, the joint-penalty method chooses several different starting points, so as to increase the chance of finding a global optimum. One of the chosen starting points consists of the parameters found through the two-step procedure. Because of this, the joint-penalty method is guaranteed to find parameter values which give a likelihood score at least as good as those found using the two-step procedure. Sometimes the improvement over the two-step procedure is substantial.


An object of class containing the fit that was found. The following components may be of interest


The vector of weights

The standard errors of the components of beta


The estimated coefficient of mean reversion

The standard error of rho


The negative of the log likelihood


The proportion of variance attributable to mean reversion


Matthew Clegg

Christopher Krauss

Jonas Rende


Clegg, Matthew, 2015. Modeling Time Series with Both Permanent and Transient Components using the Partially Autoregressive Model. Available at SSRN:

Clegg, Matthew and Krauss, Christopher, 2018. Pairs trading with partial cointegration. Quantitative Finance, 18(1), 121 - 138.

See Also

egcm Engle-Granger cointegration model

partialAR Partially autoregressive models


##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

YX <- rpci(n=1000, beta=c(2,3,4), sigma_C=c(1,1,1), rho=0.9,sigma_M=0.1, sigma_R=0.2)
fit.pci(YX[,1], YX[,2:ncol(YX)])

partialCI documentation built on May 1, 2019, 8:21 p.m.