{"id":67001,"date":"2026-10-13T11:21:42","date_gmt":"2026-10-13T08:21:42","guid":{"rendered":"https:\/\/wpcalc.com\/en\/?p=67001"},"modified":"2026-10-13T11:21:42","modified_gmt":"2026-10-13T08:21:42","slug":"autocorrelation-calculator","status":"publish","type":"post","link":"https:\/\/wpcalc.com\/en\/statistics\/autocorrelation-calculator\/","title":{"rendered":"Autocorrelation Calculator"},"content":{"rendered":"<section class=\"not-prose calculator-box\" aria-labelledby=\"calculator-title\"><div class=\"flex items-baseline sm:items-center justify-between gap-2 sm:gap-3\"><div class=\"flex flex-col sm:flex-row sm:items-center gap-2\"><span class=\"icon icon-calculator text-primary-700! text-base! dark:text-primary-300!\" aria-hidden=\"true\"><\/span><h2 id=\"calculator-title\" class=\"text-lg font-display font-bold\">Test Whether a Series Is Correlated with Its Own Past<\/h2><\/div><div class=\"calcdash-favorite group\">\n  <button type=\"button\" class=\"favorite\" id=\"favorite\" data-favorite-id=\"67001\" data-favorite-title=\"Autocorrelation\" data-favorite-url=\"https:\/\/wpcalc.com\/en\/statistics\/autocorrelation-calculator\/\" data-favorite-excerpt=\"Compute sample autocorrelation coefficients r_k for any time series at one or more lags. Paste your ordered observations, choose the lags and the estimator, and get r_k with a white-noise significance band.\" aria-label=\"Add to Favorites\" data-favorite-icon=\"icon icon-wpcalc-regression-plot\">\n    <span class=\"icon icon-shape-star-empty\" aria-hidden=\"true\"><\/span>\n  <\/button>\n  <div class=\"calcdash-favorite__tip\" aria-hidden=\"true\">\n   <span class=\"favorite-tooltip\" id=\"favorite-tooltip\"><\/span>\n  <\/div>\n  <span class=\"sr-only\" role=\"status\" id=\"favorite-status\"><\/span>\n<\/div><\/div><form action=\"https:\/\/wpcalc.com\/en\/statistics\/autocorrelation-calculator\/\" method=\"POST\" class=\"calculator\" id=\"calculator-67001\" data-post=\"67001\"><fieldset class=\"fieldset-input is-1\"><legend class=\"sr-only\">Input Fields<\/legend><div class=\"field\" id=\"input-1\"><label for=\"field-1\">Time-series values (in order)<\/label><textarea id=\"field-1\" name=\"timeseries_values_in_order\">2 4 3 5 7 6 8 10 9 11 13 12<\/textarea><\/div><div class=\"field has-term\" id=\"input-2\"><label for=\"field-2\">Lag(s) to compute<\/label><div class=\"term\">k<\/div>  <div class=\"absolute bottom-0 left-16 top-8 w-2 h-0.5 bg-blue-500\"><\/div><input type=\"text\" name=\"lags_to_compute\" id=\"field-2\" aria-describedby=\"calc-info-2\" placeholder=\"e.g. 1; 2; 3\" step=\"any\" value=\"1; 2; 3\"\/><small id=\"calc-info-2\">One or more lag lengths k (how many steps back to compare). Separate several lags with spaces or semicolons, e.g. 1; 2; 3; 4.<\/small><\/div><div class=\"field\" id=\"input-3\"><label for=\"field-3\">Estimator<\/label><div class=\"grid grid-cols-1\"><select id=\"field-3\" name=\"estimator\"><option value=\"acf\" selected>Standard ACF (divide by n)<\/option><option value=\"unbiased\">Unbiased (divide by n \u2212 k)<\/option><\/select><svg class=\"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-gray-500 sm:size-4\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" data-slot=\"icon\">\n              <path fill-rule=\"evenodd\" d=\"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z\" clip-rule=\"evenodd\" \/>\n            <\/svg><\/div><\/div><\/fieldset><div class=\"buttons\"><button type=\"submit\" data-text=\"Re-Calculate\" id=\"calculate-button\" data-post=\"67001\">Calculate<\/button><button type=\"reset\">Reset<\/button><\/div><div class=\"field is-checkbox hidden!\" id=\"field-auto-calc\"><input type=\"checkbox\" id=\"auto-calc\"><label for=\"auto-calc\">Calculate automatically<\/label><small>If enabled, the result will update automatically when you change any value.<\/small><\/div><div class=\"fieldset-result is-hidden\" aria-labelledby=\"result-title\" aria-live=\"polite\" role=\"region\"> <h3 class=\"result-title bg-gradient-to-r from-primary-50 to-gray-50 dark:from-primary-900 dark:to-gray-800\" id=\"result-title\"><span class=\"icon icon-s-pulse\" aria-hidden=\"true\"><\/span> Autocorrelation Results<\/h3><div class=\"result-box\"><div class=\"field-result is-column\" id=\"output-1\"><span class=\"field-title\"><span>Autocorrelation coefficient(s) by lag<\/span><span class=\"result-term\">r\u2096<\/span><\/span><span class=\"field-value\" id=\"result-1\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result is-column\" id=\"output-2\"><span class=\"field-title\"><span>How these autocorrelations were computed<\/span><\/span><span class=\"field-value\" id=\"result-2\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><\/div><div class=\"result-actions\"><button type=\"button\" class=\"copy-link\"><svg viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M12.232 4.232a2.5 2.5 0 0 1 3.536 3.536l-1.225 1.224a.75.75 0 0 0 1.061 1.06l1.224-1.224a4 4 0 0 0-5.656-5.656l-3 3a4 4 0 0 0 .225 5.865.75.75 0 0 0 .977-1.138 2.5 2.5 0 0 1-.142-3.667l3-3Z\"\/><path d=\"M11.603 7.963a.75.75 0 0 0-.977 1.138 2.5 2.5 0 0 1 .142 3.667l-3 3a2.5 2.5 0 0 1-3.536-3.536l1.225-1.224a.75.75 0 0 0-1.061-1.06l-1.224 1.224a4 4 0 1 0 5.656 5.656l3-3a4 4 0 0 0-.225-5.865Z\"\/><\/svg><span class=\"copy-link__text\">Copy link to this calculation<\/span><\/button><span class=\"sr-only\" role=\"status\" id=\"copy-link-status\"><\/span><\/div><\/div><a href=\"#respond\" class=\"hidden transition-opacity duration-300 opacity-0 w-50 text-sm justify-center items-center gap-2 px-4 py-2 rounded bg-gray-200 text-gray-700 hover:bg-gray-300\" id=\"leave-comment\"><span class=\"icon icon-comments\" aria-hidden=\"true\"><\/span>Leave a Comment<\/a><\/form><\/section><section id=\"calc-reactions\" class=\"not-prose hidden my-12 bg-gradient-to-r from-primary-50 to-gray-50 border border-indigo-100 rounded-xl px-6 py-4 shadow-sm\" data-post=\"67001\" aria-live=\"polite\" aria-labelledby=\"calc-reactions-title\"><p id=\"calc-reactions-title\" class=\"text-sm text-gray-500 text-center mb-2\">How did this result make you feel?<\/p><div role=\"group\" aria-labelledby=\"calc-reactions-title\" class=\"grid grid-cols-3 sm:flex sm:flex-row sm:justify-around gap-4 sm:items-center sm:flex-wrap\"><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"like\"><span class=\"reaction-count\" data-reaction-count=\"like\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude00 <\/span><span class=\"reaction-description font-medium\">Like <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"helpful\"><span class=\"reaction-count\" data-reaction-count=\"helpful\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\udca1 <\/span><span class=\"reaction-description font-medium\">Helpful <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"confused\"><span class=\"reaction-count\" data-reaction-count=\"confused\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude15 <\/span><span class=\"reaction-description font-medium\">Confused <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"disappointed\"><span class=\"reaction-count\" data-reaction-count=\"disappointed\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude1e <\/span><span class=\"reaction-description font-medium\">Disappointed <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"inaccurate\"><span class=\"reaction-count\" data-reaction-count=\"inaccurate\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\u274c <\/span><span class=\"reaction-description font-medium\">Inaccurate <\/span><\/button><\/div><div id=\"reaction-message\" class=\"hidden mt-8 rounded-md border border-primary-100 bg-white\/50 backdrop-blur-sm px-4 py-2 text-sm text-center shadow-sm\"><\/div><\/section><div class=\"calcdash-ad not-prose calcdash-ad--calc_result calcdash-ad--in-article\"><ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-1721569815777345\" data-ad-slot=\"6317458308\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\"><\/ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script><\/div>\n<style id=\"wpcoderpro-inline-1\">.formula-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section class=\"formula-box\" aria-labelledby=\"formula-title\">\r\n\t<div id=\"formula-title\" class=\"not-prose font-display mb-4\"><span class=\"icon icon-formula\" aria-hidden=\"true\"><\/span><h2>Autocorrelation Formula<\/h2><\/div>\r\n\t<figure class=\"not-prose formula\">\r\n\t\t<figcaption class=\"formula-title\">Formula<\/figcaption>\r\n\t\t<div class=\"text-base text-gray-800\" id=\"formula\">\n\\[ r_k = \\frac{c_k}{c_0}, \\qquad c_k = \\frac{1}{n}\\sum_{t=1}^{n-k} (x_t - \\bar{x})(x_{t+k} - \\bar{x}), \\qquad c_0 = \\frac{1}{n}\\sum_{t=1}^{n} (x_t - \\bar{x})^2 \\]\n<\/div>\r\n\t<\/figure>\r\n\t<\/p>\n<p><strong>Where:<\/strong><\/p>\n<ul>\n<li>\\(r_k\\) \u2014 sample autocorrelation at lag \\(k\\) (the correlation of the series with itself shifted \\(k\\) steps back)<\/li>\n<li>\\(x_t\\) \u2014 observation at time \\(t\\); \\(\\bar{x}\\) \u2014 mean of the series<\/li>\n<li>\\(n\\) \u2014 number of observations<\/li>\n<li>\\(c_k\\) \u2014 sample autocovariance at lag \\(k\\); \\(c_0\\) \u2014 sample variance<\/li>\n<\/ul>\n<p>The coefficient compares each observation with the one \\(k\\) steps earlier, after both are centered on the mean. Dividing by \\(c_0\\) forces every \\(r_k\\) into the range \\([-1, 1]\\). With the \"unbiased\" estimator, the sum defining \\(c_k\\) is divided by \\(n-k\\) instead of \\(n\\).<\/p>\n<p>\r\n<\/section>\n<style id=\"wpcoderpro-inline-459\">.calculation-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section id=\"calculation\" class=\"calculation-box\" aria-labelledby=\"calculation-title\">\r\n\t<div id=\"calculation-title\" class=\"not-prose font-display\"><span class=\"icon icon-unordered-list\" aria-hidden=\"true\"><\/span><h2>Autocorrelation \u2013 Calculation Example<\/h2><\/div>\r\n\r\n<\/p>\n<p><strong>Example:<\/strong> a series of 12 observations: 2, 4, 3, 5, 7, 6, 8, 10, 9, 11, 13, 12, with lags 1, 2, 3 and the standard ACF estimator.<\/p>\n<p>\\[ \\bar{x} = \\frac{90}{12} = 7.5, \\qquad c_0 = \\frac{143}{12} = 11.9167 \\]<\/p>\n<p>\\[ c_1 = \\frac{101.75}{12} = 8.4792 \\;\\Rightarrow\\; r_1 = \\frac{8.4792}{11.9167} = 0.7117 \\]<\/p>\n<p>\\[ c_2 = \\frac{69}{12} = 5.75 \\;\\Rightarrow\\; r_2 = 0.4825, \\qquad c_3 = \\frac{39.75}{12} = 3.3125 \\;\\Rightarrow\\; r_3 = 0.2780 \\]<\/p>\n<p><strong>Result:<\/strong> \\(r_1 = 0.7117\\), \\(r_2 = 0.4825\\), \\(r_3 = 0.2780\\). The 95% white-noise band is \\(\\pm 1.96\/\\sqrt{12} = \\pm 0.566\\), so only the lag-1 autocorrelation is significant: the series shows persistence \u2014 high values follow high values \u2014 and the autocorrelation decays smoothly, which is typical of a trending series.<\/p>\n<p>\n\r\n<\/section>\n<h2>How to use the calculator<\/h2>\n<ol>\n<li>Enter your observations in <strong>Time-series values (in order)<\/strong>, oldest first. Separate values with spaces, semicolons or line breaks; decimal commas are accepted. You need at least 3 values.<\/li>\n<li>Type the lag lengths in <strong>Lag(s) to compute<\/strong> \u2014 a single lag (e.g. 1) or several separated by spaces or semicolons (e.g. 1; 2; 3; 4). Each lag must be a whole number between 1 and \\(n-1\\).<\/li>\n<li>Choose the <strong>Estimator<\/strong>: \"Standard ACF (divide by n)\" matches what statistical software plots in ACF charts; \"Unbiased (divide by n \u2212 k)\" corrects the small-sample downward bias at longer lags.<\/li>\n<li>Read the results table: the number of overlapping pairs used at each lag, the coefficient \\(r_k\\), and whether it falls outside the \\(\\pm 1.96\/\\sqrt{n}\\) white-noise band.<\/li>\n<\/ol>\n<h2>What is autocorrelation?<\/h2>\n<p>Autocorrelation (serial correlation) measures how strongly a time series is linearly related to its own past. Instead of correlating two different variables, you correlate the series with a copy of itself shifted back by \\(k\\) time steps \u2014 the <em>lag<\/em>. The result, \\(r_k\\), is interpreted exactly like a Pearson correlation: \\(+1\\) means the shifted series moves in perfect lockstep with the original, \\(-1\\) means it moves perfectly oppositely, and values near 0 mean no linear relationship at that lag.<\/p>\n<p>Autocorrelation is one of the first diagnostic tools in time-series analysis. A lag-1 coefficient well above zero indicates <strong>persistence<\/strong> (values tend to stay above or below the mean for a while), while a strong negative one indicates <strong>alternation<\/strong> \u2014 the series overshoots the mean in both directions. Plotting \\(r_k\\) against \\(k\\) gives the autocorrelation function (ACF), the standard tool for identifying ARIMA models and for spotting seasonality.<\/p>\n<p>The pattern across lags matters more than any single value. <strong>Slowly decaying positive<\/strong> autocorrelations suggest a trend or non-stationarity \u2014 consider differencing the series first. A <strong>single spike at lag k<\/strong> points to a seasonal or cyclical pattern with period \\(k\\) (e.g. a spike at lag 12 in monthly data means an annual cycle). Coefficients that stay inside the white-noise band at all lags suggest the series has no linear memory, which is exactly what you want to see in model residuals.<\/p>\n<p>Note that autocorrelation captures only <em>linear<\/em> dependence. A series can be strongly predictable by nonlinear rules yet show near-zero autocorrelation, so a \"clean\" ACF is not proof of independence. For a formal check of whether a whole set of autocorrelations is consistent with white noise, use a portmanteau test such as Ljung\u2013Box.<\/p>\n<h2>Assumptions, limitations and practical tips<\/h2>\n<ul>\n<li><strong>Order and spacing matter.<\/strong> The values must be in their natural time order and equally spaced (same time step between observations). Shuffling the data destroys the autocorrelation.<\/li>\n<li><strong>Stationarity.<\/strong> The coefficients are only meaningful if the series has a roughly stable mean and variance. A trending series inflates early-lag autocorrelations; difference it first if needed.<\/li>\n<li><strong>Long lags are unreliable.<\/strong> At lag \\(k\\) only \\(n-k\\) overlapping pairs are used, so lags beyond about \\(n\/2\\) rest on very few pairs. With 12 observations, treat anything above lag 6 as noise.<\/li>\n<li><strong>Estimator choice.<\/strong> The standard estimator (divide by \\(n\\)) always yields a valid correlation function and matches ACF plots in Box\u2013Jenkins software. The unbiased version (divide by \\(n-k\\)) removes the downward bias at long lags but can theoretically push coefficients outside \\([-1, 1]\\).<\/li>\n<li><strong>The significance band is a guide.<\/strong> The \\(\\pm 1.96\/\\sqrt{n}\\) limits assume the true series is white noise. If real autocorrelation exists, the band underestimates the sampling spread at neighboring lags.<\/li>\n<li><strong>Outliers distort results.<\/strong> A single extreme observation can dominate both the mean and the products in \\(c_k\\). Check your data first, or consider robust alternatives such as <a href=\"https:\/\/wpcalc.com\/en\/statistics\/spearman-rank-correlation-calculator\/\">rank-based correlation measures<\/a>.<\/li>\n<\/ul>\n<p>If you are comparing two <em>different<\/em> series instead of a series with its own past, use a correlation tool such as the <a href=\"https:\/\/wpcalc.com\/en\/statistics\/spearman-rank-correlation-calculator\/\">Spearman rank correlation calculator<\/a> or the <a href=\"https:\/\/wpcalc.com\/en\/statistics\/kendalls-tau-calculator\/\">Kendall's tau calculator<\/a>. To summarize the overall shape of a single series before modeling it, the <a href=\"https:\/\/wpcalc.com\/en\/statistics\/skewness-and-kurtosis-calculator\/\">skewness and kurtosis calculator<\/a> is a natural companion.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Compute sample autocorrelation coefficients r_k for any time series at one or more lags. Paste your ordered observations, choose the lags and the estimator, and get r_k with a white-noise significance band.<\/p>\n","protected":false},"author":3168,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[74],"tags":[78],"class_list":["post-67001","post","type-post","status-publish","format-standard","hentry","category-statistics","tag-correlation-regression"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/67001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/users\/3168"}],"replies":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/comments?post=67001"}],"version-history":[{"count":1,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/67001\/revisions"}],"predecessor-version":[{"id":67002,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/67001\/revisions\/67002"}],"wp:attachment":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/media?parent=67001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/categories?post=67001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/tags?post=67001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}