How to find the optimal p for AR model
5 views (last 30 days)
Show older comments
Hi everyone,
I now have a nitrate time series and I have decomposed it with an additive model, which is Y=T+S+R. I hope to find the best-fit AR(p) model for my residuals. I read from some papers that Mann-Wald process could be used. It would be really great if someone could provide a code on how to find the p. Below is my nitrate residuals. Thanks!
0.160157983184890 2.17307720054057 1.52955989565626 1.45006890417194 2.45078566444762 1.82790551974331 2.69034445775899 4.42816184597468 2.34540928553036 2.68279049780604 1.62871903928173 0.508296837837410 -1.62288362596995 1.00584965715162 -0.543055573966803 0.444003915314771 1.52210606035635 2.59531316141792 2.23891089519949 3.05301642518107 3.10129331550264 0.429833321544216 -0.483079342214210 0.722657253107364 -2.30055733593411 -1.25196701104664 -1.31637009539918 -0.531355848351714 0.193111664455751 1.34662635028322 1.17338288183068 1.38414720557814 0.521082891665609 -0.939218305526926 0.469027827480539 3.37592322056800 2.33001561329242 3.25061121894578 1.20307030535913 1.16590066017249 1.22124884474584 0.251845091339198 1.67106041465255 1.28918353716591 1.18477801701926 0.0406356165926184 -0.0849594546340268 -1.09190526778067 -2.24995407529036 -2.44871656287112 -1.47128179369187 -0.438992641112626 0.582514336226620 1.16346937958587 1.01304349966511 0.941625416944357 1.37737869456360 -0.790604913097152 -0.566041187557907 -0.880828206938661 -2.85271821768246 -2.62150501849733 -2.32172834455219 -1.72158039620705 -1.13491462210192 2.23399921602322 -0.185267868131646 0.230972844913491 0.841384917298627 -1.66993989159624 -2.26121737129110 -2.65584559490597 -3.72157680988388 -3.18420481493285 -1.57576934422182 -1.59696260111080 -0.875138030239769 -1.32156539734874 -0.119673685737717 0.327725823073310 0.0342966932243356 -0.746369320904637 -2.41098800583361 -3.41195743268258 -3.19052985189460 -3.45549906417769 -2.47420479670077 -2.27343925682385 -1.84095589118694 -0.720724461530018 -0.385173953153102 -0.0366156505761843 -0.184385984659268 -1.31839320302235 -0.627853090185433 -1.23616372126852 0.594922655285354 0.629612240768162 0.680365300010968 0.0264896376537763 -1.57986819994342 -1.29947797852061 -0.541768674377802 -0.0945515750349948 0.341836886647812 -0.419011535949380 -0.965312627346572 -1.65496446266376 -2.05971929034400 -1.59887091009531 -2.04045905108661 -1.84717592067791 -0.914874961509212 -0.226825944320514 1.11411769358818 0.0414180536968818 0.403965307145579 -1.19572431668572 -1.37686661331702 -2.79685965286833 -2.17045568678267 -2.08344851076809 -1.18137785499350 0.230564069181090 0.881023826115679 0.0227316420702668 -0.530741462255145 -0.357706770380556 0.0349992798340315 -0.698531551231380 -1.05651505209679 -4.02404929588220 -2.89478653203066 -2.49912055925018 -2.47739111070970 -1.41929038776922 -0.575671836068746 -0.598305226348267 0.251380466092211 1.14757395173269 -0.00256120028683160 -1.54793323558635 -1.95875793968587 -4.12723338970539 -2.33071182708796 -1.53588705954159 -0.795498819235224 -0.171239299528854 1.98353804593751 0.109563456423885 -0.767092058369746 0.577760226036623 0.131283870782992 -0.430929367750639 -0.290095279084269 0.705388069662101 1.21076842304542 -0.961248012642317 -1.03140097157006 -0.115282656097797 -1.94334651886554 -0.838662314613278 -1.00965903164102 -0.513147954468758 -0.0424655139564996 -1.40851995472424 -1.22502706929198 0.586615073220280 2.16315422436950 1.62729658344764 0.212002419285794 1.55057952852394 -0.763825535477906 0.377017466540245 0.0813795432783944 0.639249419216544 -0.193509344505306 2.11279500549285 2.01474669169100 -1.00665237203085 0.375245576884251 0.344746729728291 0.435311359332332 -0.988452728663628 0.0468009991004125 0.0158027948844535 1.18002366838849 0.519252337092534 0.898752374136574 0.100515518900615 -0.281874001135344 0.713085731908695 -1.09165752441031 -2.17499757480038 -2.10387414943045 -1.77597944666052 -0.335066915130585 -0.670506325580654 0.393873344689276 -0.213639190840792 -0.828080362030862 -1.39885841850093 -1.82138914777100 -2.41957061596107 1.72474492348582 0.637563669861638 0.321345894997459 -0.755900606466719 -2.14292928117090 -2.80640989885508 -1.73387142881925 -1.20402517258343 -0.536207547007612 -1.73462680671179 -2.56629873921597 -3.79432141264014 -2.94124707742737 -1.04946953428566 -0.898328514383944 0.774783777917767 3.60581389697948 2.61549207606119 2.76878934386290 -0.744105601135384 0.0338708192063266 1.60881035226804 1.63889721452975 1.09333333887146 1.23066646885013 0.306902806757731 0.514602623425335 0.356773715492936 -1.77063737567946 -1.12520039783186 -2.26704433826426 -2.17208048749665 -0.219945266389052 0.984453062438551 4.21439872146615 10.6309936395738 9.58348556531831 4.84058069899181 3.25023931042530 2.76976919525879 1.30981690685228 1.62141267746578 1.80372752879927 1.38985018133276 2.03514418820625 1.38900131579975 -0.0668942244067584 0.495559489466734 -0.124789789022819 0.229564143416563 0.229581547615947 0.273870225215330 1.82887673657471 1.85863130295410 1.18370495705348 0.587686401352863 1.44833920699225 0.397255127351630 0.528218379911014 3.31003088855040 3.85584040582673 3.65225313103201 2.73822933399728 1.88907681036256 1.00744211748783 2.54305547663310 1.16348792049838 0.774428165563654 -0.157960233031073 -0.634385520905799 -0.874163468580525 -0.621292162175251 -0.0626238501330239 0.257947670838141 -0.280817329430694 -0.193811057299531 -0.206486957408366 0.0863852015027977 -0.881223561866039 -0.774924524034874 0.828845879136291 1.08787938602746 -1.24653976888138 -1.39630966371022 -2.43148255990210 -1.19245223716504 -0.186158441667991 2.20900662222907 1.73238951688612 0.953620476563174 2.39637050596023 1.36212834255728 1.19055753649434 1.99474984415139 0.524489482008449 -0.385121619054498 0.361164285519512 -0.610946599977543 -0.0421940147145987 -0.0471701500516536 -0.456328459628708 -0.816938703185762 -0.231329876022817 0.558086756340128 0.347174743043072 4.07052584846602 2.45642428408896 2.17897197679191 0.563416677131806 1.06146458540064 -0.415624030570522 -0.318141367141684 -0.259940878952849 1.61980766225599 0.778375292184820 -0.00854928268634358 0.530197499782492 -0.00279259602867288 0.940064630360165 3.74897112182900 3.04957461793479 2.30278132196951 1.40255150376424 1.38919295895897 0.0974522399136985 0.133559588888423 0.612486007583148 -1.31357977552212 0.332425808712600 -0.741205491332674 1.26801053182205 2.64687581605678 1.38863810792846 1.73500360772908 0.906932585289691 0.0380328362503098 0.0930509169709258 0.471917055711543 0.832802270172159 0.327095283832775 0.200359660833392 -0.307012841445991 -0.207738021525375 2.98568605947524 2.52960714711281 2.30613144267932 1.43821921600583 4.66417826273233 2.41865513621884 1.17408007572535 -0.968475910048146 -1.06672410162164 0.435699070144867 -0.679114644368625 1.52121897631788 1.66340185208439 1.10648173548785 0.756164826820247 1.72841139591265 2.79052923840504 1.06346490465744 -0.0409513640701629 -0.386648549077766 -1.06953794088537 -0.520855978352972 1.45028910589943 1.25068152235183 -0.195976806115778 -1.33073812694643 -0.110896239848139 0.792509125010148 0.900885761268438 0.0725802262867249 -0.498077241674988 -1.13091563691670 -1.05444623295841 -0.307505475660124 -1.27820159064184 -1.73985038542355 -0.0304499151252560 -5.12133439419001 -4.62070827832584 -3.96203870770166 -2.67526216267748 -1.57287548189330 -2.88789757708912 -1.62167717956495 -2.11834897984077 -1.28414942177659 -1.70968674699241 4.62332326199177 -1.62001747194405 1.76553879575708 0.946698274387148 0.0514212307772164 -1.44598453843271 -3.22087248488264 -2.62551236631258 -1.79483316802251 -2.78364617353244 -3.25328781670237 -2.00766635015230 -3.04849754640223 -4.02067948957216 2.85603558089486 3.67835385529082 3.55423560744678 -0.964816690997261 -0.0707405176813029 -1.95922160334534 -1.69738360428939 -1.88503782003342 -1.86352066543747 -0.426740398121506 -0.926412799605548 -1.16743594600959 4.46043791522332 0.513914985385175 -0.609044463692976 0.635867352628874 -1.54670300128928 -1.04902528518743 -1.43602850036557 0.0674760866562765 0.630152029018126 -0.636908900900024 0.0995774943818254 0.0697131407436751 -1.49125420025752 0.793381664670220 0.451581008357960 -3.26734837355430 0.556240070293440 0.611776578161180 -0.970767841251080 0.0538955415366611 -0.587269719335599 -0.663171856487859 0.0461733355598827 -1.80923222131238 -2.01404076954768 0.436753893145947 -0.153887963400423 -0.146658553546792 -0.966911317933161 -0.326916009299530 -0.841601633945901 -1.88577945139227 -0.590785914498639 1.08947074111499 1.08327472192862 -1.99427203217775 0.702078213352839 0.161031670812359 -0.305451395968119 -0.0870631873485989 -1.05615714796908 -0.165003055569557 -0.773529877450035 -2.27154890113051 -1.13039657147099 -0.903981119091473 -1.86901833951195 1.79459369914757 2.51410274444404 1.16521499766946 0.926890728654869 0.286437729040281 -0.598197438814308 -2.16248454264890 -0.796552569763486 -1.39341280067807 -1.80610167425266 -2.10682742810725 -2.98740584776184 -3.87424976333643 0.251032824725939 -0.286696126282760 2.52313840046854 -0.832855802380152 -1.04293216946885 -1.20446048253755 -1.24396971188625 -2.56137115303494 -2.79960122284364 -2.93416817993234 -2.09188780882104 4.93404181737026 6.02886845419852 1.95429829895571 0.760291621472907 0.411885251390097 0.264538642067290 0.607469126764484 0.604118691181675 -0.442123951201132 -0.900795234243940 4.35409660743325 4.04753577531044 0.174624200267637 -0.994390369138215 0.962198273384867 -0.532649610332050 0.390373785351033 -0.889085000205883 0.621704283257200 -0.382187354559718 -0.182271203176635 -0.624783684453552 0.571266947989530 0.0875649126326145 -1.81088786764430 0.836256360715734 0.439003797004706 0.755314711053681 0.484496895502654 -0.453803086288373 0.753144987940602 -0.524587859110426 -1.03181290496145 -0.819866594472480 -0.122657165263506 0.528099596145467 -1.38249438836556 -0.704191361239631 -0.470285127184769 -2.24286389536990 -0.0924744411550401 0.920384369819825 -0.961508756185312 -0.978082804470449 -0.264149055555584 0.188956052699280 -1.13267572632586 -0.310760169150993 -1.35019535689613 -1.99073353500431 -2.53566850718355 -1.48704000260280 -0.860540224622045 -0.981522618881289 -0.0122569541205351 -0.437672201639781 2.75959194904097 -0.798315758938272 5.35121126480248 3.64428561574324 0.276009223763989 -4.23121581557830 -0.717146338991657 -0.867359035645010 -0.709700457898366 -0.819524061391721 -1.57909959586508 -1.10335605361843 1.53743933782821 -1.46168201238514 -2.03099619687850 -2.43676305417185 4.07611935261479 -2.98386917296161 -2.14885749960907 1.67622748050346 0.415044854015996 2.85138005228853 -0.722036694418932 0.0648656475936020 -1.11772421519386 1.62089454035867 -1.06929811336879 1.87109382810374 0.750135030656278 0.113073237845765 -1.77166313103581 1.54871954584262 -0.484093911878955 1.32618970415947 0.273931763217895 2.47184567199632 0.745561821974748 -0.436697879706828 1.03975741733160 0.582856264570025 0.328056260888449 1.15215326084383 1.16185347172814 1.68511716037246 0.213760721416778 -0.0100950887789047 0.728805765045413 -0.746974307410273 3.81753391533404 0.311652508418360 2.93081470622268 0.713524247226995 2.98988303431131
0 Comments
Accepted Answer
Roger Wohlwend
on 24 Jul 2015
You could use the Akaike or the Bayesian Information criterion (Matlab function aicbic). Also consult the page "Choosing ARMA lags using BIC" in the Matlab documentation.
A less sophisticated way is to try different values for p, estimate the model in each case and choose the p where the model's residual are free of autocorrelation.
The Matlab function parcorr suggests that the optimal value for p is 1 in your case. Indeed, for p = 1 the model seem to be quite good. The residuals are free of autocorrelation, the R-square is 0.35 and the coefficient is significant.
More Answers (0)
See Also
Categories
Find more on Conditional Mean Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!