SPB Git

Repository Public

job_time_series.json 33.2 KB 2 lines json

1{"job":{"id":"4b35b0f2-296f-4aeb-9d87-d7c9ae35681f","tool":"time_series","params":{"symbol":"AAPL","period_days":1260,"series":"close","transform":"auto","frequency":"daily","auto":true,"criterion":"bic","max_p":3,"max_q":3,"p":1,"d":"auto","q":0,"seasonal_period":0,"seasonal_p":1,"seasonal_d":0,"seasonal_q":0,"deterministic":"constant","horizon":21,"holdout":60},"status":"done","startedAt":1795217730673,"finishedAt":1795217739177,"error":null,"progress":1,"engineVersion":"1.0.0","durationMs":8504,"projectId":null,"sessionId":null,"cancellable":false,"code":"import numpy as np, pandas as pd\nfrom statsmodels.tsa.arima.model import ARIMA\nfrom statsmodels.tsa.stattools import adfuller, kpss\n# s: pd.Series of the daily close of AAPL (2021-11-12 → 2026-11-20, 1261 observations)\ny = np.log(s).values\nprint(\"ADF p:\", adfuller(y, regression='c', autolag=\"AIC\")[1], \" KPSS stat:\", kpss(y, regression='c', nlags=\"auto\")[0])\nres = ARIMA(y, order=(1, 1, 0), seasonal_order=(0, 0, 0, 0), trend='t').fit()\nprint(res.summary())\nfc = res.get_forecast(21)\nprint(fc.predicted_mean, fc.conf_int(alpha=0.05))","result":{"success":true,"schema":"lab/1","engine":"time_series","engineVersion":"1.0.0","title":"AAPL — ARIMA(1,1,0) on the log price","headline":"AAPL: ARIMA(1,1,0) on the log price (selected by BIC) forecasts 347.3 in 21 periods (+4.72 from 342.6; 95 % interval 295.4 to 408.2), and does not beat the random walk on the hold-out.","summary":[{"label":"AR order p","value":1,"unit":"count","kind":"calculated"},{"label":"Differencing d","value":1,"unit":"count","kind":"calculated"},{"label":"MA order q","value":0,"unit":"count","kind":"calculated"},{"label":"Log-likelihood","value":3299.1414843088764,"unit":null,"kind":"calculated","decimals":2},{"label":"AIC","value":-6592.282968617753,"unit":null,"kind":"calculated","decimals":2},{"label":"BIC","value":-6576.866367617917,"unit":null,"kind":"calculated","decimals":2},{"label":"Innovation standard deviation","value":0.017640281970012515,"unit":null,"kind":"calculated","decimals":5},{"label":"Last observed (2026-11-20)","value":342.55999999999995,"unit":"currency","kind":"observed","decimals":4,"currency":"USD"},{"label":"Forecast, next period","value":342.64729695665335,"unit":"currency","kind":"forecast","decimals":4,"note":"95 % interval 331 to 354.7","currency":"USD"},{"label":"Forecast, 21 periods ahead","value":347.2817238511464,"unit":"currency","kind":"forecast","decimals":4,"note":"95 % interval 295.4 to 408.2","currency":"USD"},{"label":"Hold-out RMSE, model (one step)","value":0.01418163190354197,"unit":null,"kind":"calculated","decimals":5},{"label":"Hold-out RMSE, random walk (one step)","value":0.01415093270058849,"unit":null,"kind":"calculated","decimals":5},{"label":"Hold-out MASE, model (one step)","value":0.862372186245898,"unit":"ratio","kind":"calculated","decimals":3}],"tables":[{"id":"unit_root","title":"Unit-root and stationarity tests on the log price","columns":[{"key":"series","label":"Series","align":"left","type":"text"},{"key":"adf_stat","label":"ADF statistic","decimals":3,"type":"number"},{"key":"adf_crit5","label":"ADF 5 % critical","decimals":3,"type":"number"},{"key":"adf_p","label":"ADF p-value","decimals":4,"type":"number"},{"key":"adf_lags","label":"ADF lags","decimals":0,"type":"integer"},{"key":"kpss_stat","label":"KPSS statistic","decimals":3,"type":"number"},{"key":"kpss_crit5","label":"KPSS 5 % critical","decimals":3,"type":"number"},{"key":"kpss_p","label":"KPSS p-value","decimals":3,"type":"number"},{"key":"reading","label":"Joint reading","align":"left","type":"text"}],"rows":[{"series":"Level","adf_stat":-0.6564258811664224,"adf_crit5":-2.863836575823745,"adf_p":0.8577157725853068,"adf_lags":0,"kpss_stat":5.090039487057026,"kpss_crit5":0.463,"kpss_p":0.01,"reading":"unit root: ADF does not reject it and KPSS rejects stationarity"},{"series":"First difference","adf_stat":-34.7006541318987,"adf_crit5":-2.863838402102491,"adf_p":0,"adf_lags":0,"kpss_stat":0.06185524922674922,"kpss_crit5":0.463,"kpss_p":0.1,"reading":"stationary: ADF rejects the unit root and KPSS does not reject stationarity"}],"note":"ADF: H0 = unit root (lag length by AIC). KPSS: H0 = stationarity (automatic bandwidth); its tabulated p-value is bounded between 0.01 and 0.10. Level tests include a constant."},{"id":"coefficients","title":"ARIMA(1,1,0) coefficients","columns":[{"key":"term","label":"Term","align":"left","type":"text"},{"key":"estimate","label":"Estimate","decimals":5,"type":"number"},{"key":"std_error","label":"Std. error","decimals":5,"type":"number"},{"key":"t","label":"t","decimals":2,"type":"number"},{"key":"p","label":"p-value","decimals":4,"type":"number"},{"key":"ci_low","label":"95 % CI low","decimals":5,"type":"number"},{"key":"ci_high","label":"95 % CI high","decimals":5,"type":"number"}],"rows":[{"term":"Drift","estimate":0.0006721823774900272,"std_error":0.0005172719590559282,"t":1.299475770379716,"p":0.19378070338420794,"ci_low":-0.00034165203247206954,"ci_high":0.001686016787452124},{"term":"ar.L1","estimate":0.020975007718284235,"std_error":0.019023549572531464,"t":1.1025811790965934,"p":0.2702090872385974,"ci_low":-0.016310464301989777,"ci_high":0.058260479738558246},{"term":"Innovation variance σ²","estimate":0.0003111795479815486,"std_error":6.62175765117547e-06,"t":46.9934969496066,"p":0,"ci_low":0.00029820114147089213,"ci_high":0.0003241579544922051}],"note":"Exact Gaussian maximum likelihood (state space), 1261 observations; z statistics from the outer-product-of-gradients covariance. With d = 1 the “Drift” is the mean change per period."},{"id":"order_search","title":"Order search (BIC, best first)","columns":[{"key":"p","label":"p","decimals":0,"type":"integer"},{"key":"d","label":"d","decimals":0,"type":"integer"},{"key":"q","label":"q","decimals":0,"type":"integer"},{"key":"aic","label":"AIC","decimals":2,"type":"number"},{"key":"bic","label":"BIC","decimals":2,"type":"number"},{"key":"loglik","label":"Log-lik.","decimals":2,"type":"number"}],"rows":[{"p":0,"d":1,"q":0,"aic":-6258.040118032384,"bic":-6247.859964360832,"loglik":3131.020059016192},{"p":1,"d":1,"q":0,"aic":-6256.960657298334,"bic":-6241.690426791006,"loglik":3131.480328649167},{"p":0,"d":1,"q":1,"aic":-6256.954109121409,"bic":-6241.683878614081,"loglik":3131.4770545607043},{"p":2,"d":1,"q":0,"aic":-6254.967575414023,"bic":-6234.6072680709185,"loglik":3131.4837877070113},{"p":1,"d":1,"q":1,"aic":-6254.958351785017,"bic":-6234.598044441913,"loglik":3131.4791758925085},{"p":0,"d":1,"q":2,"aic":-6254.946987787989,"bic":-6234.586680444885,"loglik":3131.4734938939946},{"p":1,"d":1,"q":2,"aic":-6254.47618062272,"bic":-6229.02579644384,"loglik":3132.23809031136},{"p":3,"d":1,"q":0,"aic":-6254.188082062906,"bic":-6228.737697884026,"loglik":3132.094041031453},{"p":0,"d":1,"q":3,"aic":-6253.992767967871,"bic":-6228.542383788991,"loglik":3131.9963839839356},{"p":2,"d":1,"q":1,"aic":-6252.966925398945,"bic":-6227.516541220065,"loglik":3131.4834626994725},{"p":1,"d":1,"q":3,"aic":-6255.086867835811,"bic":-6224.546406821155,"loglik":3133.5434339179055},{"p":2,"d":1,"q":2,"aic":-6254.471537329673,"bic":-6223.931076315017,"loglik":3133.2357686648365}],"note":"16 specifications estimated on 1201 observations; the 12 best are shown."},{"id":"forecast","title":"Forecasts of the close","columns":[{"key":"step","label":"Step","decimals":0,"type":"integer"},{"key":"date","label":"Date","align":"left","type":"date"},{"key":"forecast","label":"Forecast","decimals":4,"type":"number"},{"key":"lo80","label":"80 % low","decimals":4,"type":"number"},{"key":"hi80","label":"80 % high","decimals":4,"type":"number"},{"key":"lo95","label":"95 % low","decimals":4,"type":"number"},{"key":"hi95","label":"95 % high","decimals":4,"type":"number"}],"rows":[{"step":1,"date":"2026-11-23","forecast":342.64729695665335,"lo80":334.9879960119532,"hi80":350.48172325408217,"lo95":331.00295804198953,"hi95":354.7012715723441},{"step":2,"date":"2026-11-24","forecast":342.874694146759,"lo80":331.9741128866793,"hi80":354.13320292948316,"lo95":326.3446842178455,"hi95":360.24198208712494},{"step":5,"date":"2026-11-27","forecast":343.56675030165525,"lo80":326.34894869158046,"hi80":361.69294366072273,"lo95":317.5864812969454,"hi95":371.6723439574668},{"step":10,"date":"2026-12-04","forecast":344.7233904703698,"lo80":320.4980910596159,"hi80":370.7797932415225,"lo95":308.3709327106158,"hi95":385.36127543805986},{"step":21,"date":"2026-12-21","forecast":347.2817238511464,"lo80":312.4441523256238,"hi80":386.0036900141179,"lo95":295.44004780586914,"hi95":408.22020107535343}]},{"id":"holdout","title":"Out-of-sample accuracy on the last 60 periods","columns":[{"key":"exercise","label":"Exercise","align":"left","type":"text"},{"key":"model","label":"Forecast","align":"left","type":"text"},{"key":"rmse","label":"RMSE","decimals":5,"type":"number"},{"key":"mae","label":"MAE","decimals":5,"type":"number"},{"key":"mase","label":"MASE","decimals":3,"type":"number"},{"key":"bias","label":"Mean error","decimals":5,"type":"number"}],"rows":[{"exercise":"One step ahead","model":"ARIMA(1,1,0)","rmse":0.01418163190354197,"mae":0.010888202166170776,"mase":0.862372186245898,"bias":0.0007657040020695819},{"exercise":"One step ahead","model":"Random walk (last value)","rmse":0.01415093270058849,"mae":0.010782769583257575,"mase":0.8540216683513183,"bias":0.0014328603698864869},{"exercise":"One step ahead","model":"Historical mean","rmse":0.5333934195204549,"mae":0.5328791287568325,"mase":42.20532758829667,"bias":0.5328791287568325},{"exercise":"Path from the origin (1 to 60 steps)","model":"ARIMA(1,1,0)","rmse":0.05768163066154285,"mae":0.05387532878325314,"mase":4.267057532407123,"bias":0.05378380603465405},{"exercise":"Path from the origin (1 to 60 steps)","model":"Random walk (last value)","rmse":0.07897017318656631,"mae":0.07322054023083087,"mase":5.799245494646611,"bias":0.07322054023083087}],"note":"Errors in the units of the modelled series (log price). Orders and parameters come from the first 1201 observations and are not re-estimated. MASE = MAE divided by the in-sample MAE of the one-step random-walk forecast (0.012626); below 1 beats that benchmark."}],"charts":[{"id":"residual_acf","title":"Autocorrelation of the residuals","type":"bar","x":{"label":"Lag","type":"number","unit":"count"},"y":{"label":"Autocorrelation"},"series":[{"name":"ACF","kind":"calculated","x":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"y":[-1.8986603347013732e-05,0.0016234544143399463,-0.03328896253416422,-0.04326618995079729,-0.016844566446840976,-0.004161041805840193,-0.016509520380433237,-0.03886098005712045,0.04265574231766726,-0.029388368077876637,0.016554781662516737,-0.027359815312337936,0.026895606163656674,-0.022255143743574075,0.01542869003592285,-0.03905949873753449,-0.016087427628109403,0.03498839813289956,0.016271893790586203,0.02637425973473535,-0.015583134576771074,-0.034753098053363206,0.0019815301388685772,-0.009658065007891778,0.009757557427386312,0.01045739381221646,0.0161923512411661,0.007730238317462298,-0.026948819526754913,-0.022241542207302636],"style":"bar"},{"name":"+1.96/√n","kind":"calculated","x":[1,30],"y":[0.05521674464226308,0.05521674464226308],"style":"dashed"},{"name":"−1.96/√n","kind":"calculated","x":[1,30],"y":[-0.05521674464226308,-0.05521674464226308],"style":"dashed"}]},{"id":"forecast","title":"AAPL close: forecast, 21 periods","type":"fan","x":{"label":"Date","type":"time"},"y":{"label":"Close","unit":"currency","currency":"USD"},"series":[{"name":"Observed close","kind":"observed","x":["2025-11-24","2025-11-26","2025-11-28","2025-12-02","2025-12-03","2025-12-05","2025-12-08","2025-12-10","2025-12-12","2025-12-15","2025-12-17","2025-12-18","2025-12-22","2025-12-23","2025-12-26","2025-12-29","2025-12-31","2026-01-05","2026-01-06","2026-01-08","2026-01-09","2026-01-13","2026-01-14","2026-01-16","2026-01-21","2026-01-22","2026-01-26","2026-01-27","2026-01-29","2026-01-30","2026-02-03","2026-02-05","2026-02-06","2026-02-10","2026-02-11","2026-02-13","2026-02-17","2026-02-19","2026-02-23","2026-02-24","2026-02-26","2026-02-27","2026-03-03","2026-03-04","2026-03-06","2026-03-09","2026-03-11","2026-03-13","2026-03-16","2026-03-18","2026-03-19","2026-03-23","2026-03-24","2026-03-26","2026-03-30","2026-03-31","2026-04-02","2026-04-06","2026-04-08","2026-04-09","2026-04-13","2026-04-15","2026-04-16","2026-04-20","2026-04-21","2026-04-23","2026-04-24","2026-04-28","2026-04-29","2026-05-01","2026-05-05","2026-05-06","2026-05-08","2026-05-11","2026-05-13","2026-05-14","2026-05-18","2026-05-20","2026-05-21","2026-05-26","2026-05-27","2026-05-29","2026-06-01","2026-06-03","2026-06-05","2026-06-08","2026-06-10","2026-06-11","2026-06-15","2026-06-16","2026-06-18","2026-06-23","2026-06-24","2026-06-26","2026-06-29","2026-07-01","2026-07-02","2026-07-07","2026-07-08","2026-07-10","2026-07-14","2026-07-15","2026-07-17","2026-07-20","2026-07-22","2026-07-23","2026-07-27","2026-07-29","2026-07-30","2026-08-03","2026-08-04","2026-08-06","2026-08-07","2026-08-11","2026-08-13","2026-08-14","2026-08-18","2026-08-19","2026-08-21","2026-08-24","2026-08-26","2026-08-27","2026-08-31","2026-09-02","2026-09-03","2026-09-08","2026-09-09","2026-09-11","2026-09-14","2026-09-16","2026-09-18","2026-09-21","2026-09-23","2026-09-24","2026-09-28","2026-09-29","2026-10-01","2026-10-05","2026-10-06","2026-10-08","2026-10-09","2026-10-13","2026-10-14","2026-10-16","2026-10-20","2026-10-21","2026-10-23","2026-10-26","2026-10-28","2026-10-29","2026-11-02","2026-11-03","2026-11-05","2026-11-09","2026-11-10","2026-11-12","2026-11-13","2026-11-17","2026-11-18","2026-11-20"],"y":[274.9599999999999,276.5899999999999,277.88000000000005,285.2,283.16000000000014,277.81000000000006,276.9299999999999,277.81000000000006,277.3100000000001,273.1599999999999,270.90000000000003,271.25000000000006,270.03,271.40999999999997,272.45000000000005,272.81000000000006,270.9200000000001,266.33,261.45,258.13999999999993,258.46999999999997,260.13999999999993,259.06,254.63999999999996,246.7899999999999,247.48999999999995,254.51999999999995,257.37000000000006,257.3800000000001,258.5799999999999,268.5400000000001,274.94999999999993,277.1500000000001,272.99000000000007,274.7999999999999,255.12999999999988,263.20999999999987,259.92,265.5,271.4499999999999,272.26,263.50999999999993,263.08,261.8500000000001,256.81000000000006,259.22,260.1500000000001,249.4800000000001,252.17999999999998,249.30999999999992,248.33,250.84999999999994,250.9999999999999,252.25000000000006,245.99999999999991,253.15000000000003,255.2700000000001,258.2,258.24000000000007,259.83,258.5399999999999,265.7499999999999,262.7300000000001,272.36,265.49000000000007,272.74,270.37,270.02,269.5299999999999,279.43000000000006,283.46000000000004,286.77999999999986,292.58,292.2099999999999,298.3900000000001,297.7300000000001,297.36,301.76000000000005,304.5,307.83,310.3499999999999,311.5499999999999,305.8100000000001,309.7599999999999,306.8399999999999,301.04999999999995,291.11,295.15,295.9400000000001,298.76,297.5300000000001,293.8199999999999,292.6099999999999,283.32000000000005,281.2799999999999,293.9,308.1299999999999,310.15999999999997,312.8799999999999,314.80999999999995,314.35,326.97,333.2000000000001,326.06,325.3600000000001,321.14,336.36,337.64000000000004,332.89,302.92999999999995,308.8799999999999,311.8999999999999,312.82,304.67999999999995,305.0299999999999,305.7000000000001,309.7899999999999,316.5900000000001,309.1199999999999,310.09999999999997,313.20999999999987,314.34,316.6100000000001,324.71000000000004,327.9600000000001,315.9800000000001,315.09999999999997,332.02000000000004,332.83000000000004,332.15999999999997,335.8699999999999,338.7200000000001,336.76000000000005,335.66,338.14,329.14999999999986,330.06999999999994,332.6400000000001,333.37999999999994,340.15999999999997,336.3799999999999,341.0099999999999,342.69999999999993,343.2,339.2400000000002,343.73000000000013,347.46999999999997,343.64999999999986,343.57,348.65,338.05999999999995,331.65000000000003,343.90999999999997,350.42,348.24999999999994,354.8800000000001,356.27000000000015,351.90999999999985,352.4500000000001,342.55999999999995]},{"name":"95% interval","kind":"forecast","x":["2026-11-23","2026-11-24","2026-11-25","2026-11-26","2026-11-27","2026-11-30","2026-12-01","2026-12-02","2026-12-03","2026-12-04","2026-12-07","2026-12-08","2026-12-09","2026-12-10","2026-12-11","2026-12-14","2026-12-15","2026-12-16","2026-12-17","2026-12-18","2026-12-21"],"y":[342.64729695665335,342.874694146759,343.1051829486367,343.33588841369595,343.56675030165525,343.797767450247,344.02893993726695,344.2602678666077,344.4917513427783,344.7233904703698,344.95518535404284,345.1871360985295,345.41924280863213,345.6515055892227,345.8839245452447,346.1164997817117,346.3492314037083,346.58211951638884,346.81516422497924,347.04836563477596,347.2817238511464],"lower":[331.00295804198953,326.3446842178455,322.88733891489574,320.0427389873039,317.5864812969454,315.4045169337485,313.42948333528756,311.61767009297654,309.9388125426299,308.3709327106158,306.8974759628681,305.50560617023245,304.1851333933495,302.92780896920385,301.7268449723524,300.57657650328554,299.4722181233238,298.40968422518785,297.38545395620406,296.3964678940557,295.44004780586914],"upper":[354.7012715723441,360.24198208712494,364.5889831476036,368.3243451978399,371.6723439574668,374.74702662106046,377.6157566764381,380.3222455139576,382.8967587816765,385.36127543805986,387.73235110294394,390.02282289219335,392.24288173281707,394.4007772764187,396.5032984379726,398.5561111074607,400.56400171497853,402.53105686016323,404.46079838899277,406.3562867180329,408.22020107535343],"style":"band","line":false},{"name":"80% interval","kind":"forecast","x":["2026-11-23","2026-11-24","2026-11-25","2026-11-26","2026-11-27","2026-11-30","2026-12-01","2026-12-02","2026-12-03","2026-12-04","2026-12-07","2026-12-08","2026-12-09","2026-12-10","2026-12-11","2026-12-14","2026-12-15","2026-12-16","2026-12-17","2026-12-18","2026-12-21"],"y":[342.64729695665335,342.874694146759,343.1051829486367,343.33588841369595,343.56675030165525,343.797767450247,344.02893993726695,344.2602678666077,344.4917513427783,344.7233904703698,344.95518535404284,345.1871360985295,345.41924280863213,345.6515055892227,345.8839245452447,346.1164997817117,346.3492314037083,346.58211951638884,346.81516422497924,347.04836563477596,347.2817238511464],"lower":[334.9879960119532,331.9741128866793,329.7469348902476,327.9208154633618,326.34894869158046,324.9567237375368,323.7000669684922,322.5503764001383,321.48784598622876,320.4980910596159,319.57027530435016,318.69599549994575,317.8685800062526,317.0826275810576,316.33369297642315,315.6180659717162,314.9326119992261,314.27465459947325,313.64188702608766,313.0323046263337,312.4441523256238],"upper":[350.48172325408217,354.13320292948316,357.00458172689184,359.4756011638194,361.69294366072273,363.7312179428551,365.6344980796065,367.43138654584953,369.14168987992826,370.7797932415225,372.3565334395238,373.8803141877728,375.35780762018635,376.79441547315434,378.1945834892054,379.56202238397566,380.89986722059217,382.21079495436277,383.49711282790105,384.7608259905996,386.0036900141179],"style":"band","line":false},{"name":"50% interval","kind":"forecast","x":["2026-11-23","2026-11-24","2026-11-25","2026-11-26","2026-11-27","2026-11-30","2026-12-01","2026-12-02","2026-12-03","2026-12-04","2026-12-07","2026-12-08","2026-12-09","2026-12-10","2026-12-11","2026-12-14","2026-12-15","2026-12-16","2026-12-17","2026-12-18","2026-12-21"],"y":[342.64729695665335,342.874694146759,343.1051829486367,343.33588841369595,343.56675030165525,343.797767450247,344.02893993726695,344.2602678666077,344.4917513427783,344.7233904703698,344.95518535404284,345.1871360985295,345.41924280863213,345.6515055892227,345.8839245452447,346.1164997817117,346.3492314037083,346.58211951638884,346.81516422497924,347.04836563477596,347.2817238511464],"lower":[338.5945723802615,337.0937534744735,336.00854065025794,335.1345943697289,334.394605395806,333.74929418424455,333.1754566277401,332.6580332695254,332.18659522337106,331.7535677677772,331.3532443352805,330.98119939632284,330.6339191427626,330.3085586891334,330.0027765439407,329.71461827073404,329.44243257531673,329.1848094151624,328.9405334556222,328.7085484644189,328.4879296584999],"upper":[346.7485296245264,348.7547742267376,350.35170932976433,351.73788159504124,352.9904789376735,354.14877862939886,355.2359850041408,356.26715779794637,357.25272617763125,358.200265145511,359.1154815500694,360.00280120209305,360.8657381911583,361.70713768437093,362.52934145507334,363.33430422176997,364.1236775609192,364.898871797514,365.66110254887934,366.41142633017483,367.15076820754405],"style":"band","line":false},{"name":"Forecast (median)","kind":"forecast","x":["2026-11-23","2026-11-24","2026-11-25","2026-11-26","2026-11-27","2026-11-30","2026-12-01","2026-12-02","2026-12-03","2026-12-04","2026-12-07","2026-12-08","2026-12-09","2026-12-10","2026-12-11","2026-12-14","2026-12-15","2026-12-16","2026-12-17","2026-12-18","2026-12-21"],"y":[342.64729695665335,342.874694146759,343.1051829486367,343.33588841369595,343.56675030165525,343.797767450247,344.02893993726695,344.2602678666077,344.4917513427783,344.7233904703698,344.95518535404284,345.1871360985295,345.41924280863213,345.6515055892227,345.8839245452447,346.1164997817117,346.3492314037083,346.58211951638884,346.81516422497924,347.04836563477596,347.2817238511464],"lower":[331.00295804198953,326.3446842178455,322.88733891489574,320.0427389873039,317.5864812969454,315.4045169337485,313.42948333528756,311.61767009297654,309.9388125426299,308.3709327106158,306.8974759628681,305.50560617023245,304.1851333933495,302.92780896920385,301.7268449723524,300.57657650328554,299.4722181233238,298.40968422518785,297.38545395620406,296.3964678940557,295.44004780586914],"upper":[354.7012715723441,360.24198208712494,364.5889831476036,368.3243451978399,371.6723439574668,374.74702662106046,377.6157566764381,380.3222455139576,382.8967587816765,385.36127543805986,387.73235110294394,390.02282289219335,392.24288173281707,394.4007772764187,396.5032984379726,398.5561111074607,400.56400171497853,402.53105686016323,404.46079838899277,406.3562867180329,408.22020107535343],"style":"line","line":true}],"note":"Back-transformed from logs: the central line is the median forecast; intervals are the exponentials of the Gaussian intervals in logs."},{"id":"holdout","title":"Hold-out: one-step forecasts against the outcome (log price)","type":"line","x":{"label":"Date","type":"time"},"y":{"label":"Log price","unit":null},"series":[{"name":"Observed","kind":"observed","x":["2026-08-28","2026-08-31","2026-09-01","2026-09-02","2026-09-03","2026-09-04","2026-09-08","2026-09-09","2026-09-10","2026-09-11","2026-09-14","2026-09-15","2026-09-16","2026-09-17","2026-09-18","2026-09-21","2026-09-22","2026-09-23","2026-09-24","2026-09-25","2026-09-28","2026-09-29","2026-09-30","2026-10-01","2026-10-02","2026-10-05","2026-10-06","2026-10-07","2026-10-08","2026-10-09","2026-10-12","2026-10-13","2026-10-14","2026-10-15","2026-10-16","2026-10-19","2026-10-20","2026-10-21","2026-10-22","2026-10-23","2026-10-26","2026-10-27","2026-10-28","2026-10-29","2026-10-30","2026-11-02","2026-11-03","2026-11-04","2026-11-05","2026-11-06","2026-11-09","2026-11-10","2026-11-11","2026-11-12","2026-11-13","2026-11-16","2026-11-17","2026-11-18","2026-11-19","2026-11-20"],"y":[5.76663207036181,5.757670732545066,5.783455883378043,5.78293247629394,5.792891649727977,5.767476889636389,5.755678920444703,5.752890048763229,5.787878495009303,5.80519520806593,5.807631849115076,5.802390241741317,5.805616780537469,5.819311119229654,5.81672418033434,5.825173807386555,5.82744449148394,5.819370510469463,5.816098742880033,5.831325137247676,5.82346001090882,5.796513573913885,5.807451560653049,5.799304753178124,5.8094629391249475,5.807060824109703,5.809282980514942,5.818330654173021,5.829416095153583,5.818241473299286,5.831031675571665,5.8319118023667285,5.836855428880563,5.834050214020127,5.838313367613807,5.836797067095843,5.8267078214935,5.839856465469972,5.85208753063934,5.850678330342865,5.839623697567614,5.8488635785089595,5.839390875471746,5.85406855366702,5.841716660745515,5.8232233945220315,5.804080195971565,5.855759364942607,5.84037999523587,5.835132322775277,5.8591324350589415,5.852920612659915,5.873131360146117,5.871779704162003,5.875688870357927,5.865844633183331,5.863375461087746,5.864908768219885,5.855673460439727,5.836446824841373]},{"name":"ARIMA(1,1,0), one step ahead","kind":"forecast","x":["2026-08-28","2026-08-31","2026-09-01","2026-09-02","2026-09-03","2026-09-04","2026-09-08","2026-09-09","2026-09-10","2026-09-11","2026-09-14","2026-09-15","2026-09-16","2026-09-17","2026-09-18","2026-09-21","2026-09-22","2026-09-23","2026-09-24","2026-09-25","2026-09-28","2026-09-29","2026-09-30","2026-10-01","2026-10-02","2026-10-05","2026-10-06","2026-10-07","2026-10-08","2026-10-09","2026-10-12","2026-10-13","2026-10-14","2026-10-15","2026-10-16","2026-10-19","2026-10-20","2026-10-21","2026-10-22","2026-10-23","2026-10-26","2026-10-27","2026-10-28","2026-10-29","2026-10-30","2026-11-02","2026-11-03","2026-11-04","2026-11-05","2026-11-06","2026-11-09","2026-11-10","2026-11-11","2026-11-12","2026-11-13","2026-11-16","2026-11-17","2026-11-18","2026-11-19","2026-11-20"],"y":[5.751191890836102,5.767696580147371,5.758039402689955,5.784787121654934,5.78353489907223,5.7937844672580825,5.767389757179071,5.755969008520732,5.753429712278343,5.789464688512415,5.806291848584943,5.808316272927513,5.802861958096722,5.806323086572495,5.820307410554809,5.817269437912979,5.826024806554651,5.82812431785706,5.819763762706322,5.8166250289221955,5.832363870500835,5.82385904896355,5.796384010021537,5.808371493858186,5.799695987932564,5.810361269819408,5.807611201790658,5.80996146254474,5.819198220787976,5.830340113224823,5.81854882971826,5.832002919965792,5.832553106684903,5.837609302712541,5.834589424786666,5.83904839057558,5.837371984142906,5.827045245658366,5.8408376396318245,5.853043285481063,5.851256214344694,5.839934377996241,5.849736469765707,5.839745379469662,5.855092086054666,5.841991403693141,5.823328005451807,5.80416680208502,5.857807934887755,5.840570869200267,5.835603871111999,5.860414223124064,5.85336545153501,5.874308172947945,5.8723591822909915,5.876414086947849,5.866188844719058,5.863923981113119,5.865568167332709,5.85603454090387]},{"name":"Random walk","kind":"forecast","x":["2026-08-28","2026-08-31","2026-09-01","2026-09-02","2026-09-03","2026-09-04","2026-09-08","2026-09-09","2026-09-10","2026-09-11","2026-09-14","2026-09-15","2026-09-16","2026-09-17","2026-09-18","2026-09-21","2026-09-22","2026-09-23","2026-09-24","2026-09-25","2026-09-28","2026-09-29","2026-09-30","2026-10-01","2026-10-02","2026-10-05","2026-10-06","2026-10-07","2026-10-08","2026-10-09","2026-10-12","2026-10-13","2026-10-14","2026-10-15","2026-10-16","2026-10-19","2026-10-20","2026-10-21","2026-10-22","2026-10-23","2026-10-26","2026-10-27","2026-10-28","2026-10-29","2026-10-30","2026-11-02","2026-11-03","2026-11-04","2026-11-05","2026-11-06","2026-11-09","2026-11-10","2026-11-11","2026-11-12","2026-11-13","2026-11-16","2026-11-17","2026-11-18","2026-11-19","2026-11-20"],"y":[5.750475202648183,5.76663207036181,5.757670732545066,5.783455883378043,5.78293247629394,5.792891649727977,5.767476889636389,5.755678920444703,5.752890048763229,5.787878495009303,5.80519520806593,5.807631849115076,5.802390241741317,5.805616780537469,5.819311119229654,5.81672418033434,5.825173807386555,5.82744449148394,5.819370510469463,5.816098742880033,5.831325137247676,5.82346001090882,5.796513573913885,5.807451560653049,5.799304753178124,5.8094629391249475,5.807060824109703,5.809282980514942,5.818330654173021,5.829416095153583,5.818241473299286,5.831031675571665,5.8319118023667285,5.836855428880563,5.834050214020127,5.838313367613807,5.836797067095843,5.8267078214935,5.839856465469972,5.85208753063934,5.850678330342865,5.839623697567614,5.8488635785089595,5.839390875471746,5.85406855366702,5.841716660745515,5.8232233945220315,5.804080195971565,5.855759364942607,5.84037999523587,5.835132322775277,5.8591324350589415,5.852920612659915,5.873131360146117,5.871779704162003,5.875688870357927,5.865844633183331,5.863375461087746,5.864908768219885,5.855673460439727],"style":"dashed"}]}],"diagnostics":[{"name":"ADF unit-root test (level)","statistic":-0.6564258811664224,"pvalue":0.8577157725853068,"conclusion":"A unit root is not rejected: the level behaves like a random walk.","passed":false},{"name":"KPSS stationarity test (level)","statistic":5.090039487057026,"pvalue":0.01,"conclusion":"Stationarity is rejected.","passed":false},{"name":"Stationarity of the AR part (smallest root modulus)","statistic":47.67578698568415,"pvalue":null,"conclusion":"All AR roots are outside the unit circle.","passed":true},{"name":"Residuals: Ljung-Box Q(10) on residuals","statistic":9.831903975282854,"pvalue":0.3642642821113362,"conclusion":"No residual autocorrelation detected.","passed":true,"df":9},{"name":"Residuals: Ljung-Box Q(10) on squared residuals","statistic":181.32153789394846,"pvalue":1.2455629032685366e-33,"conclusion":"Squared residuals are still autocorrelated: volatility clustering is not fully captured.","passed":false,"df":10},{"name":"Residuals: Engle ARCH-LM(10)","statistic":124.19283515226614,"pvalue":7.117773364989712e-22,"conclusion":"ARCH effects remain in the residuals.","passed":false,"df":10},{"name":"Residuals: Jarque-Bera normality","statistic":1742.9314928274855,"pvalue":0,"conclusion":"Residuals are not Gaussian (skewness 0.20, kurtosis 8.75).","passed":false,"df":2},{"name":"Diebold-Mariano: model vs random walk (one step, squared error)","statistic":0.4029421214303728,"pvalue":0.6884472225164472,"conclusion":"No significant difference in accuracy between the model and the random walk.","passed":false,"df":59}],"assumptions":["Modelled series: log price of AAPL, daily (1261 observations).","Orders selected by BIC over p ≤ 3, q ≤ 3, on the estimation sample only (the last 60 observations are held out).","Forecast intervals are Gaussian; residuals are not, so the stated coverage is approximate in the tails.","Forecasts are made in logs and mapped back with exp(·): the central path is the median, which is below the mean by a factor exp(σ²ₕ/2).","For asset prices a random walk is the expected result of an efficient market: failing to beat it out of sample is the norm, not a defect of the estimation."],"warnings":["Residuals show ARCH effects: the variance is not constant, so the forecast intervals are too narrow in turbulent periods and too wide in calm ones (see the Volatility Lab)."],"methodology":"**Model.** For the transformed series $y_t$: $\\phi(L)\\,\\Phi(L^s)\\,(1-L)^d(1-L^s)^D\\,y_t = c + \\theta(L)\\,\\Theta(L^s)\\,\\varepsilon_t$, $\\varepsilon_t\\sim(0,\\sigma^2)$, with $\\phi,\\theta$ of orders $p,q$ and seasonal polynomials $\\Phi,\\Theta$ of orders $P,Q$ at period $s$. A constant is included when $d+D=0$, a drift when $d+D=1$, nothing beyond. Estimation is exact Gaussian maximum likelihood through the Kalman filter (`statsmodels`).\n\n**Unit root.** ADF regression $\\Delta y_t=\\mu+\\rho y_{t-1}+\\sum_j\\gamma_j\\Delta y_{t-j}+u_t$, $H_0:\\rho=0$ (unit root). KPSS: $H_0$ is stationarity, statistic $\\eta=T^{-2}\\sum_t S_t^2/\\hat\\lambda^2$ on partial sums of residuals. Reading them together: ADF rejects and KPSS does not → stationary; ADF does not and KPSS rejects → unit root; otherwise inconclusive.\n\n**Order selection.** $d$ is the number of differences after which KPSS stops rejecting; $(p,q)$ (and $P,Q$) minimise $\\text{AIC}=-2\\ell+2k$ or $\\text{BIC}=-2\\ell+k\\ln n$ over the grid.\n\n**Diagnostics.** Ljung-Box $Q(m)=n(n+2)\\sum_{k\\le m}\\hat\\rho_k^2/(n-k)\\sim\\chi^2_{m-p-q}$ on the residuals, ARCH-LM and Jarque-Bera; AR and MA roots must lie outside the unit circle.\n\n**Forecasts.** $\\hat y_{T+h|T}$ with Gaussian intervals $\\hat y_{T+h|T}\\pm z_{\\alpha/2}\\,\\hat\\sigma\\sqrt{\\sum_{j<h}\\psi_j^2}$, ignoring parameter uncertainty.\n\n**Hold-out.** Orders and parameters come from the estimation sample. $\\text{RMSE}=\\sqrt{\\overline{e_t^2}}$, $\\text{MAE}=\\overline{|e_t|}$, $\\text{MASE}=\\text{MAE}/\\overline{|y_t-y_{t-1}|}_{\\text{in-sample}}$; the benchmark is the random walk $\\hat y_{t+1|t}=y_t$. Equal accuracy is tested with Diebold-Mariano on squared errors.","provenance":{"data":[{"symbol":"AAPL","provider":"FMP","retrievedAt":"2026-11-20T23:35:34+00:00","start":"2021-11-10","end":"2026-11-20","observations":1263,"frequency":"1d","adjusted":"split_div","currency":null}],"spec":{"symbol":"AAPL","period_days":1260,"start":null,"end":null,"series":"close","transform":"log","frequency":"daily","auto":true,"criterion":"bic","max_p":3,"max_q":3,"p":1,"d":"auto","q":0,"seasonal_period":0,"seasonal_p":1,"seasonal_d":0,"seasonal_q":0,"deterministic":"constant","horizon":21,"holdout":60,"order":[1,1,0],"seasonal_order":[0,0,0,0],"trend":"t"},"seed":null,"software":{"python":"3.14.4","numpy":"2.4.6","pandas":"3.0.3","scipy":"1.17.1","statsmodels":"0.14.6","arch":"8.0.0","scikit-learn":"1.8.0"},"computedAt":"2026-11-20T23:35:38+00:00","durationMs":7425,"reproduce":"import numpy as np, pandas as pd\nfrom statsmodels.tsa.arima.model import ARIMA\nfrom statsmodels.tsa.stattools import adfuller, kpss\n# s: pd.Series of the daily close of AAPL (2021-11-12 → 2026-11-20, 1261 observations)\ny = np.log(s).values\nprint(\"ADF p:\", adfuller(y, regression='c', autolag=\"AIC\")[1], \" KPSS stat:\", kpss(y, regression='c', nlags=\"auto\")[0])\nres = ARIMA(y, order=(1, 1, 0), seasonal_order=(0, 0, 0, 0), trend='t').fit()\nprint(res.summary())\nfc = res.get_forecast(21)\nprint(fc.predicted_mean, fc.conf_int(alpha=0.05))"}}}}2
Files main
Menu

Theme