The subset ARp is defined as an AR(p) in which some
of the ar-coefficients are constrained to zero.
This is the usual type of subset AR.
In contrast the ARz model constrains some of the partial
autocorrelation coefficients to zero.
Usage
FitARp(z, p, lag.max = "default", MLEQ = FALSE)
Arguments
z
time series, vector or ts object
p
p specifies the model. If length(p) is 1, an AR(p) is assumed and if p
has length greater than 1, a subset ARp is assumed.
For example, to fit a subset model with lags 1 and 4 present set p to c(1,4) or
equivalently c(1,0,0,4). To fit a subset model with just lag 4, you must use
p=c(0,0,0,4) since p=4 will fit a full AR(4).
lag.max
the residual autocorrelations are tabulated for lags 1, ..., lag.max. Also
lag.max is used for the Ljung-Box portmanteau test.
MLEQ
TRUE, use MLE. FALSE, use LS
Details
Subset ARp model is fit using exact MLE. The built-in arima function is
used for MLE. When MLEQ=FALSE, LS is used. LS is has been widely used
in past for subset ARp fiting.
residual autocorrelations and sd for lags 1, ..., lag.max
LjungBox
table of Ljung-Box portmanteau test statistics
SubsetQ
parameters in AR(p) – including 0's
res
innovation residuals, same length as z
fits
fitted values, same length as z
pvec
lags used in AR model
demean
TRUE if mean estimated otherwise assumed zero
FitMethod
"MLE" or "LS"
IterationCount
number of iterations in mean mle estimation
convergence
value returned by optim – should be 0
MLEMeanQ
TRUE if mle for mean algorithm used
ARModel
"ARp" if FitARp used, otherwise "ARz"
tsp
tsp(z)
call
result from match.call() showing how the function was called
ModelTitle
description of model
DataTitle
returns attr(z,"title")
z
time series data input
Author(s)
A.I. McLeod
References
McLeod, A.I. and Zhang, Y. (2006).
Partial Autocorrelation Parameterization for Subset Autoregression.
Journal of Time Series Analysis, 27, 599-612.
McLeod, A.I. and Zhang, Y. (2008a). Faster ARMA Maximum Likelihood Estimation,
Computational Statistics and Data Analysis
52-4, 2166-2176.
DOI link: http://dx.doi.org/10.1016/j.csda.2007.07.020.
McLeod, A.I. and Zhang, Y. (2008b, Submitted).
Improved Subset Autoregression: With R Package.
Journal of Statistical Software.
#First Example: Fit to AR(4)
set.seed(3323)
phi<-c(2.7607,-3.8106,2.6535,-0.9238)
z<-SimulateGaussianAR(phi,1000)
#MLE using arima
ans1<-FitARp(z,4,MLEQ=TRUE)
ans1
coef(ans1)
#OLS
ans2<-FitARp(z,4,MLEQ=FALSE)
ans2
coef(ans2)
## Not run: #save time building package
#Second Example: Fit subset ARp model
z<-log(lynx)
#MLE
FitARp(z, c(1,2,4,7,10,11),MLEQ=TRUE)
#LS
FitARp(z, c(1,2,4,7,10,11),MLEQ=FALSE)
#Third Example: Use UBIC model selection to fit subset models
z<-log(lynx)
p<-SelectModel(z,ARModel="ARp")[[1]]$p
#MLE #error returned by arima
#ans1<-FitARp(z, p, MLEQ=TRUE)
#ans1
#LS
ans2<-FitARp(z, p, MLEQ=FALSE)
ans2
## End(Not run)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(FitAR)
Loading required package: lattice
Loading required package: leaps
Loading required package: ltsa
Loading required package: bestglm
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FitAR/FitARp.Rd_%03d_medium.png", width=480, height=480)
> ### Name: FitARp
> ### Title: Fit subset ARp Models
> ### Aliases: FitARp
> ### Keywords: ts
>
> ### ** Examples
>
> #First Example: Fit to AR(4)
> set.seed(3323)
> phi<-c(2.7607,-3.8106,2.6535,-0.9238)
> z<-SimulateGaussianAR(phi,1000)
> #MLE using arima
> ans1<-FitARp(z,4,MLEQ=TRUE)
> ans1
AR(4). MLE.
length of series = 1000 , number of parameters = 4
loglikelihood = -11.976 , AIC = 32 , BIC = 51.6
> coef(ans1)
MLE sd Z-ratio
phi(1) 2.7756178 0.01204356 230.464901
phi(2) -3.8317503 0.02691666 -142.356067
phi(3) 2.6691937 0.02691666 99.165105
phi(4) -0.9246365 0.01204356 -76.774352
mu 0.1027028 0.10140000 1.012848
> #OLS
> ans2<-FitARp(z,4,MLEQ=FALSE)
> ans2
AR(4). LS Fit.
length of series = 1000 , number of parameters = 4
loglikelihood = -12.246 , AIC = 32.5 , BIC = 52.1
> coef(ans2)
MLE sd Z-ratio
phi(1) 2.7711904 0.01239365 223.597684
phi(2) -3.8203730 0.02761804 -138.328921
phi(3) 2.6578437 0.02757072 96.400946
phi(4) -0.9193263 0.01234181 -74.488801
mu 0.1027028 0.10168537 1.010006
>
> ## Not run:
> ##D #save time building package
> ##D #Second Example: Fit subset ARp model
> ##D z<-log(lynx)
> ##D #MLE
> ##D FitARp(z, c(1,2,4,7,10,11),MLEQ=TRUE)
> ##D #LS
> ##D FitARp(z, c(1,2,4,7,10,11),MLEQ=FALSE)
> ##D
> ##D #Third Example: Use UBIC model selection to fit subset models
> ##D z<-log(lynx)
> ##D p<-SelectModel(z,ARModel="ARp")[[1]]$p
> ##D #MLE #error returned by arima
> ##D #ans1<-FitARp(z, p, MLEQ=TRUE)
> ##D #ans1
> ##D #LS
> ##D ans2<-FitARp(z, p, MLEQ=FALSE)
> ##D ans2
> ## End(Not run)
>
>
>
>
>
> dev.off()
null device
1
>