<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>time series &#8211; paologironi blog</title>
	<atom:link href="https://www.gironi.it/blog/en/tag/time-series/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.gironi.it/blog</link>
	<description>Scattered notes on (retro) computing, data analysis, statistics, SEO, and things that change</description>
	<lastBuildDate>Mon, 12 Oct 2026 09:01:21 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Multicollinearity, Heteroscedasticity, Autocorrelation: Three Difficult-Sounding Concepts Explained Simply (with an Example in R)</title>
		<link>https://www.gironi.it/blog/en/multicollinearity-heteroscedasticity-autocorrelation-three-difficult-sounding-concepts-explained-simply/</link>
					<comments>https://www.gironi.it/blog/en/multicollinearity-heteroscedasticity-autocorrelation-three-difficult-sounding-concepts-explained-simply/#respond</comments>
		
		<dc:creator><![CDATA[paolo]]></dc:creator>
		<pubDate>Sun, 17 Oct 2021 13:41:00 +0000</pubDate>
				<category><![CDATA[statistics]]></category>
		<category><![CDATA[autocorrelation]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[eteroschedasticità]]></category>
		<category><![CDATA[Heteroscedasticity]]></category>
		<category><![CDATA[omoschedasticità]]></category>
		<category><![CDATA[regressione]]></category>
		<category><![CDATA[time series]]></category>
		<guid isPermaLink="false">https://www.gironi.it/blog/?p=3299</guid>

					<description><![CDATA[In the posts on multiple regression, analysis of variance and time series we came across three terms that seem made on purpose to scare the reader. Multicollinearity, heteroscedasticity, autocorrelation: if we want to convince someone that statistics is a dark and inaccessible subject, these are the magic words to say. 🙂 Surprise: behind the names &#8230; <a href="https://www.gironi.it/blog/en/multicollinearity-heteroscedasticity-autocorrelation-three-difficult-sounding-concepts-explained-simply/" class="more-link">Continue reading<span class="screen-reader-text"> "Multicollinearity, Heteroscedasticity, Autocorrelation: Three Difficult-Sounding Concepts Explained Simply (with an Example in R)"</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In the posts on <a href="https://www.gironi.it/blog/en/multiple-regression-analysis-explained-simply/">multiple regression</a>, <a href="https://www.gironi.it/blog/en/analysis-of-variance-anova-explained-simply/">analysis of variance</a> and <a href="https://www.gironi.it/blog/en/time-series-analysis-and-forecasting-in-r/">time series</a> we came across three terms that seem made on purpose to scare the reader. Multicollinearity, heteroscedasticity, autocorrelation: if we want to convince someone that statistics is a dark and inaccessible subject, these are the magic words to say. 🙂</p>



<p class="wp-block-paragraph">Surprise: behind the names there are three simple ideas, and above all three very concrete problems. To see them at work, let&#8217;s take the model that sooner or later anyone working in digital marketing builds: how many conversions does each euro spent on Google Ads and on Meta bring us? We&#8217;ll watch it fall into all three traps, one after the other, and learn how to recognise them and get out.</p>



<span id="more-3299"></span>



<p class="wp-block-paragraph"><strong>In short:</strong> these are three different problems of regression. <strong>Multicollinearity</strong> concerns the <em>predictors</em>: two or more explanatory variables are strongly correlated with each other, and the model can&#8217;t separate their effects (unstable coefficients, sometimes with the wrong sign). <strong>Heteroscedasticity</strong> concerns the <em>errors</em>: their spread is not constant, but grows or shrinks with the predicted values. <strong>Autocorrelation</strong> also concerns the <em>errors</em>, ordered in time: today&#8217;s error is linked to yesterday&#8217;s. In the last two cases the coefficients remain correct on average, but <strong>standard errors, p-values and confidence intervals become unreliable</strong>. In R they are diagnosed with the VIF, the Breusch-Pagan test and the Durbin-Watson test.</p>



<p class="wp-block-paragraph"><strong>What we&#8217;ll cover</strong>:</p>



<ul class="wp-block-list"><li><a href="#the-model">The model: how much is each advertising euro worth?</a></li><li><a href="#multicollinearity">What is multicollinearity?</a></li><li><a href="#heteroscedasticity">What is heteroscedasticity?</a></li><li><a href="#autocorrelation">What is autocorrelation?</a></li><li><a href="#differences">Multicollinearity vs heteroscedasticity vs autocorrelation: what&#8217;s the difference?</a></li><li><a href="#faq">Frequently asked questions</a></li><li><a href="#try-it-yourself">Try it yourself</a></li><li><a href="#further-reading">Further reading</a></li></ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="the-model">The model: how much is each advertising euro worth?</h2>



<p class="wp-block-paragraph">Let&#8217;s imagine an e-commerce site that for two years has been investing every week in Google Ads and Meta. The business is growing, spend follows the seasons, and in the spreadsheet we have 104 rows: for each week the two budgets and the conversions obtained. The data are simulated, so we know the truth: both channels work, Google a little more than Meta.</p>



<p class="wp-block-paragraph">Let&#8217;s generate the data in R:</p>



<pre class="wp-block-code"><code>library(lmtest)     # Breusch-Pagan and Durbin-Watson tests
library(sandwich)   # robust standard errors

simulate &lt;- function() {
  week &lt;- 1:104
  growth &lt;- seq(5000, 15000, length.out = 104)            # the business grows
  season &lt;- 1 + 0.35 * sin(2 * pi * week / 52)            # high and low season
  google &lt;- round(growth * season * exp(rnorm(104, 0, 0.10)))
  meta &lt;- round(0.45 * google * exp(rnorm(104, 0, 0.08)))  # follows Google
  error &lt;- as.numeric(arima.sim(list(ar = 0.6), 104, sd = 0.12))
  conversions &lt;- round(exp(0.6 + 0.40 * log(google) + 0.20 * log(meta) + error))
  data.frame(week, google, meta, conversions)
}

set.seed(114)
data &lt;- simulate()</code></pre>



<p class="wp-block-paragraph">The three traps are already written into these lines, even if we can&#8217;t see them yet: Meta&#8217;s budget is set as a share of Google&#8217;s, the error is multiplicative (it grows with the size of the week) and it follows a pattern that drags on from one week to the next. Now let&#8217;s do what anyone would do, a regression of conversions on the two kinds of spend:</p>



<pre class="wp-block-code"><code>model &lt;- lm(conversions ~ google + meta, data = data)
summary(model)
# Coefficients:
#               Estimate Std. Error t value Pr(&gt;|t|)
# (Intercept) 179.480922  19.529960   9.190 5.45e-15 ***
# google        0.030642   0.008473   3.616 0.000468 ***
# meta         -0.024130   0.018618  -1.296 0.197920
#
# Multiple R-squared:  0.5323,	Adjusted R-squared:  0.5231
# F-statistic: 57.48 on 2 and 101 DF,  p-value: &lt; 2.2e-16</code></pre>



<p class="wp-block-paragraph">Let&#8217;s read it the way a marketing manager would: every €1,000 on Google brings about 31 conversions. And every €1,000 on Meta <em>takes away</em> 24. Obvious conclusion: switch Meta off.</p>



<p class="wp-block-paragraph">It would be a costly mistake, because in the data Meta works. The model as a whole explains half of the variability in conversions (R² 0.53, F test with a tiny p-value), but the split between the two channels is an illusion. Welcome to multicollinearity.</p>



<h2 class="wp-block-heading" id="multicollinearity">What is multicollinearity?</h2>



<div class="wp-block-group has-background" style="background-color:#f5f7f9;margin-top:2.5rem;margin-bottom:2.5rem;padding-top:1.5rem;padding-right:1.5rem;padding-bottom:1.5rem;padding-left:1.5rem"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<p>We speak of <strong>multicollinearity</strong> when <strong>two or more explanatory variables in a regression model are strongly correlated with each other</strong>. The model knows that <em>together</em> they matter, but it can&#8217;t establish <em>how much</em> each one does.</p>
</div></div>



<p class="wp-block-paragraph">The reason is intuitive. To estimate the effect of Meta &#8220;holding Google fixed&#8221;, the regression needs weeks in which Meta varies and Google doesn&#8217;t. But in our data, when Google goes up Meta goes up too: the correlation between the two kinds of spend is 0.975. The weeks that help tell the two effects apart are very few, and the estimate rests on those few random wobbles.</p>



<p class="wp-block-paragraph">The standard tool to measure the problem is the <strong>VIF</strong>, the <em>variance inflation factor</em>. It&#8217;s computed with an auxiliary regression: we explain one predictor with all the others and see how well we manage. If the R² of this regression is high, the predictor is almost a copy of the others:</p>



<p class="wp-block-paragraph">\(VIF = \frac{1}{1 &#8211; R^2_{\text{auxiliary}}}\)</p>



<p class="wp-block-paragraph">The name says exactly what it measures: how many times the variance of the coefficient is inflated compared with the case of independent predictors. Let&#8217;s compute it:</p>



<pre class="wp-block-code"><code>r2_aux &lt;- summary(lm(google ~ meta, data = data))$r.squared
r2_aux
# [1] 0.9511464
1 / (1 - r2_aux)
# [1] 20.46933</code></pre>



<p class="wp-block-paragraph">The car package computes it directly with <code>vif(model)</code>. The most widespread rule of thumb considers a VIF above 5 worrying and above 10 serious. Ours is <strong>20.5</strong>: the variance of the estimates is twenty times what we&#8217;d have with two independent channels, and the standard error (its square root) more than four times.</p>



<p class="wp-block-paragraph">What does that mean in practice? We see it by repeating the same experiment 500 times: same rules, same true effects, just a different random draw.</p>



<pre class="wp-block-code"><code>set.seed(2026)
estimates &lt;- t(replicate(500, {
  d &lt;- simulate()
  1000 * c(coef(lm(conversions ~ google + meta, data = d))[2:3],
           total = coef(lm(conversions ~ I(google + meta), data = d))[[2]])
}))
mean(estimates[, "meta"] &lt; 0)
# [1] 0.146
cor(estimates[, "google"], estimates[, "meta"])
# [1] -0.9068232</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" src="https://www.gironi.it/blog/wp-content/uploads/2026/10/diagnostica-multicollinearita-en.png" alt="On the left, weekly spend on Google Ads and Meta: the points lie almost on a line, correlation 0.98. On the right, the estimates of the two effects in 500 repetitions of the same experiment: they line up along a descending diagonal, because when one estimate goes up the other goes down. In about one case in seven Meta's effect comes out negative; the red dot is our data."/><figcaption class="wp-element-caption">On the left, weekly spend on Google Ads and Meta: the points lie almost on a line, correlation 0.98. On the right, the estimates of the two effects in 500 repetitions of the same experiment: they line up along a descending diagonal, because when one estimate goes up the other goes down. In about one case in seven Meta&#8217;s effect comes out negative; the red dot is our data.</figcaption></figure>



<p class="wp-block-paragraph"><strong>The two estimates compete for the same effect</strong>: when one goes up, the other goes down (correlation −0.91 between the estimates). In one case in seven Meta even comes out negative, and our dataset is one of those. And yet the sum of the two effects is stable: total spend has a standard deviation of 2.5 conversions per €1,000, against 8.7 for Google and 17.7 for Meta.</p>



<p class="wp-block-paragraph">Here is the hallmark of multicollinearity: <strong>the model as a whole works, the predictions are good, but the individual coefficients are not credible</strong>. It often shows up exactly like this: a fair or high R², a significant F test, and coefficients with huge standard errors or signs that defy common sense.</p>



<h3 class="wp-block-heading">How do we avoid it in a marketing regression model?</h3>



<p class="wp-block-paragraph">There&#8217;s no test that &#8220;cures&#8221; multicollinearity, because it isn&#8217;t a flaw in the calculation: it&#8217;s a lack of information in the data. There are four routes.</p>



<ul class="wp-block-list"><li><strong>Ask a less ambitious question.</strong> If the two budgets move together, let&#8217;s ask how much total spend is worth. With <code>lm(conversions ~ I(google + meta))</code> we get 13.6 conversions per €1,000, with a standard error of 1.3: a solid estimate.</li><li><strong>Get the missing information.</strong> To separate the channels we need weeks in which they move independently: an experiment where Meta is switched off in some areas or some weeks, the same principle as the control group we use in <a href="https://www.gironi.it/blog/en/seo-split-testing/">SEO split tests</a>. More data of the same kind, on the other hand, helps little: if the budgets keep moving together, the problem stays.</li><li><strong>Drop one of the two variables</strong>, but carefully: Google would also take credit for Meta, and the estimate would become biased. It&#8217;s the same confounding mechanism we saw in multiple regression.</li><li><strong>Use methods that accept some bias in exchange for stability</strong>, such as <em>ridge</em> regression, which shrinks the coefficients towards zero. They are the bread and butter of machine learning, but they make interpretation less immediate.</li></ul>



<p class="wp-block-paragraph">From here on we follow the first route and work with total spend:</p>



<pre class="wp-block-code"><code>data$spend &lt;- data$google + data$meta
model_tot &lt;- lm(conversions ~ spend, data = data)</code></pre>



<h2 class="wp-block-heading" id="heteroscedasticity">What is heteroscedasticity?</h2>



<p class="wp-block-paragraph">Well, this term seems made on purpose to scare. But the concept, it turns out, isn&#8217;t that complicated.</p>



<div class="wp-block-group has-background" style="background-color:#f5f7f9;margin-top:2.5rem;margin-bottom:2.5rem;padding-top:1.5rem;padding-right:1.5rem;padding-bottom:1.5rem;padding-left:1.5rem"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<p><strong>Heteroscedasticity</strong> basically means <strong>unequal spread</strong>: it happens when <strong>the variance of the errors of a regression model is not constant, but changes with the predicted values or with an explanatory variable</strong>. The opposite case, the one ordinary least squares assumes, is called <strong>homoscedasticity</strong>: errors with the same spread at every level.</p>
</div></div>



<p class="wp-block-paragraph">In marketing, heteroscedasticity is almost the rule. A 300-conversion week can be off by 30 either way; a 600-conversion week, other things equal, is off by 60. Errors grow with size, because effects are proportional rather than additive. The simplest way to notice it is to look at the residuals against the predicted values: if they fan out, the variance isn&#8217;t constant.</p>



<p class="wp-block-paragraph">For a formal check we use the <strong>Breusch-Pagan test</strong>, which checks whether the squared residuals can be explained by the predictors. The null hypothesis is homoscedasticity:</p>



<pre class="wp-block-code"><code>bptest(model_tot)
# BP = 9.3544, df = 1, p-value = 0.002224</code></pre>



<p class="wp-block-paragraph">With a p-value of 0.002, the constant-variance hypothesis doesn&#8217;t hold.</p>



<p class="wp-block-paragraph"><strong>What happens if we ignore it?</strong> Here there&#8217;s good news that textbooks often leave in the shade: <strong>the coefficients remain correct on average</strong>. What breaks is the estimate of their precision: standard errors computed with the classical formula are wrong, and so are p-values and confidence intervals. In our case the <em>robust</em> standard errors, which don&#8217;t assume constant variance, are 20% larger (from 0.00131 to 0.00157):</p>



<pre class="wp-block-code"><code>coeftest(model_tot, vcov = vcovHC(model_tot, type = "HC3"))
#               Estimate Std. Error t value  Pr(&gt;|t|)
# (Intercept) 1.7769e+02 2.0789e+01  8.5472 1.310e-13 ***
# spend       1.3622e-02 1.5723e-03  8.6638 7.273e-14 ***</code></pre>



<p class="wp-block-paragraph"><strong>How do we fix it?</strong> There are three routes, often combined:</p>



<ul class="wp-block-list"><li>use <strong>robust standard errors</strong>, as we just did: the simplest solution, which doesn&#8217;t change the estimates but only their uncertainty;</li><li><strong>transform the variables</strong>, typically with logarithms, when effects are proportional;</li><li>use <strong>weighted least squares</strong>, which give less weight to the noisier observations.</li></ul>



<p class="wp-block-paragraph">In our case the second route is also the most natural, because the error is multiplicative by construction. Let&#8217;s move to logarithms:</p>



<pre class="wp-block-code"><code>model_log &lt;- lm(log(conversions) ~ log(spend), data = data)
coef(summary(model_log))
#              Estimate Std. Error    t value     Pr(&gt;|t|)
# (Intercept) 0.2257489 0.45602741  0.4950336 6.216411e-01
# log(spend)  0.5953304 0.04792515 12.4220879 3.942384e-22
bptest(model_log)
# BP = 1.1777, df = 1, p-value = 0.2778</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" src="https://www.gironi.it/blog/wp-content/uploads/2026/10/diagnostica-eteroschedasticita-en.png" alt="Residuals against predicted values, for the linear model (left) and the model on logarithms (right). In the first the cloud widens towards the bigger weeks; in the second the spread is uniform. The Breusch-Pagan test goes from p = 0.002 to p = 0.28."/><figcaption class="wp-element-caption">Residuals against predicted values, for the linear model (left) and the model on logarithms (right). In the first the cloud widens towards the bigger weeks; in the second the spread is uniform. The Breusch-Pagan test goes from p = 0.002 to p = 0.28.</figcaption></figure>



<p class="wp-block-paragraph">The fan closes, and the test finds nothing anymore. On top of that, the coefficient has gained a very handy interpretation: in a model with logarithms on both sides it&#8217;s an <strong>elasticity</strong>. The value of 0.595 says that <strong>10% more spend brings about 5.8% more conversions</strong> (1.1 raised to 0.595 is 1.058). In the simulation the true value is 0.6: the model got very close.</p>



<h2 class="wp-block-heading" id="autocorrelation">What is autocorrelation?</h2>



<p class="wp-block-paragraph">The last trap remains, the sneakiest one when data are ordered in time.</p>



<div class="wp-block-group has-background" style="background-color:#f5f7f9;margin-top:2.5rem;margin-bottom:2.5rem;padding-top:1.5rem;padding-right:1.5rem;padding-bottom:1.5rem;padding-left:1.5rem"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<p>We have <strong>autocorrelation</strong> (or <em>serial correlation</em>) when <strong>the errors of a regression model are correlated with each other over time</strong>: the error of one period says something about the error of the next one. In the most common case, first-order positive autocorrelation, a week that went better than expected tends to be followed by another week that went better than expected.</p>
</div></div>



<p class="wp-block-paragraph">In marketing it happens all the time: a competitor&#8217;s campaign, a period of favourable prices, a Google algorithm update, a good review going round. They&#8217;re all things the model doesn&#8217;t see and that last more than a week. The errors, then, don&#8217;t jump randomly above and below zero: they stay on the same side for weeks on end. The plot of residuals in time order shows it at a glance:</p>



<figure class="wp-block-image size-large"><img decoding="async" src="https://www.gironi.it/blog/wp-content/uploads/2026/10/diagnostica-autocorrelazione-en.png" alt="The residuals of the model on logarithms, week by week. Instead of alternating randomly above and below zero, they form long runs of the same sign: the lag-1 autocorrelation is 0.59 and the Durbin-Watson statistic 0.81."/><figcaption class="wp-element-caption">The residuals of the model on logarithms, week by week. Instead of alternating randomly above and below zero, they form long runs of the same sign: the lag-1 autocorrelation is 0.59 and the Durbin-Watson statistic 0.81.</figcaption></figure>



<p class="wp-block-paragraph">The classical test is <strong>Durbin-Watson</strong>. Its statistic d is about 2 with no autocorrelation, drops towards 0 with positive autocorrelation and rises towards 4 with negative autocorrelation. In R we no longer need the tables: the test returns the p-value directly.</p>



<pre class="wp-block-code"><code>dwtest(model_log)
# DW = 0.81187, p-value = 2.573e-10
acf(resid(model_log), plot = FALSE)$acf[2]
# [1] 0.5881333</code></pre>



<p class="wp-block-paragraph">A statistic of 0.81 and a residual autocorrelation of 0.59 between one week and the next: the problem is there, and it&#8217;s strong. For longer series or higher-order autocorrelation (between an error and the one two or more periods earlier) we also use the <code>acf()</code> function and the Ljung-Box test, which we met when talking about time series.</p>



<p class="wp-block-paragraph"><strong>What happens if we ignore it?</strong> As with heteroscedasticity, the estimates remain correct on average, but the classical standard-error formula assumes that each week brings independent information. With positive autocorrelation that isn&#8217;t so: 104 weeks that resemble each other in groups are worth less than 104 independent observations. <strong>The model believes it&#8217;s more precise than it is.</strong> Newey-West standard errors, which account for both autocorrelation and heteroscedasticity, show it right away:</p>



<pre class="wp-block-code"><code>coeftest(model_log, vcov = NeweyWest(model_log))
#             Estimate Std. Error t value  Pr(&gt;|t|)
# (Intercept)  0.22575    1.00072  0.2256     0.822
# log(spend)   0.59533    0.10624  5.6039 1.791e-07 ***</code></pre>



<p class="wp-block-paragraph">The standard error of the elasticity goes from 0.048 to 0.106, more than double. The 95% confidence interval, which with the classical formula ran from 0.50 to 0.69, widens to 0.38 to 0.81. The effect of advertising remains clearly positive, but our uncertainty about <em>how much</em> it&#8217;s worth is more than double what we thought. With a smaller effect, the difference between the two formulas would be the one between a &#8220;significant&#8221; result and one that isn&#8217;t.</p>



<p class="wp-block-paragraph"><strong>How do we fix it?</strong></p>



<ul class="wp-block-list"><li>use <strong>Newey-West standard errors</strong>, as above, if what matters is mainly the estimates and their uncertainty;</li><li><strong>model what&#8217;s missing</strong>: autocorrelation often comes from an omitted variable that moves slowly (seasonality, trend, promotions), and adding it to the model reduces it;</li><li>use models that explicitly estimate the correlation between errors, such as generalised least squares (in R <code>gls()</code> from the nlme package, with <code>correlation = corAR1()</code>). They are the modern descendants of Durbin&#8217;s two-step method and of the Cochrane-Orcutt procedure.</li></ul>



<h2 class="wp-block-heading" id="differences">Multicollinearity vs heteroscedasticity vs autocorrelation: what&#8217;s the difference?</h2>



<p class="wp-block-paragraph">At this point we can put the three concepts side by side. The most important distinction is where the problem lies: multicollinearity concerns the explanatory variables, the other two concern the errors.</p>



<figure class="wp-block-table"><table><thead><tr><th></th><th>Multicollinearity</th><th>Heteroscedasticity</th><th>Autocorrelation</th></tr></thead><tbody><tr><td>Where the problem lies</td><td>in the predictors, correlated with each other</td><td>in the errors, with non-constant variance</td><td>in the errors, correlated over time</td></tr><tr><td>Coefficients</td><td>correct on average, but very unstable</td><td>correct on average</td><td>correct on average</td></tr><tr><td>Standard errors</td><td>large (inflated)</td><td>wrong</td><td>usually too small</td></tr><tr><td>How to spot it</td><td>VIF above 5-10</td><td>fan-shaped residuals, Breusch-Pagan test</td><td>residuals in runs, Durbin-Watson test</td></tr><tr><td>Typical remedies</td><td>aggregate spend, experiments, ridge</td><td>logarithms, robust standard errors</td><td>Newey-West, omitted variables, <code>gls()</code></td></tr></tbody></table></figure>



<p class="wp-block-paragraph">There&#8217;s a subtle but important difference between the first and the other two. With multicollinearity the standard errors are large <em>and they know it</em>: the model warns us, in its own way, that it can&#8217;t separate the effects. With heteroscedasticity and autocorrelation, instead, classical standard errors are wrong <em>silently</em>, and often in the worst direction: they make us look more confident than we are. That&#8217;s why diagnostic tests aren&#8217;t an appendix for nitpickers, but a check to run every time a regression has to guide a decision, from an advertising ROI model to a forecast of organic traffic.</p>



<h2 class="wp-block-heading" id="faq">Frequently asked questions</h2>



<h3 class="wp-block-heading">What is the difference between multicollinearity and autocorrelation?</h3>



<p class="wp-block-paragraph">Multicollinearity concerns the explanatory variables, correlated with each other; autocorrelation concerns the model&#8217;s errors, correlated over time. The first makes the coefficients unstable and is measured with the VIF; the second makes the standard errors too optimistic and is checked with the Durbin-Watson test.</p>



<h3 class="wp-block-heading">What is the difference between heteroscedasticity and multicollinearity?</h3>



<p class="wp-block-paragraph">Heteroscedasticity concerns the errors, whose variance is not constant; multicollinearity concerns the predictors, which are strongly correlated. With heteroscedasticity the coefficients are fine but the classical standard errors are wrong; with multicollinearity the standard errors are honestly large because the data can&#8217;t separate the effects.</p>



<h3 class="wp-block-heading">What is the difference between heteroscedasticity and autocorrelation?</h3>



<p class="wp-block-paragraph">Both concern the model&#8217;s errors and leave the coefficients correct on average. Heteroscedasticity is about their spread, which changes from one observation to another; autocorrelation is about their link over time. They can occur together, and Newey-West standard errors account for both.</p>



<h3 class="wp-block-heading">How do we avoid these problems in a marketing or advertising ROI regression model?</h3>



<p class="wp-block-paragraph">For multicollinearity, avoid moving all channels together, or use experiments that vary one channel at a time; otherwise model total spend. For heteroscedasticity, use logarithms when effects are proportional, or robust standard errors. For autocorrelation in weekly data, add seasonality and trend to the model and use Newey-West standard errors.</p>



<h3 class="wp-block-heading">What VIF value indicates multicollinearity?</h3>



<p class="wp-block-paragraph">There is no universal threshold. The most widespread rule of thumb considers a VIF above 5 worth watching and above 10 serious. A VIF of 10 means the variance of the coefficient is ten times what it would be with independent predictors.</p>



<h3 class="wp-block-heading">What should the Durbin-Watson statistic be?</h3>



<p class="wp-block-paragraph">About 2 with no autocorrelation. Values close to 0 indicate positive autocorrelation, values close to 4 negative autocorrelation. In R, <code>dwtest()</code> from the lmtest package also returns the p-value, with no need for tables.</p>



<script type="application/ld+json">{"@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{"@type": "Question", "name": "What is the difference between multicollinearity and autocorrelation?", "acceptedAnswer": {"@type": "Answer", "text": "Multicollinearity concerns the explanatory variables, correlated with each other; autocorrelation concerns the model's errors, correlated over time. The first makes the coefficients unstable and is measured with the VIF; the second makes the standard errors too optimistic and is checked with the Durbin-Watson test."}}, {"@type": "Question", "name": "What is the difference between heteroscedasticity and multicollinearity?", "acceptedAnswer": {"@type": "Answer", "text": "Heteroscedasticity concerns the errors, whose variance is not constant; multicollinearity concerns the predictors, which are strongly correlated. With heteroscedasticity the coefficients are fine but the classical standard errors are wrong; with multicollinearity the standard errors are honestly large because the data can't separate the effects."}}, {"@type": "Question", "name": "What is the difference between heteroscedasticity and autocorrelation?", "acceptedAnswer": {"@type": "Answer", "text": "Both concern the model's errors and leave the coefficients correct on average. Heteroscedasticity is about their spread, which changes from one observation to another; autocorrelation is about their link over time. They can occur together, and Newey-West standard errors account for both."}}, {"@type": "Question", "name": "How do we avoid these problems in a marketing or advertising ROI regression model?", "acceptedAnswer": {"@type": "Answer", "text": "For multicollinearity, avoid moving all channels together, or use experiments that vary one channel at a time; otherwise model total spend. For heteroscedasticity, use logarithms when effects are proportional, or robust standard errors. For autocorrelation in weekly data, add seasonality and trend to the model and use Newey-West standard errors."}}, {"@type": "Question", "name": "What VIF value indicates multicollinearity?", "acceptedAnswer": {"@type": "Answer", "text": "There is no universal threshold. The most widespread rule of thumb considers a VIF above 5 worth watching and above 10 serious. A VIF of 10 means the variance of the coefficient is ten times what it would be with independent predictors."}}, {"@type": "Question", "name": "What should the Durbin-Watson statistic be?", "acceptedAnswer": {"@type": "Answer", "text": "About 2 with no autocorrelation. Values close to 0 indicate positive autocorrelation, values close to 4 negative autocorrelation. In R, dwtest() from the lmtest package also returns the p-value, with no need for tables."}}]}</script>



<h2 class="wp-block-heading" id="try-it-yourself">Try it yourself</h2>



<p class="wp-block-paragraph">The article&#8217;s code lends itself to a few experiments.</p>



<ul class="wp-block-list"><li>In the <code>simulate()</code> function, raise the standard deviation of Meta&#8217;s noise from 0.08 to 0.40, so the two budgets move more independently. What happens to the VIF? And to the share of negative Meta estimates in the 500 repetitions?</li><li>Set <code>ar = 0</code> in <code>arima.sim()</code>: does the Durbin-Watson statistic go back close to 2? And do the Newey-West standard errors get close to the classical ones?</li><li>Fit the log model with both channels, <code>lm(log(conversions) ~ log(google) + log(meta))</code>: does multicollinearity disappear with logarithms?</li></ul>



<p class="wp-block-paragraph">The last exercise has an instructive answer: transformations cure heteroscedasticity, but not multicollinearity. If the two budgets move together, so do their logarithms.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">With this we have the tools to trust (or not trust) a regression. It&#8217;s time to put them to work on a very concrete SEO problem: building a model of the CTR we expect at each position, and using it to find the pages that perform worse than they should. That&#8217;s the topic of <a href="https://www.gironi.it/blog/en/expected-vs-actual-ctr/">expected vs actual CTR</a>, the next stop on our journey.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading" id="further-reading">Further reading</h3>



<p class="wp-block-paragraph">The three problems we discussed are covered in depth in <a href="https://www.amazon.it/dp/8891906190?tag=consulenzeinf-21&amp;ascsubtag=multicollinearity-heteroscedasticity-autocorrelation" rel="nofollow sponsored noopener" target="_blank"><em>Introduzione all&#8217;econometria</em></a> by Stock and Watson (Italian edition), the book I recommend: it devotes very clear pages to heteroscedasticity-robust standard errors and to Newey-West errors for time series, always starting from concrete economic examples.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gironi.it/blog/en/multicollinearity-heteroscedasticity-autocorrelation-three-difficult-sounding-concepts-explained-simply/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
