The previous lesson's naive regression said marketing spend has no measurable effect on sales (p≈0.96) — but it ignored a documented marketing→sales lag and never checked whether OLS's assumptions hold. This lesson reruns the regression with the lagged predictor (which flips the marketing result to significant), then runs lmda regdiag's diagnostics on that same lagged model — and finds a residual-autocorrelation problem that means even the "corrected" result shouldn't be trusted at face value either.

Correcting the model: use the lagged predictor

data/sales.csv (same 156-week retail dataset as the previous lesson) also carries marketing_lag2 — marketing spend shifted 2 weeks earlier, matching the delay the dataset's design documents between spend and its effect on sales. Swapping marketing for marketing_lag2:

lmda regress data/sales.csv --y units_sold --x price,marketing_lag2,holiday --format json
{
  "adjusted_r_squared": 0.7837039477843158,
  "coefficients": [
    {
      "estimate": 1595.4813610748583,
      "p_value": 1.2487294651448963e-10,
      "std_error": 230.90216821705334,
      "t_statistic": 6.909772105626437,
      "term": "intercept"
    },
    {
      "estimate": -18.01801664577129,
      "p_value": 0.03913916340141923,
      "std_error": 8.659594922541006,
      "t_statistic": -2.080699710198941,
      "term": "price"
    },
    {
      "estimate": 0.20788142385582084,
      "p_value": 0.04522991766503192,
      "std_error": 0.10295517026688451,
      "t_statistic": 2.0191450639821418,
      "term": "marketing_lag2"
    },
    {
      "estimate": 396.8395821484956,
      "p_value": 2.3871191779506156e-34,
      "std_error": 24.83716128981042,
      "t_statistic": 15.97765451204366,
      "term": "holiday"
    }
  ],
  "dropped": 0,
  "method": "ols",
  "n": 156,
  "r_squared": 0.7878903229884904,
  "x": [
    "price",
    "marketing_lag2",
    "holiday"
  ],
  "y": "units_sold"
}

With the lag, marketing_lag2's coefficient flips from the previous lesson's p≈0.96 to p≈0.045 — significant at the conventional 0.05 threshold. Lagging really did change the naive conclusion: this model finds marketing spend from 2 weeks earlier does predict sales. Before trusting that p≈0.045, run the same model through diagnostics.

Diagnosing the lagged model

lmda regdiag data/sales.csv --y units_sold --x price,marketing_lag2,holiday --format json
{
  "adjusted_r_squared": 0.7837039477843158,
  "dropped": 0,
  "durbin_watson": 0.6776686876158092,
  "heteroskedasticity": null,
  "n": 156,
  "r_squared": 0.7878903229884904,
  "reset": null,
  "residual_degrees_of_freedom": 152,
  "residual_standard_error": 68.5540684346531,
  "robust": null,
  "rows": [
    {
      "cooks_distance": 0.008000214363942246,
      "fitted": 1250.8780759072883,
      "leverage": 0.007570560949905084,
      "residual": -139.87807590728832,
      "row": 0,
      "standardized_residual": -2.040405173627623,
      "studentized_residual": -2.0481728114542292
    },
    {
      "cooks_distance": 0.01479248158338219,
      "fitted": 1253.040237904781,
      "leverage": 0.007352948455832166,
      "residual": -193.0402379047809,
      "row": 1,
      "standardized_residual": -2.815883029448356,
      "studentized_residual": -2.8262929940914323
    },
    {
      "cooks_distance": 0.004374353608331193,
      "fitted": 1253.7609585706118,
      "leverage": 0.007382530453366273,
      "residual": -104.76095857061173,
      "row": 2,
      "standardized_residual": -1.5281508590620212,
      "studentized_residual": -1.5338230951744105
    },
    {
      "cooks_distance": 0.00923988308649289,
      "fitted": 1257.414830839125,
      "leverage": 0.015160733526932734,
      "residual": -105.41483083912492,
      "row": 3,
      "standardized_residual": -1.5376889110470244,
      "studentized_residual": -1.5494793918867646
    },
    {
      "cooks_distance": 0.016655127371599344,
      "fitted": 1267.0289140068999,
      "leverage": 0.02223371714532217,
      "residual": -116.02891400689981,
      "row": 4,
      "standardized_residual": -1.692516821485227,
      "studentized_residual": -1.711651973659615
    },
    {
      "cooks_distance": 0.0037106536911885785,
      "fitted": 1260.738038232814,
      "leverage": 0.009103621122673483,
      "residual": -86.73803823281393,
      "row": 5,
      "standardized_residual": -1.2652500458888754,
      "studentized_residual": -1.2710488471515433
    },
    {
      "cooks_distance": 0.00432101948598358,
      "fitted": 1252.459907150787,
      "leverage": 0.008079240634995478,
      "residual": -99.45990715078709,
      "row": 6,
      "standardized_residual": -1.4508242825237128,
      "studentized_residual": -1.4567208155578464
    },
    {
      "cooks_distance": 0.004333583532808951,
      "fitted": 1251.1721093739618,
      "leverage": 0.008148687708084003,
      "residual": -99.17210937396186,
      "row": 7,
      "standardized_residual": -1.4466261687808417,
      "studentized_residual": -1.452556489179443
    },
    {
      "cooks_distance": 0.0152682826603703,
      "fitted": 1247.8452258347006,
      "leverage": 0.010988044116058289,
      "residual": -159.84522583470067,
      "row": 8,
      "standardized_residual": -2.331666514979601,
      "studentized_residual": -2.344583287807197
    },
    {
      "cooks_distance": 0.0036882145149007626,
      "fitted": 1255.0137580868175,
      "leverage": 0.007114863415129661,
      "residual": -98.01375808681743,
      "row": 9,
      "standardized_residual": -1.4297292680775875,
      "studentized_residual": -1.4348427347577855
    },
    {
      "cooks_distance": 0.0025532785166104085,
      "fitted": 1255.250254936533,
      "leverage": 0.010393500884208996,
      "residual": -67.25025493653307,
      "row": 10,
      "standardized_residual": -0.980981238197951,
      "studentized_residual": -0.986119239115
    },
    {
      "cooks_distance": 0.0016880329503690945,
      "fitted": 1237.4458876555789,
      "leverage": 0.015567403468405731,
      "residual": -44.445887655578886,
      "row": 11,
      "standardized_residual": -0.6483333326591033,
      "studentized_residual": -0.653439460759993
    },
    {
      "cooks_distance": 0.0001541457812319134,
      "fitted": 1259.2642565323722,
      "leverage": 0.007688639925994093,
      "residual": -19.2642565323721,
      "row": 12,
      "standardized_residual": -0.281008216904517,
      "studentized_residual": -0.28209477203087563
    },
    {
      "cooks_distance": 0.0002524201409697451,
      "fitted": 1251.4467503496164,
      "leverage": 0.008485612316023197,
      "residual": -23.446750349616345,
      "row": 13,
      "standardized_residual": -0.34201836426332866,
      "studentized_residual": -0.343478782895558
    },
    {
      "cooks_distance": 0.0038201557386326143,
      "fitted": 1254.2890196939784,
      "leverage": 0.01174122175691773,
      "residual": -77.28901969397835,
      "row": 14,
      "standardized_residual": -1.127416963847325,
      "studentized_residual": -1.134094449392359
    },
    {
      "cooks_distance": 0.004581777537351433,
      "fitted": 1252.1881615631369,
      "leverage": 0.008956111644585372,
      "residual": -97.18816156313682,
      "row": 15,
      "standardized_residual": -1.4176862698641761,
      "studentized_residual": -1.4240777121583592
    },
    {
      "cooks_distance": 0.00022866759024721208,
      "fitted": 1248.7748461781202,
      "leverage": 0.008152853996940535,
      "residual": -22.774846178120196,
      "row": 16,
      "standardized_residual": -0.332217280435071,
      "studentized_residual": -0.33357987740083334
    },
    {
      "cooks_distance": 0.0003585285673124346,
      "fitted": 1250.2887044266954,
      "leverage": 0.009566703659870082,
      "residual": -26.288704426695485,
      "row": 17,
      "standardized_residual": -0.38347402316106627,
      "studentized_residual": -0.38532158123099647
    },
    {
      "cooks_distance": 0.0002190002188658908,
      "fitted": 1294.911886652165,
      "leverage": 0.0560729509741077,
      "residual": 8.088113347834886,
      "row": 18,
      "standardized_residual": 0.11798152221329668,
      "studentized_residual": 0.1214352523161501
    },
    {
      "cooks_distance": 0.00011111873173591756,
      "fitted": 1253.246326807911,
      "leverage": 0.00882837967860632,
      "residual": -15.246326807910938,
      "row": 19,
      "standardized_residual": -0.2223985702970203,
      "studentized_residual": -0.22338682817858724
    },
    {
      "cooks_distance": 2.756745266562986e-06,
      "fitted": 1251.5584272408976,
      "leverage": 0.007794357827297435,
      "residual": -2.5584272408976405,
      "row": 20,
      "standardized_residual": -0.037319845478410614,
      "studentized_residual": -0.037466143374552334
    },
    {
      "cooks_distance": 0.0007613771610734141,
      "fitted": 1254.6113334956508,
      "leverage": 0.01045599655863887,
      "residual": -36.61133349565079,
      "row": 21,
      "standardized_residual": -0.534050484991264,
      "studentized_residual": -0.5368645875225836
    },
    {
      "cooks_distance": 4.156573606561025e-05,
      "fitted": 1249.3384488235095,
      "leverage": 0.008233548417581935,
      "residual": 9.66155117649049,
      "row": 22,
      "standardized_residual": 0.1409333012190231,
      "studentized_residual": 0.14151709932991385
    },
    {
      "cooks_distance": 0.00033250239189438693,
      "fitted": 1232.7088978808536,
      "leverage": 0.021438853633908725,
      "residual": -16.708897880853506,
      "row": 23,
      "standardized_residual": -0.24373313302011695,
      "studentized_residual": -0.24638858703058586
    },
    {
      "cooks_distance": 0.0009293215687180696,
      "fitted": 1243.8274146823958,
      "leverage": 0.011327152345095232,
      "residual": -38.82741468239569,
      "row": 24,
      "standardized_residual": -0.5663765195701935,
      "studentized_residual": -0.5696117466550108
    },
    {
      "cooks_distance": 0.0010697215794144433,
      "fitted": 1241.6683497528745,
      "leverage": 0.01532556544942144,
      "residual": -35.6683497528746,
      "row": 25,
      "standardized_residual": -0.5202951563243,
      "studentized_residual": -0.5243284845017231
    },
    {
      "cooks_distance": 0.007781722736592124,
      "fitted": 1224.9730510215775,
      "leverage": 0.040104900757740314,
      "residual": -57.973051021577575,
      "row": 26,
      "standardized_residual": -0.8456544205955985,
      "studentized_residual": -0.8631395884484414
    },
    {
      "cooks_distance": 2.8022892006731266e-05,
      "fitted": 1221.5295163887922,
      "leverage": 0.040285052508577446,
      "residual": 3.47048361120769,
      "row": 27,
      "standardized_residual": 0.05062403574947289,
      "studentized_residual": 0.05167561270935354
    },
    {
      "cooks_distance": 1.166800928564041e-05,
      "fitted": 1226.504990723351,
      "leverage": 0.032706037835772424,
      "residual": -2.504990723351016,
      "row": 28,
      "standardized_residual": -0.03654036559097605,
      "studentized_residual": -0.03715297965509753
    },
    {
      "cooks_distance": 0.0003835442731792949,
      "fitted": 1226.529601403353,
      "leverage": 0.04250628543584706,
      "residual": 12.470398596647172,
      "row": 29,
      "standardized_residual": 0.18190603244115505,
      "studentized_residual": 0.18589989123662112
    },
    {
      "cooks_distance": 3.1605631736589302e-06,
      "fitted": 1218.0415100832315,
      "leverage": 0.057454079773284115,
      "residual": 0.9584899167683917,
      "row": 30,
      "standardized_residual": 0.013981517634975092,
      "studentized_residual": 0.014401345044020145
    },
    {
      "cooks_distance": 0.0009194191939394473,
      "fitted": 1230.147414850741,
      "leverage": 0.03295258436745151,
      "residual": -22.14741485074098,
      "row": 31,
      "standardized_residual": -0.3230649231540834,
      "studentized_residual": -0.32852310785404765
    },
    {
      "cooks_distance": 0.00019669288735665283,
      "fitted": 1242.733860798218,
      "leverage": 0.011488723564172307,
      "residual": -17.73386079821806,
      "row": 32,
      "standardized_residual": -0.25868429406377647,
      "studentized_residual": -0.2601831980429587
    },
    {
      "cooks_distance": 0.000851808179284162,
      "fitted": 1242.2328177693776,
      "leverage": 0.011572760884204916,
      "residual": 36.76718223062249,
      "row": 33,
      "standardized_residual": 0.5363238545888722,
      "studentized_residual": 0.5394544268320449
    },
    {
      "cooks_distance": 0.000289623322928265,
      "fitted": 1244.503468486059,
      "leverage": 0.0171661142914067,
      "residual": -17.503468486059177,
      "row": 34,
      "standardized_residual": -0.2553235553444035,
      "studentized_residual": -0.2575436358700567
    },
    {
      "cooks_distance": 5.3426619904845534e-05,
      "fitted": 1244.0905522290038,
      "leverage": 0.010023853537067343,
      "residual": 9.909447770996277,
      "row": 35,
      "standardized_residual": 0.14454937536555004,
      "studentized_residual": 0.1452793386402156
    },
    {
      "cooks_distance": 1.696829451714027e-05,
      "fitted": 1254.5992509890034,
      "leverage": 0.007219085723143295,
      "residual": -6.599250989003454,
      "row": 36,
      "standardized_residual": -0.09626344781118237,
      "studentized_residual": -0.09661280753747929
    },
    {
      "cooks_distance": 0.0006031639887209725,
      "fitted": 1251.4075944605197,
      "leverage": 0.007570541468336731,
      "residual": -38.40759446051981,
      "row": 37,
      "standardized_residual": -0.5602525909476923,
      "studentized_residual": -0.562385416335213
    },
    {
      "cooks_distance": 0.0008328771620368916,
      "fitted": 1257.1514557963521,
      "leverage": 0.007244710274300204,
      "residual": -46.15145579635207,
      "row": 38,
      "standardized_residual": -0.6732125000042035,
      "studentized_residual": -0.675664445560905
    },
    {
      "cooks_distance": 0.00041044395098605187,
      "fitted": 1264.7384510947927,
      "leverage": 0.01138338212322723,
      "residual": -25.738451094792723,
      "row": 39,
      "standardized_residual": -0.3754474633307438,
      "studentized_residual": -0.3776028132364713
    },
    {
      "cooks_distance": 0.00044776652336312784,
      "fitted": 1257.9093999290849,
      "leverage": 0.008132943171823614,
      "residual": -31.909399929084984,
      "row": 40,
      "standardized_residual": -0.46546325634198593,
      "studentized_residual": -0.46736767374218635
    },
    {
      "cooks_distance": 0.0051902161099180765,
      "fitted": 1284.5352690376235,
      "leverage": 0.06722711988699623,
      "residual": -35.53526903762353,
      "row": 41,
      "standardized_residual": -0.5183539044294118,
      "studentized_residual": -0.5367084325350633
    },
    {
      "cooks_distance": 0.01882964271481075,
      "fitted": 1281.6222647212273,
      "leverage": 0.04411687167608595,
      "residual": -85.62226472122734,
      "row": 42,
      "standardized_residual": -1.248974228317958,
      "studentized_residual": -1.277471085440394
    },
    {
      "cooks_distance": 0.0023005775482255178,
      "fitted": 1251.9402035911476,
      "leverage": 0.007999324763144711,
      "residual": -72.94020359114754,
      "row": 43,
      "standardized_residual": -1.0639806689325138,
      "studentized_residual": -1.068261935008066
    },
    {
      "cooks_distance": 0.0027661393850277067,
      "fitted": 1258.204877844473,
      "leverage": 0.01394877640193141,
      "residual": -60.20487784447307,
      "row": 44,
      "standardized_residual": -0.8782101371833442,
      "studentized_residual": -0.8843999466036764
    },
    {
      "cooks_distance": 0.00047995035874213836,
      "fitted": 1249.2033746953514,
      "leverage": 0.008551848987374898,
      "residual": -32.20337469535131,
      "row": 45,
      "standardized_residual": -0.46975147399235845,
      "studentized_residual": -0.4717730714029833
    },
    {
      "cooks_distance": 0.00949419191462347,
      "fitted": 1267.404460405009,
      "leverage": 0.010927379513344292,
      "residual": -126.40446040500922,
      "row": 46,
      "standardized_residual": -1.843865189788117,
      "studentized_residual": -1.8540228205763727
    },
    {
      "cooks_distance": 0.013254963012219557,
      "fitted": 1669.7325448288552,
      "leverage": 0.0816487158275032,
      "residual": -50.732544828855275,
      "row": 47,
      "standardized_residual": -0.7400369662555388,
      "studentized_residual": -0.7722341358943055
    },
    {
      "cooks_distance": 0.032850230761302876,
      "fitted": 1669.5857720822585,
      "leverage": 0.08391646645868198,
      "residual": -78.5857720822586,
      "row": 48,
      "standardized_residual": -1.1463327250543545,
      "studentized_residual": -1.1976864942147383
    },
    {
      "cooks_distance": 0.009363373065674392,
      "fitted": 1682.863061029234,
      "leverage": 0.06940891507341887,
      "residual": -46.863061029233776,
      "row": 49,
      "standardized_residual": -0.6835927042594772,
      "studentized_residual": -0.7086274559426963
    },
    {
      "cooks_distance": 0.02805926039078653,
      "fitted": 1733.007378682922,
      "leverage": 0.10892840269425443,
      "residual": -62.00737868292222,
      "row": 50,
      "standardized_residual": -0.9045032643398648,
      "studentized_residual": -0.9581948628040203
    },
    {
      "cooks_distance": 0.014087215343504605,
      "fitted": 1674.038976069459,
      "leverage": 0.07482677559023299,
      "residual": -55.038976069459046,
      "row": 51,
      "standardized_residual": -0.8028549920698452,
      "studentized_residual": -0.8346907188058885
    },
    {
      "cooks_distance": 0.0015255331801992554,
      "fitted": 1284.199054246277,
      "leverage": 0.044692787611684145,
      "residual": -24.199054246276962,
      "row": 52,
      "standardized_residual": -0.35299224099797827,
      "studentized_residual": -0.36115499941701334
    },
    {
      "cooks_distance": 0.006780095567038246,
      "fitted": 1283.0419289823928,
      "leverage": 0.03886376603391391,
      "residual": -55.04192898239293,
      "row": 53,
      "standardized_residual": -0.8028980662885067,
      "studentized_residual": -0.8189698937853311
    },
    {
      "cooks_distance": 0.014374311323323306,
      "fitted": 1314.0380446979816,
      "leverage": 0.08110859430745752,
      "residual": -53.03804469798161,
      "row": 54,
      "standardized_residual": -0.7736673535070843,
      "studentized_residual": -0.807090390497656
    },
    {
      "cooks_distance": 0.0042322116998340185,
      "fitted": 1270.0196998212364,
      "leverage": 0.02587152257053467,
      "residual": -54.01969982123627,
      "row": 55,
      "standardized_residual": -0.7879867826185804,
      "studentized_residual": -0.7983821399172553
    },
    {
      "cooks_distance": 0.009588084488363057,
      "fitted": 1272.534437174943,
      "leverage": 0.02901165847449559,
      "residual": -76.53443717494285,
      "row": 56,
      "standardized_residual": -1.1164098487881398,
      "studentized_residual": -1.1329654114288774
    },
    {
      "cooks_distance": 0.0013475692112494121,
      "fitted": 1251.7058278624434,
      "leverage": 0.009299998401242992,
      "residual": -51.70582786244325,
      "row": 57,
      "standardized_residual": -0.7542342714747866,
      "studentized_residual": -0.7577661140127995
    },
    {
      "cooks_distance": 0.0029313160098444345,
      "fitted": 1252.5668896427633,
      "leverage": 0.013693785060346745,
      "residual": -62.56688964276324,
      "row": 58,
      "standardized_residual": -0.9126648654325025,
      "studentized_residual": -0.9189787034468071
    },
    {
      "cooks_distance": 0.0030912983943910664,
      "fitted": 1260.8604930834967,
      "leverage": 0.01163166119109987,
      "residual": -69.86049308349683,
      "row": 59,
      "standardized_residual": -1.0190568507263582,
      "studentized_residual": -1.025035721742238
    },
    {
      "cooks_distance": 0.0021580025710769284,
      "fitted": 1240.037443541416,
      "leverage": 0.012595403277244021,
      "residual": -56.037443541416025,
      "row": 60,
      "standardized_residual": -0.817419663354216,
      "studentized_residual": -0.8226166741999602
    },
    {
      "cooks_distance": 0.001349736135756517,
      "fitted": 1244.3412168901805,
      "leverage": 0.009816557943798751,
      "residual": -50.34121689018044,
      "row": 61,
      "standardized_residual": -0.734328655317759,
      "studentized_residual": -0.7379597004660027
    },
    {
      "cooks_distance": 0.0008649819128085172,
      "fitted": 1272.8021909978856,
      "leverage": 0.038348012626843606,
      "residual": -19.802190997885678,
      "row": 62,
      "standardized_residual": -0.2888550811066955,
      "studentized_residual": -0.2945581507667581
    },
    {
      "cooks_distance": 0.0003646662555441943,
      "fitted": 1250.0967280471032,
      "leverage": 0.00986815526081437,
      "residual": -26.09672804710322,
      "row": 63,
      "standardized_residual": -0.380673658660814,
      "studentized_residual": -0.38256594867744614
    },
    {
      "cooks_distance": 0.0004745415747944295,
      "fitted": 1249.2066604621396,
      "leverage": 0.007961725125371964,
      "residual": -33.206660462139496,
      "row": 64,
      "standardized_residual": -0.4843864298702074,
      "studentized_residual": -0.48632629690699103
    },
    {
      "cooks_distance": 0.0003030077104199716,
      "fitted": 1246.2454595300478,
      "leverage": 0.0091265530399184,
      "residual": 24.754540469952293,
      "row": 65,
      "standardized_residual": 0.36109513315827113,
      "studentized_residual": 0.36275427546550965
    },
    {
      "cooks_distance": 0.00033651224103127954,
      "fitted": 1245.8966026261787,
      "leverage": 0.011578700502612473,
      "residual": 23.103397373821263,
      "row": 66,
      "standardized_residual": 0.33700986537135735,
      "studentized_residual": 0.3389780418020142
    },
    {
      "cooks_distance": 0.0006784514256260087,
      "fitted": 1241.1551201321156,
      "leverage": 0.011550969110948786,
      "residual": 32.844879867884494,
      "row": 67,
      "standardized_residual": 0.4791091268229075,
      "studentized_residual": 0.4819004191964043
    },
    {
      "cooks_distance": 0.00032472102418539634,
      "fitted": 1251.6118973334994,
      "leverage": 0.007462053723078282,
      "residual": 28.38810266650065,
      "row": 68,
      "standardized_residual": 0.4140980005229109,
      "studentized_residual": 0.41565171212314805
    },
    {
      "cooks_distance": 0.00015153089728615164,
      "fitted": 1247.189966663998,
      "leverage": 0.008822687451483261,
      "residual": 17.81003333600199,
      "row": 69,
      "standardized_residual": 0.2597954248766259,
      "studentized_residual": 0.2609491113933657
    },
    {
      "cooks_distance": 0.00021930370978904182,
      "fitted": 1249.8916021097828,
      "leverage": 0.009992958050727295,
      "residual": 20.108397890217233,
      "row": 70,
      "standardized_residual": 0.2933217291018242,
      "studentized_residual": 0.29479838132417036
    },
    {
      "cooks_distance": 0.0003071615398446157,
      "fitted": 1247.2406812700642,
      "leverage": 0.008553872851651089,
      "residual": 25.759318729935767,
      "row": 71,
      "standardized_residual": 0.3757518600736291,
      "studentized_residual": 0.37736931092120307
    },
    {
      "cooks_distance": 0.002437810672979054,
      "fitted": 1258.360405024156,
      "leverage": 0.009275131772027462,
      "residual": 69.63959497584389,
      "row": 72,
      "standardized_residual": 1.0158346042179178,
      "studentized_residual": 1.0205786308548603
    },
    {
      "cooks_distance": 0.002530751265086192,
      "fitted": 1255.9637697032633,
      "leverage": 0.014708473228834488,
      "residual": 56.03623029673663,
      "row": 73,
      "standardized_residual": 0.8174019657221557,
      "studentized_residual": 0.8234804701253476
    },
    {
      "cooks_distance": 0.00012969581705332383,
      "fitted": 1260.31415531754,
      "leverage": 0.007675527267572928,
      "residual": 17.68584468245993,
      "row": 74,
      "standardized_residual": 0.25798388171984826,
      "studentized_residual": 0.25897969912781355
    },
    {
      "cooks_distance": 0.0018996366203508867,
      "fitted": 1260.7247910803897,
      "leverage": 0.009962179799707416,
      "residual": 59.275208919610336,
      "row": 75,
      "standardized_residual": 0.8646490321156135,
      "studentized_residual": 0.8689883757183444
    },
    {
      "cooks_distance": 0.00028707363540971675,
      "fitted": 1266.0345641285721,
      "leverage": 0.020152210210368525,
      "residual": -16.034564128572192,
      "row": 76,
      "standardized_residual": -0.23389660883302074,
      "studentized_residual": -0.23628960512946703
    },
    {
      "cooks_distance": 0.0022346835761672436,
      "fitted": 1279.9532925068002,
      "leverage": 0.037865786351581436,
      "residual": 32.04670749319976,
      "row": 77,
      "standardized_residual": 0.46746616539246283,
      "studentized_residual": 0.4765762036526459
    },
    {
      "cooks_distance": 0.00012912550059163483,
      "fitted": 1252.3315021509013,
      "leverage": 0.010118941575460496,
      "residual": -15.331502150901319,
      "row": 78,
      "standardized_residual": -0.22364102526629132,
      "studentized_residual": -0.22478119078548128
    },
    {
      "cooks_distance": 0.0010063890074008674,
      "fitted": 1259.584631421275,
      "leverage": 0.01316088215144462,
      "residual": 37.41536857872509,
      "row": 79,
      "standardized_residual": 0.5457789659032425,
      "studentized_residual": 0.5494062757045249
    },
    {
      "cooks_distance": 0.024576055065844225,
      "fitted": 1303.2956045748015,
      "leverage": 0.07661483327797573,
      "residual": 71.70439542519841,
      "row": 80,
      "standardized_residual": 1.0459539027001477,
      "studentized_residual": 1.0884816146316145
    },
    {
      "cooks_distance": 0.009700597031825508,
      "fitted": 1287.8025794524608,
      "leverage": 0.04191187874475485,
      "residual": 63.197420547539075,
      "row": 81,
      "standardized_residual": 0.9218624363305282,
      "studentized_residual": 0.9418102030973974
    },
    {
      "cooks_distance": 9.565007854648187e-05,
      "fitted": 1246.917885985487,
      "leverage": 0.008906464961360898,
      "residual": 14.08211401451306,
      "row": 82,
      "standardized_residual": 0.2054161676478234,
      "studentized_residual": 0.20633708980455287
    },
    {
      "cooks_distance": 0.0029862935722485837,
      "fitted": 1262.4560106555518,
      "leverage": 0.008718430007603582,
      "residual": 79.54398934444815,
      "row": 83,
      "standardized_residual": 1.160310265469814,
      "studentized_residual": 1.1654016231658755
    },
    {
      "cooks_distance": 0.03444556996762273,
      "fitted": 1277.234034255675,
      "leverage": 0.05478056461523715,
      "residual": 102.7659657443251,
      "row": 84,
      "standardized_residual": 1.499049846214209,
      "studentized_residual": 1.5418770801267054
    },
    {
      "cooks_distance": 5.718072093204653e-05,
      "fitted": 1249.6686875033522,
      "leverage": 0.008234433066776924,
      "residual": 11.331312496647715,
      "row": 85,
      "standardized_residual": 0.16529015352967583,
      "studentized_residual": 0.1659749207992433
    },
    {
      "cooks_distance": 0.007292959097436257,
      "fitted": 1258.9879141401127,
      "leverage": 0.014445730688854415,
      "residual": 96.01208585988735,
      "row": 86,
      "standardized_residual": 1.400530822636846,
      "studentized_residual": 1.4107576025148332
    },
    {
      "cooks_distance": 0.001105139197083027,
      "fitted": 1278.537597175295,
      "leverage": 0.06017663666131875,
      "residual": 17.462402824705006,
      "row": 87,
      "standardized_residual": 0.254724529461741,
      "studentized_residual": 0.26275297992248403
    },
    {
      "cooks_distance": 0.06788669125171301,
      "fitted": 1242.7546001432556,
      "leverage": 0.011136047746092377,
      "residual": -334.75460014325563,
      "row": 88,
      "standardized_residual": -4.883074160103997,
      "studentized_residual": -4.910492445808444
    },
    {
      "cooks_distance": 0.00016597354502659458,
      "fitted": 1232.5994949932028,
      "leverage": 0.02291812399348276,
      "residual": 11.400505006797179,
      "row": 89,
      "standardized_residual": 0.16629946649576796,
      "studentized_residual": 0.1682384959744505
    },
    {
      "cooks_distance": 0.0003429736136938046,
      "fitted": 1243.6668157057738,
      "leverage": 0.01336922718071044,
      "residual": -21.66681570577391,
      "row": 90,
      "standardized_residual": -0.3160544107812811,
      "studentized_residual": -0.3181885350864235
    },
    {
      "cooks_distance": 0.0015740920004009642,
      "fitted": 1252.3369643266242,
      "leverage": 0.011270143617987564,
      "residual": 50.66303567337589,
      "row": 91,
      "standardized_residual": 0.7390230343756877,
      "studentized_residual": 0.743223016575646
    },
    {
      "cooks_distance": 0.001847425748760136,
      "fitted": 1270.0625806532532,
      "leverage": 0.028461380359753603,
      "residual": 33.937419346746815,
      "row": 92,
      "standardized_residual": 0.4950460289471592,
      "studentized_residual": 0.5022449129893748
    },
    {
      "cooks_distance": 0.0013326122806595463,
      "fitted": 1287.9411410273747,
      "leverage": 0.06765276134899148,
      "residual": -17.941141027374595,
      "row": 93,
      "standardized_residual": -0.26170789622028623,
      "studentized_residual": -0.27103662568794923
    },
    {
      "cooks_distance": 0.00011458927550603469,
      "fitted": 1244.5327117868678,
      "leverage": 0.009996558673935285,
      "residual": -14.532711786867761,
      "row": 94,
      "standardized_residual": -0.21198904920895523,
      "studentized_residual": -0.2130566405744655
    },
    {
      "cooks_distance": 0.00084232376205731,
      "fitted": 1255.9132079798162,
      "leverage": 0.0070930391789826765,
      "residual": -46.91320797981628,
      "row": 95,
      "standardized_residual": -0.6843241991470534,
      "studentized_residual": -0.686764156057014
    },
    {
      "cooks_distance": 0.00015636637428172545,
      "fitted": 1268.8019050562252,
      "leverage": 0.014972304022405812,
      "residual": -13.801905056225172,
      "row": 96,
      "standardized_residual": -0.20132875220062804,
      "studentized_residual": -0.20285306825436553
    },
    {
      "cooks_distance": 0.00013440303732106874,
      "fitted": 1264.2108649637557,
      "leverage": 0.014987750633295499,
      "residual": 12.78913503624421,
      "row": 97,
      "standardized_residual": 0.18655544927191345,
      "studentized_residual": 0.18796938635187072
    },
    {
      "cooks_distance": 0.00411087807375812,
      "fitted": 1277.206648617412,
      "leverage": 0.02685144777709221,
      "residual": -52.20664861741203,
      "row": 98,
      "standardized_residual": -0.7615397570047399,
      "studentized_residual": -0.7719745991172304
    },
    {
      "cooks_distance": 0.00048725367914611146,
      "fitted": 1690.8820658010857,
      "leverage": 0.06729022047540813,
      "residual": -10.88206580108578,
      "row": 99,
      "standardized_residual": -0.1587369801612686,
      "studentized_residual": -0.1643632986932139
    },
    {
      "cooks_distance": 0.00020350361210747702,
      "fitted": 1696.2556054183667,
      "leverage": 0.07237052435043782,
      "residual": 6.744394581633296,
      "row": 100,
      "standardized_residual": 0.09838066121578425,
      "studentized_residual": 0.1021462593403357
    },
    {
      "cooks_distance": 0.004185825897740415,
      "fitted": 1700.3370432383012,
      "leverage": 0.07630242623315545,
      "residual": 29.662956761698652,
      "row": 101,
      "standardized_residual": 0.4326943307525779,
      "studentized_residual": 0.45021120906662715
    },
    {
      "cooks_distance": 0.005533878469142579,
      "fitted": 1695.1029728738206,
      "leverage": 0.0771133517141767,
      "residual": 33.89702712617938,
      "row": 102,
      "standardized_residual": 0.49445682656297196,
      "studentized_residual": 0.5147000325863185
    },
    {
      "cooks_distance": 0.001763941906972931,
      "fitted": 1711.3021311461248,
      "leverage": 0.08320539858057133,
      "residual": -18.30213114612474,
      "row": 103,
      "standardized_residual": -0.2669736685805984,
      "studentized_residual": -0.27882544608680226
    },
    {
      "cooks_distance": 0.00673031642813497,
      "fitted": 1319.3219090094917,
      "leverage": 0.09361181490278879,
      "residual": -33.32190900949168,
      "row": 104,
      "standardized_residual": -0.48606756346276786,
      "studentized_residual": -0.51055146010989
    },
    {
      "cooks_distance": 0.00027885307297368316,
      "fitted": 1302.920783646337,
      "leverage": 0.05840190608469845,
      "residual": -8.920783646337036,
      "row": 105,
      "standardized_residual": -0.1301277057661498,
      "studentized_residual": -0.13410253500937047
    },
    {
      "cooks_distance": 0.0008240063856216549,
      "fitted": 1256.4418969781318,
      "leverage": 0.015196335294433231,
      "residual": -31.441896978131744,
      "row": 106,
      "standardized_residual": -0.4586437784958407,
      "studentized_residual": -0.462168858304133
    },
    {
      "cooks_distance": 0.0006644620264449527,
      "fitted": 1247.4798912995425,
      "leverage": 0.008737305161112702,
      "residual": -37.47989129954242,
      "row": 107,
      "standardized_residual": -0.5467201605294788,
      "studentized_residual": -0.5491243571406997
    },
    {
      "cooks_distance": 2.4211726819896292e-08,
      "fitted": 1247.200897506019,
      "leverage": 0.011029847362880206,
      "residual": -0.20089750601881762,
      "row": 108,
      "standardized_residual": -0.0029304972061624107,
      "studentized_residual": -0.0029467936093320853
    },
    {
      "cooks_distance": 0.00035427104847747537,
      "fitted": 1255.2767492413814,
      "leverage": 0.008518112752841648,
      "residual": 27.723250758618523,
      "row": 109,
      "standardized_residual": 0.40439978824954487,
      "studentized_residual": 0.4061332318922482
    },
    {
      "cooks_distance": 0.00011288878769946,
      "fitted": 1294.6658187955975,
      "leverage": 0.08212712227837493,
      "residual": -4.665818795597581,
      "row": 110,
      "standardized_residual": -0.06806042153493952,
      "studentized_residual": -0.07104006760432098
    },
    {
      "cooks_distance": 0.0002919162079646488,
      "fitted": 1238.536686053221,
      "leverage": 0.015479951900596053,
      "residual": -18.536686053221015,
      "row": 111,
      "standardized_residual": -0.2703951271818462,
      "studentized_residual": -0.2725125946449305
    },
    {
      "cooks_distance": 0.00010284856799001993,
      "fitted": 1258.8340883770345,
      "leverage": 0.007290687762079598,
      "residual": 16.165911622965424,
      "row": 112,
      "standardized_residual": 0.2358125781896525,
      "studentized_residual": 0.23667692527415318
    },
    {
      "cooks_distance": 0.0006336715148117993,
      "fitted": 1256.8434985049576,
      "leverage": 0.00910387156086933,
      "residual": -35.84349850495747,
      "row": 113,
      "standardized_residual": -0.5228500557793168,
      "studentized_residual": -0.525246410203203
    },
    {
      "cooks_distance": 0.00209176721504979,
      "fitted": 1261.9564543821987,
      "leverage": 0.0427188504354525,
      "residual": 29.04354561780141,
      "row": 114,
      "standardized_residual": 0.42365896409906306,
      "studentized_residual": 0.4330087241135776
    },
    {
      "cooks_distance": 5.054819714310531e-05,
      "fitted": 1268.688826023002,
      "leverage": 0.01717169642090144,
      "residual": 7.311173976997812,
      "row": 115,
      "standardized_residual": 0.10664828716864479,
      "studentized_residual": 0.10757591715339583
    },
    {
      "cooks_distance": 0.00503061395064067,
      "fitted": 1255.6397186687882,
      "leverage": 0.010188664196373577,
      "residual": 95.36028133121175,
      "row": 116,
      "standardized_residual": 1.3910229328272585,
      "studentized_residual": 1.3981638797039966
    },
    {
      "cooks_distance": 0.0016768545704255826,
      "fitted": 1246.5564650920658,
      "leverage": 0.011635748063058317,
      "residual": 51.443534907934236,
      "row": 117,
      "standardized_residual": 0.7504081972461063,
      "studentized_residual": 0.7548124501798934
    },
    {
      "cooks_distance": 0.012458675045729405,
      "fitted": 1295.081965531518,
      "leverage": 0.06752203224844694,
      "residual": 54.918034468481885,
      "row": 118,
      "standardized_residual": 0.8010908137542658,
      "studentized_residual": 0.8295880012581828
    },
    {
      "cooks_distance": 0.009053803963014254,
      "fitted": 1279.605502654012,
      "leverage": 0.03490208884187839,
      "residual": 67.3944973459878,
      "row": 119,
      "standardized_residual": 0.9830853060198663,
      "studentized_residual": 1.000703726426126
    },
    {
      "cooks_distance": 3.49561892201165e-05,
      "fitted": 1263.4280238575082,
      "leverage": 0.01120582573562035,
      "residual": 7.571976142491735,
      "row": 120,
      "standardized_residual": 0.11045261521873746,
      "studentized_residual": 0.11107672174528654
    },
    {
      "cooks_distance": 0.003730677130912778,
      "fitted": 1250.1779481944511,
      "leverage": 0.008544654329457143,
      "residual": 89.82205180554898,
      "row": 121,
      "standardized_residual": 1.3102366330186352,
      "studentized_residual": 1.315870523129714
    },
    {
      "cooks_distance": 0.007360393458364708,
      "fitted": 1255.8373036161472,
      "leverage": 0.009103468338739557,
      "residual": 122.16269638385269,
      "row": 122,
      "standardized_residual": 1.7819904664053634,
      "studentized_residual": 1.7901574164742684
    },
    {
      "cooks_distance": 0.002548032665863912,
      "fitted": 1242.2428214617862,
      "leverage": 0.011168634553468254,
      "residual": 64.75717853821368,
      "row": 123,
      "standardized_residual": 0.9446146671796921,
      "studentized_residual": 0.9499342966393806
    },
    {
      "cooks_distance": 0.005460979476582984,
      "fitted": 1247.1473298187211,
      "leverage": 0.009167242628336139,
      "residual": 104.85267018127888,
      "row": 124,
      "standardized_residual": 1.5294886587398706,
      "studentized_residual": 1.5365478276398752
    },
    {
      "cooks_distance": 0.007057217817705961,
      "fitted": 1243.2181757184542,
      "leverage": 0.010771891985187534,
      "residual": 109.78182428154591,
      "row": 125,
      "standardized_residual": 1.6013903592927063,
      "studentized_residual": 1.610085673420596
    },
    {
      "cooks_distance": 0.0028559615078050066,
      "fitted": 1238.738324543786,
      "leverage": 0.014362525687836985,
      "residual": 60.26167545621401,
      "row": 126,
      "standardized_residual": 0.8790386454402258,
      "studentized_residual": 0.8854200759676335
    },
    {
      "cooks_distance": 0.008104073184176549,
      "fitted": 1259.5246873897927,
      "leverage": 0.008533283725068895,
      "residual": 132.47531261020723,
      "row": 127,
      "standardized_residual": 1.9324208706370933,
      "studentized_residual": 1.9407189638346123
    },
    {
      "cooks_distance": 0.0037869044560477952,
      "fitted": 1256.9198843515312,
      "leverage": 0.007753021253371385,
      "residual": 95.08011564846873,
      "row": 128,
      "standardized_residual": 1.386936148641575,
      "studentized_residual": 1.3923440876557733
    },
    {
      "cooks_distance": 0.003738621072217449,
      "fitted": 1260.59155177973,
      "leverage": 0.012712560838780966,
      "residual": 73.40844822027007,
      "row": 129,
      "standardized_residual": 1.070810965657629,
      "studentized_residual": 1.077682930490299
    },
    {
      "cooks_distance": 0.0017315638439022844,
      "fitted": 1253.6670215510926,
      "leverage": 0.00824028319706526,
      "residual": 62.33297844890748,
      "row": 130,
      "standardized_residual": 0.909252796693231,
      "studentized_residual": 0.9130223597285452
    },
    {
      "cooks_distance": 0.01017181629243318,
      "fitted": 1252.516516618133,
      "leverage": 0.010205685205010445,
      "residual": 135.483483381867,
      "row": 131,
      "standardized_residual": 1.9763011368320487,
      "studentized_residual": 1.986463744243324
    },
    {
      "cooks_distance": 0.010621676403193125,
      "fitted": 1258.9153703028808,
      "leverage": 0.045692899637034885,
      "residual": 63.08462969711921,
      "row": 132,
      "standardized_residual": 0.9202171532277846,
      "studentized_residual": 0.9419899011836316
    },
    {
      "cooks_distance": 0.02011174912526554,
      "fitted": 1229.3360494227543,
      "leverage": 0.03677582892051399,
      "residual": 97.6639505772456,
      "row": 133,
      "standardized_residual": 1.424626616731588,
      "studentized_residual": 1.4515679414414817
    },
    {
      "cooks_distance": 0.012146416934500477,
      "fitted": 1239.9162932379788,
      "leverage": 0.013543859171007196,
      "residual": 128.08370676202114,
      "row": 134,
      "standardized_residual": 1.8683604005809327,
      "studentized_residual": 1.881142795418618
    },
    {
      "cooks_distance": 0.004939520873654377,
      "fitted": 1230.8964093609957,
      "leverage": 0.019812447600719138,
      "residual": 67.10359063900435,
      "row": 135,
      "standardized_residual": 0.9788418422309776,
      "studentized_residual": 0.9886849749049611
    },
    {
      "cooks_distance": 0.008485641333712405,
      "fitted": 1243.8437036148682,
      "leverage": 0.009981421893296165,
      "residual": 125.15629638513185,
      "row": 136,
      "standardized_residual": 1.8256581883894016,
      "studentized_residual": 1.834838301078156
    },
    {
      "cooks_distance": 0.003586636752721687,
      "fitted": 1260.7219444897335,
      "leverage": 0.008318948540135098,
      "residual": 89.27805551026651,
      "row": 137,
      "standardized_residual": 1.3023013447461234,
      "studentized_residual": 1.307752266812081
    },
    {
      "cooks_distance": 0.0017368833152015264,
      "fitted": 1264.4611457367237,
      "leverage": 0.012962026601828318,
      "residual": 49.53885426327641,
      "row": 138,
      "standardized_residual": 0.7226245705679406,
      "studentized_residual": 0.7273539366349528
    },
    {
      "cooks_distance": 0.008196004791352374,
      "fitted": 1268.2765441314707,
      "leverage": 0.016272038221170203,
      "residual": 95.72345586852923,
      "row": 139,
      "standardized_residual": 1.3963205693586873,
      "studentized_residual": 1.4078216111307125
    },
    {
      "cooks_distance": 0.007274101961552702,
      "fitted": 1266.797342562079,
      "leverage": 0.025608291061316228,
      "residual": 71.20265743792098,
      "row": 140,
      "standardized_residual": 1.0386350374783746,
      "studentized_residual": 1.0521948677136526
    },
    {
      "cooks_distance": 0.006519103543024383,
      "fitted": 1262.1971218415417,
      "leverage": 0.01383845399644672,
      "residual": 92.80287815845824,
      "row": 141,
      "standardized_residual": 1.353718025457811,
      "studentized_residual": 1.3631830579065964
    },
    {
      "cooks_distance": 0.0011201206008808983,
      "fitted": 1246.8189194758017,
      "leverage": 0.011562565654390195,
      "residual": 42.18108052419823,
      "row": 142,
      "standardized_residual": 0.6152965314437311,
      "studentized_residual": 0.6188848827837499
    },
    {
      "cooks_distance": 0.004422128031266246,
      "fitted": 1242.518096802965,
      "leverage": 0.010632529102266024,
      "residual": 87.48190319703512,
      "row": 143,
      "standardized_residual": 1.276100823693992,
      "studentized_residual": 1.2829394961328473
    },
    {
      "cooks_distance": 0.0007995683061840569,
      "fitted": 1239.8191192490194,
      "leverage": 0.012544422302565816,
      "residual": 34.180880750980535,
      "row": 144,
      "standardized_residual": 0.49859740685649206,
      "studentized_residual": 0.5017544487683038
    },
    {
      "cooks_distance": 0.0030299136112444188,
      "fitted": 1234.2681549518163,
      "leverage": 0.021202220232177015,
      "residual": 50.7318450481838,
      "row": 145,
      "standardized_residual": 0.7400267585364718,
      "studentized_residual": 0.7479988597667078
    },
    {
      "cooks_distance": 0.0004964392042066611,
      "fitted": 1234.6853687388175,
      "leverage": 0.021645476788691505,
      "residual": 20.31463126118246,
      "row": 146,
      "standardized_residual": 0.29633006071035317,
      "studentized_residual": 0.2995901851602312
    },
    {
      "cooks_distance": 0.0005131674248638885,
      "fitted": 1237.1756906019143,
      "leverage": 0.01644164114937282,
      "residual": 23.824309398085763,
      "row": 147,
      "standardized_residual": 0.3475258280374052,
      "studentized_residual": 0.3504184949370439
    },
    {
      "cooks_distance": 0.0023780034871333173,
      "fitted": 1240.0144301927478,
      "leverage": 0.012124117440570747,
      "residual": 59.98556980725211,
      "row": 148,
      "standardized_residual": 0.875011085074132,
      "studentized_residual": 0.8803641792899883
    },
    {
      "cooks_distance": 0.0005807168762830609,
      "fitted": 1242.6403141574829,
      "leverage": 0.01157142757833949,
      "residual": 30.359685842517067,
      "row": 149,
      "standardized_residual": 0.4428575361862941,
      "studentized_residual": 0.4454422363999818
    },
    {
      "cooks_distance": 9.4275088770145e-05,
      "fitted": 1252.5865261205222,
      "leverage": 0.008388212790351512,
      "residual": 14.413473879477714,
      "row": 150,
      "standardized_residual": 0.21024972271655737,
      "studentized_residual": 0.21113711909431773
    },
    {
      "cooks_distance": 0.00014584305940913383,
      "fitted": 1666.863781179645,
      "leverage": 0.08668876053921025,
      "residual": 5.136218820355001,
      "row": 151,
      "standardized_residual": 0.07492215907289196,
      "studentized_residual": 0.07839725978353175
    },
    {
      "cooks_distance": 0.022134904557046895,
      "fitted": 1686.932367545173,
      "leverage": 0.0677376780903278,
      "residual": 73.06763245482684,
      "row": 152,
      "standardized_residual": 1.0658394771198172,
      "studentized_residual": 1.1038822133984456
    },
    {
      "cooks_distance": 0.027333132814997777,
      "fitted": 1701.5488943446849,
      "leverage": 0.08052000051676397,
      "residual": 73.45110565531513,
      "row": 153,
      "standardized_residual": 1.071433210785002,
      "studentized_residual": 1.1173621619508582
    },
    {
      "cooks_distance": 0.020898106732030578,
      "fitted": 1744.1981660093338,
      "leverage": 0.11832825628295707,
      "residual": 50.80183399066617,
      "row": 154,
      "standardized_residual": 0.7410476890819592,
      "studentized_residual": 0.7892102117338378
    },
    {
      "cooks_distance": 0.010331071169549498,
      "fitted": 1687.3492397507384,
      "leverage": 0.0683756776059597,
      "residual": 49.65076024926156,
      "row": 155,
      "standardized_residual": 0.7242569461298931,
      "studentized_residual": 0.7503644665954962
    }
  ],
  "studentization": "internal",
  "vif": [
    {
      "predictor": "price",
      "vif": 1.0793450019089978
    },
    {
      "predictor": "marketing_lag2",
      "vif": 1.8526576539594635
    },
    {
      "predictor": "holiday",
      "vif": 1.779603376774197
    }
  ],
  "x": [
    "price",
    "marketing_lag2",
    "holiday"
  ],
  "y": "units_sold"
}

Reading the diagnostics

Multicollinearity (VIF): all 3 predictors have variance inflation factors under 2 (well below the usual concern threshold of 5-10) — price, marketing_lag2, and holiday are not dangerously entangled with each other, so their individual coefficient estimates are trustworthy on that front. Influence (Cook's distance): most rows have Cook's distance well under 0.1; one row (week 88, a non-holiday week) stands out at ≈0.068 — driven by a large residual (studentized residual ≈-4.91) on below-average leverage (≈0.011 vs. the ≈0.026 average for 3 predictors), not by an unusual combination of predictor values. With no single row extreme enough to be dictating the fit by itself, no single week is silently driving the whole regression. Residual autocorrelation (Durbin-Watson): this is the real finding. durbin_watson is the statistic to check here — a value near 2.0 means residuals are independent; values close to 0 mean strong positive autocorrelation (each week's error resembles the previous week's). The reported value is well below 1, deep in positive-autocorrelation territory. That matches the dataset's documented yearly seasonal wave and trend, which this model's 3 predictors don't account for at all — the regression is leaving a systematic, week-to-week-correlated pattern in its residuals.

Honesty

price (p≈0.039) and marketing_lag2 (p≈0.045) are real, checked p-values from a real fit on n=156 realistically simulated weeks, both barely under the conventional 0.05 threshold — but the Durbin-Watson result means those p-values should not be taken at face value. OLS's standard-error formula assumes independent residuals; strong positive autocorrelation like this typically makes reported standard errors too small, which can make an estimate look more statistically significant than it really is. A p-value that only just clears 0.05 is exactly the kind of result a modest amount of standard-error deflation could flip back to non-significant. So the honest conclusion here is not "lagging fixed it, marketing has a confirmed real effect" but "lagging changed the naive answer, but this model is still misspecified (it's missing a seasonal/trend component) and needs to be fixed — with something like decompose on the residuals or a time-series-aware model — before either lesson's p-values can be trusted." That a model can go from clearly non-significant to marginally significant just by adding a lag, while its diagnostics quietly disqualify that same p-value, is the point of this lesson: diagnostics are not optional after a regression, they're part of it. As with the rest of this chapter, sales.csv is a realistic simulated retail dataset (lmda's own case-study-4 worked example, seeded RNG), not an actual store's live data — the fits and diagnostics are real, the store is not.

Implementation notes

  • Both commands above are re-run against the committed CSV on every validate_source.py pass and must byte-for-byte match the checked-in outputs/regress-sales-lagged.json and outputs/regdiag-sales-lagged.json.
  • regdiag reports one row per observation (fitted value, residual, leverage, standardized/studentized residual, Cook's distance) plus the aggregate fields (r_squared, durbin_watson, vif) read above — shown in full, not excerpted, so nothing is cherry-picked out of the real output.
  • Cross-reference: corr-regress-marketing-sales (this chapter) for the naive unlagged model this corrects; residuals-and-sse (ch08) for the residual concept this diagnostic extends to a real multi-predictor fit.