简体   繁体   中英

demean and intercept in ar.ols()

The prototype of ar.ols() is

ar.ols(x, aic = TRUE, order.max = NULL, na.action = na.fail,
            demean = TRUE, intercept = demean, series, ...)

demean: should the AR model be for ‘x’ minus its mean?

intercept: should a separate intercept term be fitted?

I wonder what differences are between demean and intercept? Thanks!

demean controls whether the data are demeaned before fitting the autoregressive model. If demean=TRUE , then you know in advance that the intercept will be 0 (up to rounding, machine, and other fitting error); as a result, intercept is by default quite sensibly set to intercept=demean .

In case you do still want the intercept term from a model fitted to the demeaned data, or in case you want to fit a model with no intercept to the un-demeaned data, ar.ols() gives you two arguments that support all possible permutations of data demeaning and intercept fitting:

x <- diff(log(EuStockMarkets))

## Equivalent to ar.ols( ... , demean = TRUE)$x.intercept
ar.ols(x, order.max = 6, demean = TRUE, intercept = TRUE)$x.intercept
#           DAX           SMI           CAC          FTSE 
#  5.108542e-06 -2.477317e-06  6.641355e-06 -3.423321e-06 

ar.ols(x, order.max = 6, demean = TRUE, intercept = FALSE)$x.intercept
# NULL

ar.ols(x, order.max = 6, demean = FALSE, intercept = TRUE)$x.intercept
#          DAX          SMI          CAC         FTSE 
# 0.0006940672 0.0007812742 0.0004866072 0.0004387839 

## Equivalent to ar.ols( ..., demean = FALSE)$x.intercept
ar.ols(x, order.max = 6, demean = FALSE, intercept = FALSE)$x.intercept
# NULL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM