# getOrderAIC: Get order of sequence based on AIC value In MOrder: Check Time Homogeneity and Markov Chain Order

## Description

Takes a sequence as input and find AIC value for diffrent orders

## Usage

 `1` ```getOrderAIC(seq) ```

## Arguments

 `seq` - A sequence whose order to be determined

## Value

Returns nothing but prints order of given sequence according to AIC value

## References

[1] Estimating the order of Markov chain Richard Katz Technometrics, vol 12 no 3 (August 1981) pp 243-249

[2] Determination of the Order of a Markov Chain L.C.Zhao, C.C.Y.Dorea and C.R.Goncalves Statistical inference for stochastic processes4, 2001 pp 273-282

[3] Statistical inference about Markov Chain T.W.Anderson and Leo.A.Goodman. The Annals of Mathematical Statistics, Vol 28, No 1 (March 1957), pp89-110

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```## Check a first order sequence seq <- c(1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2) getOrderAIC(seq) ## Check for second order sequence seq <- c(1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2) getOrderAIC(seq) ## Check for random order sequence seq <- sample(1:2,50,replace=TRUE) getOrderAIC(seq) ```

### Example output

```      test1              test2               test3
Order "0"                "1"                 "2"
AIC   "12.4214316577106" "-26.2818494123692" "-22.1709307571216"
test4
Order "3"
AIC   "-14.0600121018741"
[1] "The order for the given sequence is: 1"
test1              test2              test3
Order "0"                "1"                "2"
AIC   "18.0101077184752" "23.8030862821569" "-22.1035107181591"
test4
Order "3"
AIC   "-14.1035107181591"
[1] "The order for the given sequence is: 2"
test1               test2               test3
Order "0"                 "1"                 "2"
AIC   "-7.48068858424547" "-3.60225679442892" "-4.09366957592232"
test4
Order "3"
AIC   "-3.80734549513796"
[1] "The given sequence is a random sequence"
```

MOrder documentation built on May 2, 2019, 2:43 p.m.