{"id":22225460,"url":"https://github.com/beliavsky/timeseriesanalysis","last_synced_at":"2025-06-13T01:03:32.137Z","repository":{"id":265965355,"uuid":"896990291","full_name":"Beliavsky/TimeSeriesAnalysis","owner":"Beliavsky","description":"R scripts for time series analysis using the MTS package","archived":false,"fork":false,"pushed_at":"2024-12-02T13:41:16.000Z","size":25,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T18:39:28.644Z","etag":null,"topics":["aic","bic","model-selection","multivariate-time-series","r","simulation","statistics","time-series-analysis","varma","vector-arma","vector-autoregression","vector-autoregressive-moving-average"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Beliavsky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-01T19:45:03.000Z","updated_at":"2024-12-02T13:41:21.000Z","dependencies_parsed_at":"2025-06-01T11:04:57.545Z","dependency_job_id":"8ec12aef-1fbe-4fd8-beb1-aa51b3397216","html_url":"https://github.com/Beliavsky/TimeSeriesAnalysis","commit_stats":null,"previous_names":["beliavsky/timeseriesanalysis"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beliavsky%2FTimeSeriesAnalysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beliavsky%2FTimeSeriesAnalysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beliavsky%2FTimeSeriesAnalysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beliavsky%2FTimeSeriesAnalysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Beliavsky","download_url":"https://codeload.github.com/Beliavsky/TimeSeriesAnalysis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beliavsky%2FTimeSeriesAnalysis/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258701874,"owners_count":22743723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aic","bic","model-selection","multivariate-time-series","r","simulation","statistics","time-series-analysis","varma","vector-arma","vector-autoregression","vector-autoregressive-moving-average"],"created_at":"2024-12-03T00:17:53.821Z","updated_at":"2025-06-13T01:03:32.084Z","avatar_url":"https://github.com/Beliavsky.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TimeSeriesAnalysis\nSample output from `xsim_varma_fit_var.r`, which uses the R [MTS](https://cran.r-project.org/web/packages/MTS/index.html) package to simulate 1000 observations of a bivariate VARMA(1,1) process and fit VAR (vector autoregression) models of successively higher orders, is below. The BIC and HQ criteria choose a VAR with 3 lags, fewer than the AIC, which chooses 4.\n\n```\nSimulated process coefficients:\nAR Coefficients (phi):\n     [,1] [,2]\n[1,]  0.2  0.3\n[2,] -0.6  1.1\nMA Coefficients (theta):\n     [,1] [,2]\n[1,] -0.5  0.0\n[2,]  0.0 -0.6\nCovariance Matrix (sigma):\n     [,1] [,2]\n[1,]  4.0  0.8\n[2,]  0.8  1.0\n\ndim(zt): 1000 2 \n\nAutocorrelations of series 'zt', by lag\n\n, , Series 1\n\n Series 1   Series 2  \n 1.000 ( 0) 0.528 ( 0)\n 0.674 ( 1) 0.254 (-1)\n 0.284 ( 2) 0.043 (-2)\n\n, , Series 2\n\n Series 1   Series 2  \n 0.528 ( 0) 1.000 ( 0)\n 0.627 ( 1) 0.936 ( 1)\n 0.601 ( 2) 0.812 ( 2)\n\n\nlag.ar = 1 \nConstant term: \nEstimates:  -0.1044549 -0.03062638 \nStd.Error:  0.06916922 0.0362292 \nAR coefficient matrix \nAR( 1 )-matrix \n       [,1]  [,2]\n[1,]  0.475 0.223\n[2,] -0.564 1.114\nstandard error \n       [,1]    [,2]\n[1,] 0.0249 0.01476\n[2,] 0.0130 0.00773\n  \nResiduals cov-mtx: \n          [,1]      [,2]\n[1,] 4.6827073 0.9880773\n[2,] 0.9880773 1.2846616\n  \ndet(SSE) =  5.039397 \nAIC =  1.625287 \nBIC =  1.644918 \nHQ  =  1.632748 \n\nlag.ar = 2 \nConstant term: \nEstimates:  -0.08525757 -0.009309301 \nStd.Error:  0.06679199 0.03348674 \nAR coefficient matrix \nAR( 1 )-matrix \n       [,1]  [,2]\n[1,]  0.655 0.233\n[2,] -0.597 1.512\nstandard error \n       [,1]   [,2]\n[1,] 0.0334 0.0637\n[2,] 0.0167 0.0319\nAR( 2 )-matrix \n       [,1]    [,2]\n[1,] -0.226 -0.0342\n[2,]  0.231 -0.4516\nstandard error \n       [,1]   [,2]\n[1,] 0.0508 0.0697\n[2,] 0.0254 0.0350\n  \nResiduals cov-mtx: \n          [,1]      [,2]\n[1,] 4.3414079 0.9168607\n[2,] 0.9168607 1.0912584\n  \ndet(SSE) =  3.896964 \nAIC =  1.376198 \nBIC =  1.41546 \nHQ  =  1.39112 \n\nlag.ar = 3 \nConstant term: \nEstimates:  -0.0910338 -0.02056322 \nStd.Error:  0.06622381 0.0326565 \nAR coefficient matrix \nAR( 1 )-matrix \n       [,1]  [,2]\n[1,]  0.699 0.217\n[2,] -0.601 1.603\nstandard error \n       [,1]   [,2]\n[1,] 0.0346 0.0691\n[2,] 0.0171 0.0341\nAR( 2 )-matrix \n       [,1]    [,2]\n[1,] -0.363  0.0088\n[2,]  0.285 -0.7722\nstandard error \n       [,1]   [,2]\n[1,] 0.0640 0.1193\n[2,] 0.0316 0.0588\nAR( 3 )-matrix \n       [,1]    [,2]\n[1,]  0.154 -0.0262\n[2,] -0.105  0.2513\nstandard error \n       [,1]   [,2]\n[1,] 0.0543 0.0756\n[2,] 0.0268 0.0373\n  \nResiduals cov-mtx: \n          [,1]      [,2]\n[1,] 4.2461172 0.8878123\n[2,] 0.8878123 1.0325305\n  \ndet(SSE) =  3.596035 \nAIC =  1.303832 \nBIC =  1.362725 \nHQ  =  1.326215 \n\nlag.ar = 4 \nConstant term: \nEstimates:  -0.08472878 -0.01682396 \nStd.Error:  0.06614913 0.03262521 \nAR coefficient matrix \nAR( 1 )-matrix \n       [,1]  [,2]\n[1,]  0.708 0.238\n[2,] -0.604 1.627\nstandard error \n       [,1]  [,2]\n[1,] 0.0350 0.071\n[2,] 0.0173 0.035\nAR( 2 )-matrix \n       [,1]    [,2]\n[1,] -0.377 -0.0431\n[2,]  0.305 -0.8450\nstandard error \n       [,1]   [,2]\n[1,] 0.0671 0.1304\n[2,] 0.0331 0.0643\nAR( 3 )-matrix \n       [,1]   [,2]\n[1,]  0.204 0.0533\n[2,] -0.140 0.3950\nstandard error \n       [,1]   [,2]\n[1,] 0.0698 0.1311\n[2,] 0.0344 0.0646\nAR( 4 )-matrix \n        [,1]    [,2]\n[1,] -0.0456 -0.0588\n[2,]  0.0517 -0.1043\nstandard error \n       [,1]   [,2]\n[1,] 0.0552 0.0775\n[2,] 0.0272 0.0382\n  \nResiduals cov-mtx: \n          [,1]      [,2]\n[1,] 4.2140872 0.8794244\n[2,] 0.8794244 1.0250894\n  \ndet(SSE) =  3.546429 \nAIC =  1.297941 \nBIC =  1.376465 \nHQ  =  1.327786 \n\nlag.ar = 5 \nConstant term: \nEstimates:  -0.08584221 -0.02093731 \nStd.Error:  0.06632399 0.03263429 \nAR coefficient matrix \nAR( 1 )-matrix \n       [,1]  [,2]\n[1,]  0.708 0.236\n[2,] -0.603 1.630\nstandard error \n       [,1]   [,2]\n[1,] 0.0352 0.0713\n[2,] 0.0173 0.0351\nAR( 2 )-matrix \n       [,1]    [,2]\n[1,] -0.381 -0.0339\n[2,]  0.307 -0.8658\nstandard error \n       [,1]   [,2]\n[1,] 0.0679 0.1332\n[2,] 0.0334 0.0656\nAR( 3 )-matrix \n       [,1]   [,2]\n[1,]  0.211 0.0351\n[2,] -0.149 0.4420\nstandard error \n       [,1]   [,2]\n[1,] 0.0735 0.1436\n[2,] 0.0362 0.0706\nAR( 4 )-matrix \n        [,1]    [,2]\n[1,] -0.0612 -0.0205\n[2,]  0.0620 -0.1857\nstandard error \n       [,1]  [,2]\n[1,] 0.0714 0.134\n[2,] 0.0351 0.066\nAR( 5 )-matrix \n        [,1]    [,2]\n[1,]  0.0220 -0.0287\n[2,] -0.0164  0.0572\nstandard error \n       [,1]   [,2]\n[1,] 0.0555 0.0779\n[2,] 0.0273 0.0383\n  \nResiduals cov-mtx: \n          [,1]      [,2]\n[1,] 4.2150939 0.8790021\n[2,] 0.8790021 1.0205030\n  \ndet(SSE) =  3.528871 \nAIC =  1.300978 \nBIC =  1.399133 \nHQ  =  1.338284 \n\nResults:\n Lag      AIC      BIC       HQ\n   1 1.625287 1.644918 1.632748\n   2 1.376198 1.415460 1.391120\n   3 1.303832 1.362725 1.326215\n   4 1.297941 1.376465 1.327786\n   5 1.300978 1.399133 1.338284\n\nBest lag according to AIC: 4 \nBest lag according to BIC: 3 \nBest lag according to  HQ: 3\n```\n\nThe script `xsim_var_fit_var.r` simulates from a bivariate VAR(1) process with only 30 observations. In this case\nonly BIC chooses the correct lag order.\n\n```\nResults:\n Lag       AIC      BIC        HQ\n   1 1.2742610 1.461087 1.3340284\n   2 1.4718569 1.845509 1.5913915\n   3 1.3075726 1.868052 1.4868746\n   4 1.1098720 1.857177 1.3489414\n   5 0.6248741 1.559006 0.9237108\n   6 0.4598563 1.580814 0.8184604\n   7 0.5678868 1.875671 0.9862582\n   8 0.6714662 2.166077 1.1496049\n\nBest lag according to AIC: 6 \nBest lag according to BIC: 1 \nBest lag according to  HQ: 6 \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeliavsky%2Ftimeseriesanalysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeliavsky%2Ftimeseriesanalysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeliavsky%2Ftimeseriesanalysis/lists"}