Dear all,
I have a question about AutoRegression(AR): whether there is an integrated command to do AR including choosing the optimal lags?
As I know, the procedure of doing AR are:
1.choose the optimal lags "x" of the variable,i.e. find the optimal d.x var for the regression. (the varsoc command can be used for this)
2.reg var d.x var
Actually, to do AR need at least two command: 'varsoc' and 'reg', if I just have one group of time series data, that's fine, however I have a panel data. I want to do AR separately for each individual in the panel data, which means that I need to repeat the two procedures above by many many times(there are above 100 thousand individuals in the data). So I think if there is an integrated command about realizing AR then I can do this by a simple loop command.
Here is the data example and related command:
If you know an integrated command of AR or have the other way to solve my problem,I will be very glad to hear it! Thank you!
I have a question about AutoRegression(AR): whether there is an integrated command to do AR including choosing the optimal lags?
As I know, the procedure of doing AR are:
1.choose the optimal lags "x" of the variable,i.e. find the optimal d.x var for the regression. (the varsoc command can be used for this)
2.reg var d.x var
Actually, to do AR need at least two command: 'varsoc' and 'reg', if I just have one group of time series data, that's fine, however I have a panel data. I want to do AR separately for each individual in the panel data, which means that I need to repeat the two procedures above by many many times(there are above 100 thousand individuals in the data). So I think if there is an integrated command about realizing AR then I can do this by a simple loop command.
Here is the data example and related command:
Code:
clear input long cc float(ym seg1) 32 624 .04445176 32 625 .036192816 32 626 .031618048 32 627 .021474427 32 628 .018776406 32 629 .04074349 32 630 .06222288 32 631 .11409732 32 632 .07309593 32 633 .06792204 32 634 .05304918 32 635 .04487377 32 636 .069375455 32 637 .04845903 32 638 .04594228 32 639 .04550489 32 640 .02831592 32 641 .04477861 32 642 .008422818 32 643 .02045061 32 644 .01491553 32 645 .02663895 32 646 .01889766 32 647 .02050653 32 648 .036607914 32 649 .04809784 32 650 .07823643 32 651 .07154015 32 652 .10459977 32 653 .03831887 32 654 .04900071 32 655 .05963827 32 656 .08837937 32 657 .13331659 32 658 .14064579 32 659 .032867603 32 660 .08356508 32 661 .14442798 32 662 .1650359 32 663 .16835807 32 664 .1584352 32 665 .16954015 32 666 .16671365 32 667 .14384073 32 668 .14769012 32 669 .10536052 32 670 .08170154 32 671 .14344585 32 672 .17022115 32 673 .13671105 32 674 .1110411 32 675 .04305949 32 676 .05226843 32 677 .06650428 32 678 .06246117 32 679 .031141937 32 680 .01348335 32 681 .016822 32 682 .03281092 32 683 .08940174 82 624 .06147674 82 625 .10292392 82 626 .14144202 82 627 .13713068 82 628 .14034407 82 629 .13211797 82 630 .14213976 82 631 .1012358 82 632 .09124867 82 633 .1077327 82 634 .09531018 82 635 .10788896 82 636 .0709384 82 637 .07343553 82 638 .10693694 82 639 .11173867 82 640 .14394651 82 641 .13862461 82 642 .1603671 82 643 .14747722 82 644 .11673568 82 645 .1353928 82 646 .1635395 82 647 .15163447 82 648 .1528629 82 649 .1580043 82 650 .1536663 82 651 .16621074 82 652 .14184435 82 653 .20829704 82 654 .15925044 82 655 .14139512 82 656 .13164993 82 657 .0899644 82 658 .07109592 82 659 .15700375 82 660 .15451227 82 661 .13299246 82 662 .06453852 82 663 .06730772 end format %tm ym xtset cc ym varsoc seg1, max(10) //bysort is ok and the lag periods are chosen under 10
QINGSHI WANG
Comment