Last data update: 2014.03.03

R: Count the number of parameters in an ARIMA model...
npar.armaR Documentation

Count the number of parameters in an ARIMA model specification.

Description

Count the number of parameters in an ARIMA model specification. When arima==FALSE, just the AR and MA parameters are counted. When arima==TRUE, then the number of difference parameters are also included.

Usage

npar.arma(x, arima=FALSE)
npar.sarma(model, arima=FALSE)
npar.rarma(arma, arima=FALSE)

Arguments

x

An "arima" object in S-Plus or a "Arima" object in R.

model

A model specification in the S-Plus style.

arma

A arma specification in the R style

arima

Logical. TRUE is number of differencings is to be counted.

Value

A scalar number giving the count.

Author(s)

Richard M. Heiberger (rmh@temple.edu)

Examples

co2.arima <-
  if.R(s=
       arima.mle(co2, list(list(order=c(0,1,1)),
                           list(order=c(0,1,1), period=12)))
       ,r=
       arima(co2, 
             order=c(0,1,1),
             seasonal=list(order=c(0,1,1), period=12))
       )

npar.arma(co2.arima)

npar.arma(co2.arima, arima=TRUE)

npar.sarma(list(list(order=c(0,1,1)),
                list(order=c(0,1,1), period=12)))

npar.sarma(list(list(order=c(0,1,1)),
                list(order=c(0,1,1), period=12)),
           arima=TRUE)

if.R(s={},
     r=npar.rarma(co2.arima$arma)
)
if.R(s={},
     r=npar.rarma(co2.arima$arma,
           arima=TRUE)
)

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(HH)
Loading required package: lattice
Loading required package: grid
Loading required package: latticeExtra
Loading required package: RColorBrewer
Loading required package: multcomp
Loading required package: mvtnorm
Loading required package: survival
Loading required package: TH.data
Loading required package: MASS

Attaching package: 'TH.data'

The following object is masked from 'package:MASS':

    geyser

Loading required package: gridExtra
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HH/npar.arma.Rd_%03d_medium.png", width=480, height=480)
> ### Name: npar.arma
> ### Title: Count the number of parameters in an ARIMA model specification.
> ### Aliases: npar.arma npar.rarma npar.sarma
> ### Keywords: ts
> 
> ### ** Examples
> 
> co2.arima <-
+   if.R(s=
+        arima.mle(co2, list(list(order=c(0,1,1)),
+                            list(order=c(0,1,1), period=12)))
+        ,r=
+        arima(co2, 
+              order=c(0,1,1),
+              seasonal=list(order=c(0,1,1), period=12))
+        )
> 
> npar.arma(co2.arima)
[1] 2
> 
> npar.arma(co2.arima, arima=TRUE)
[1] 4
> 
> npar.sarma(list(list(order=c(0,1,1)),
+                 list(order=c(0,1,1), period=12)))
[1] 2
> 
> npar.sarma(list(list(order=c(0,1,1)),
+                 list(order=c(0,1,1), period=12)),
+            arima=TRUE)
[1] 4
> 
> if.R(s={},
+      r=npar.rarma(co2.arima$arma)
+ )
[1] 2
> if.R(s={},
+      r=npar.rarma(co2.arima$arma,
+            arima=TRUE)
+ )
[1] 4
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>