<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aditya Mahto on Medium]]></title>
        <description><![CDATA[Stories by Aditya Mahto on Medium]]></description>
        <link>https://medium.com/@akmahto1610?source=rss-3f0636066975------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*yW-4BO57Rhl-JGUi</url>
            <title>Stories by Aditya Mahto on Medium</title>
            <link>https://medium.com/@akmahto1610?source=rss-3f0636066975------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 03:18:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akmahto1610/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Assumption Audit: Is the Model Linear ?]]></title>
            <link>https://medium.com/@akmahto1610/assumption-audit-is-the-model-linear-256668f0627e?source=rss-3f0636066975------2</link>
            <guid isPermaLink="false">https://medium.com/p/256668f0627e</guid>
            <category><![CDATA[assumptions]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Aditya Mahto]]></dc:creator>
            <pubDate>Wed, 25 Dec 2024 22:48:08 GMT</pubDate>
            <atom:updated>2024-12-25T22:48:08.105Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IOOtuUSTi5fKZ62N" /><figcaption>Photo by <a href="https://unsplash.com/@kellitungay?utm_source=medium&amp;utm_medium=referral">Kelli Tungay</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Assumption Audit: Is the Model Linear ?</h3><p>Partial plots (also known as partial regression plots or added variable plots) are a useful tool to assess the linearity of relationships between the dependent variable and individual independent variables in a multiple regression context. They help visualize the relationship of a specific independent variable with the dependent variable after accounting for the effects of other independent variables</p><h3>Check Model is Linear: Create Partial Plots</h3><p>Here’s how to create and interpret partial plots to check for linearity of variables in a regression model:</p><h4>Step 1: Fit the Full Regression Model</h4><p>Fit the full regression model using all the independent variables</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*PliB2olNTlmP0HsS" /></figure><p>where:<br> • y is the dependent variable.<br> • x₁, x₂, . . . , xₖ are the independent variables.</p><h4>Step 2: Fit the Reduced Model</h4><p>For each independent variable xⱼ you want to assess:<br> • Fit a reduced model that includes all other independent variables except xⱼ:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/0*u6zF1MacJ0_8wvhG" /></figure><h4>Step 3: Obtain Residuals</h4><ul><li>Calculate the residuals from the full model, denoted as</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/0*B0Deq_2HjUGCjIzi" /></figure><ul><li>Calculate the residuals from the reduced model, denoted as</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/219/0*dVT-F6NaDJd9eva2" /></figure><h4>Step 4: Create the Partial Plot</h4><p>Plot the residuals of the full model against the residuals of the reduced model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/0*pKgmEliCvkDhBYus" /></figure><p>This plot will help visualize the relationship between the dependent variable and the independent variable xⱼ, adjusted for the effects of the other independent variables.</p><h4>Step 5: Interpret the Partial Plot</h4><ul><li>Linear Relationship: If the partial plot shows a roughly linear pattern (points forming a straight line), it indicates that the relationship between the dependent variable and the independent variable xⱼ is linear, and the model is appropriate.</li><li>Non-linear Relationship: If the partial plot shows a clear non-linear pattern (e.g., a curve), this suggests that the relationship may be non-linear, indicating the need for a transformation of xⱼ or the inclusion of polynomial or interaction terms.</li></ul><h3>Transformation to Linear Model: Box-Cox</h3><p>The Box-Cox transformation is defined as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*WhBQ_t2eWJvuCFAm" /></figure><p>where:</p><ul><li>y is the dependent variable (target variable).</li><li>λ is a parameter that determines the nature of the transformation.<br>– For λ = 1, the transformation is linear (no change to y).<br>– For λ = 0, the transformation is logarithmic.</li></ul><h4>Steps for Using the Box-Cox Transformation in a Regression Model</h4><p><strong>Step 1: Apply Box-Cox Transformation to the Dependent Variable</strong><br>The transformation is applied to the dependent variable y to make the relationship between y and X more linear:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*WhBQ_t2eWJvuCFAm" /></figure><p><strong>Step 2: Fit the Model Using the Transformed Dependent Variable</strong><br> After applying the Box-Cox transformation to y, fit a linear regression model using the transformed target variable y(λ):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/149/0*CLVHOYnZ9r2jfXTN" /></figure><p>where X is the matrix of independent variables, β is the vector of coefficients, and ε represents the errors.</p><p><strong>Step 3: Select the Optimal Value of λ</strong><br>To select the best value of λ, use a method like maximum likelihood estimation (MLE). The goal is to find the λ that maximizes the likelihood of the transformed model.</p><p><strong>Step 4: Interpret the Model</strong><br>Once the Box-Cox transformation has been applied and the optimal λ has been selected, interpret the model results as usual, keeping in mind that the dependent variable has been transformed. If predictions or forecasts are needed on the original scale of y, you will need to reverse-transform the predictions by applying the inverse Box-Cox transformation.</p><p><strong>Step 5: Reverse Transformation for Predictions</strong><br> To get predictions back on the original scale of y, apply the inverse Box-Cox transformation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/0*tC2BAdMJ4NQd-IjJ" /></figure><p>where yˆ(λ) are the predictions from the transformed model.</p><h4>Box-Cox Transformation: Common λ Values</h4><p>Depending on the value of λ, the Box-Cox transformation can take various forms:</p><p>• λ = 1: No transformation (linear).<br> • λ = 0: Logarithmic transformation.<br> • λ = −1: Reciprocal transformation y⁻¹. <br> • λ = 0.5: Square root transformation √y.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=256668f0627e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Assumption Audit: Is Error Distribution Normal?]]></title>
            <link>https://medium.com/@akmahto1610/assumption-audit-is-error-distribution-normal-8e37d42ebb68?source=rss-3f0636066975------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e37d42ebb68</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[assumptions]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[error-handling]]></category>
            <dc:creator><![CDATA[Aditya Mahto]]></dc:creator>
            <pubDate>Tue, 24 Dec 2024 11:48:09 GMT</pubDate>
            <atom:updated>2024-12-24T11:48:09.979Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C5S6fpgipsY9AULB" /><figcaption>Photo by <a href="https://unsplash.com/@adiffor?utm_source=medium&amp;utm_medium=referral">Alex Diffor</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This is one of the major assumptions that we make in linear regression. The Bayesian statisticians use this to derive the loss function for Linear Regression. More on this in the later part of the article.</p><h3>Check if Error is Normal</h3><p>To check this, we would use the Q-Q plot. A Q-Q plot (quantile-quantile plot) is used to assess if a dataset follows a normal distribution by comparing its quantiles against those of a theoretical normal distribution; if the points lie along a straight line, the data is approximately normal.</p><p>Following are the sample Q-Q plots for different distributions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*13SSbPkuVVyddTE6P5L6ZQ.png" /><figcaption>QQ Plot for different distributions</figcaption></figure><h3>Changing Error Distribution Case</h3><p>When the error term in the multiple linear regression model follows a Laplace distribution (also known as a double exponential distribution) instead of a normal distribution, the Maximum Likelihood Estimation (MLE) leads to a different loss function. Specifically, the Laplace distribution leads to the least absolute deviations (LAD) regression, also known as <strong>L1 regression</strong>.</p><p>We assume the multiple linear regression model is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/0*mL0VzhpGDWOItL1a" /></figure><p>where:<br> • <strong>y</strong> is an <em>n × 1</em> vector of observed values.<br> • <strong>X</strong> is an <em>n × p</em> matrix of predictor variables.<br> • <strong>β</strong> is a <em>p × 1</em> vector of regression coefficients.<br> • <strong>ϵ</strong> is the <em>n × 1</em> vector of errors, now assumed to follow a <strong>Laplace distribution</strong>: ϵᵢ ∼ <strong>Laplace</strong>(0, <em>b</em>).</p><h4>Assumption of Laplace Distribution</h4><p>For the Laplace distribution, the probability density function (PDF) of each error term ϵᵢ is given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/0*I7poIKJjYowSh4dv" /></figure><p>where <em>b</em> is the scale parameter of the Laplace distribution, and |ϵᵢ| is the absolute value of the error.<br>Thus, the conditional distribution of yᵢ given xᵢ is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/0*DhBvjCzyRwC96wH8" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*pTF3NPvN9d8pafyPtEWKRw.png" /></figure><h4>Likelihood Function</h4><p>Assuming independence of errors, the likelihood function for the entire dataset y is the product of the individual densities:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/0*XWdGrMkUXweWMSDw" /></figure><p>This simplifies to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/0*QIWjquZOg3bUO5Oo" /></figure><p>In matrix form, this can be written as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/0*1_LeCdHvB-Vj3kfp" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/0*kuzX8rY_Tp_s5fIM" /></figure><h4>Log-Likelihood Function</h4><p>Taking the logarithm of the likelihood function, we get the log-likelihood:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*DiJAnLUnS047OK9T" /></figure><h4>Maximization of the Log-Likelihood</h4><p><strong>Step 1: Maximizing with respect to β</strong><br>To maximize the log-likelihood with respect to β, we focus on minimizing the second term, as the first term does not depend on β. This leads to the minimization of the L1 norm of the residuals:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/164/0*5j7P2HbFR3wb1Hyx" /></figure><p>This is the <strong>least absolute deviations (LAD)</strong> problem, also known as L1 regression. <br>Thus, the loss function for the regression model with Laplace-distributed errors is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/0*AeCd5BnxPpERB7yJ" /></figure><p>This is the objective to minimize when fitting the regression coefficients.</p><p><strong>Step 2: Maximizing with respect to <em>b</em></strong><br>To find the MLE for <em>b</em>, we differentiate the log-likelihood with respect to <em>b</em> and set it equal to zero:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/0*QBFEotSUS81EYx6C" /></figure><p>Solving for <em>b</em>, we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/182/0*HIawqBdQJfJiJBOB" /></figure><p>where βˆ is the solution to the L1 minimization problem.</p><h4>Conclusion</h4><p>• The MLE for β under the Laplace error assumption is obtained by minimizing the <strong>L1 loss function</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/0*bIok61a3qKvbcLsQ" /></figure><p>• The MLE for the scale parameter <em>b</em> is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/0*1Y7l1i-4ChvM6tS1" /></figure><p>Thus, with Laplace-distributed errors, the regression becomes <strong>L1 regression</strong> (least absolute deviations), which minimizes the sum of absolute residuals instead of the sum of squared residuals.</p><h3>Non-Parametric Solution for Non-Normal Errors: Bootstrapping</h3><p>When the assumption of normal error distribution does not hold, bootstrapping provides a robust non-parametric alternative to make inferences without relying on distributional assumptions. Bootstrapping<br>involves repeatedly resampling the data with replacement to estimate the sampling distribution of a statistic.</p><h4>Steps in Bootstrapping</h4><ol><li><strong>Resample:</strong> Randomly draw n observations with replacement from the original dataset to create a bootstrap sample.</li><li><strong>Fit Model:</strong> Fit the regression model to the bootstrap sample and compute the desired statistic (e.g.,coefficients, residuals).</li><li><strong>Repeat:</strong> Repeat the resampling and model fitting process B times (e.g.,B=1000) to obtain a distribution of the statistic.</li><li><strong>Inference:</strong> Use the bootstrap distribution to compute confidence intervals, standard errors, or hypothesis tests for the statistic.</li></ol><h4>Benefits of Bootstrapping</h4><ul><li>Does not require the error terms to follow any specific distribution.</li><li>Captures the variability inherent in the data by resampling.</li><li>Can be applied to small sample sizes or models with complex assumptions.</li></ul><h4>Application to Regression Coefficients</h4><p>For linear regression, bootstrapping can be used to estimate the confidence intervals of the regression coefficients</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/0*yFo2WRGqKWSvHMWT" /></figure><p>where y⁽ᵇ⁾ is the bootstrap sample of the response variable. The empirical distribution of βˆ⁽ᵇ⁾ is then used to calculate confidence intervals.</p><h4>Bootstrap Confidence Intervals</h4><p>Using the bootstrap replicates {βˆ⁽¹⁾, βˆ⁽²⁾, . . . , βˆ⁽ᴮ⁾ }, confidence intervals can be constructed in two ways:</p><ul><li><strong>Percentile Method:</strong> The 100(<em>1 − t</em>)% confidence interval is given by</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/160/0*PrdDxyPr8ODHEE4z" /></figure><p>where βˆ⁽ᵗ/²⁾ and βˆ⁽¹⁻ᵗ/²⁾ are the (<em>t/2)</em> and (<em>1 − t/2</em>) quantiles of the bootstrap distribution.</p><ul><li><strong>Bias-Corrected and Accelerated (BCa) Method:</strong> Adjusts for bias and skewness in the bootstrap distribution for more accurate intervals.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hoROOF1F6-Br2hhhr8j0GQ.png" /><figcaption>Example of a Bootstrap Distribution for Regression Coefficient</figcaption></figure><h4>Conclusion</h4><p>Bootstrapping is a versatile and powerful tool for addressing non-normal error distributions in regression models. By relying on data-driven resampling, it enables robust inference without restrictive parametric assumptions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e37d42ebb68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Assumption Audit: Does Homoscedasticity for Error Hold?]]></title>
            <link>https://medium.com/@akmahto1610/assumption-audit-does-homoscedasticity-for-error-hold-dd9024898743?source=rss-3f0636066975------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd9024898743</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[assumptions]]></category>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[linear-regression]]></category>
            <dc:creator><![CDATA[Aditya Mahto]]></dc:creator>
            <pubDate>Tue, 24 Dec 2024 11:48:03 GMT</pubDate>
            <atom:updated>2024-12-24T11:48:03.169Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CZ0GtzkvhfhPsYUF" /><figcaption>Photo by <a href="https://unsplash.com/@mrtnpro?utm_source=medium&amp;utm_medium=referral">Martin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Checking Heteroscedasticity</h3><p>Homoscedasticity is a statistical assumption that all errors have the same finite variance. It’s also known as homogeneity of variance.</p><p>To check this, we plot residuals versus <em>y</em>. The plot should be scattered. If it forms a pattern, then it indicates non-constant variance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RzsqD7EcTRX1owPHJToxlQ.png" /><figcaption>Two Examples for Non Constant Variance</figcaption></figure><h3>Solving Heteroscedasticity</h3><p>Let’s solve a simple case where we can ensure, through transformation, that variance is constant:</p><p>y → h(y) where h(·) is chosen such that Var(h(y)) = constant (c²)</p><p>Let E[y] = μ.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/0*mNSSqXXKT2MP3dtr" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/0*gPFwR2yz5EjjSuUQ" /></figure><p>Integrating, we get h(μ). <br>For example, if Var(ϵ) is directly proportional to μ, then h(μ) is directly proportional to √μ. Hence, the chosen function is √(·) for this specific case.</p><h3>Form of Variance is Known</h3><p>When the form of non-constant variance in the regression model is known, <strong>Weighted Least Squares (WLS)</strong> can address the issue of heteroscedasticity. WLS assigns weights to each observation based on the inverse of the variance of the errors, effectively stabilizing the variance across different levels of the independent variables.</p><h4>Steps to Implement Weighted Least Squares (WLS)</h4><p>1. <strong>Identify the Form of Non-Constant Variance:</strong><br> Suppose the variance of the errors is a function of the independent variable X or the predicted values yˆ. For example, if you suspect that Var(ϵ) = σ² · h(X), where h(X) is a known function of X.</p><p>2. <strong>Specify the Weights:</strong><br> The weights can be determined as the inverse of the estimated variance. If you have a known form for the variance (e.g., σ² · h(X)), the weights can be defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/0*E50s7WUvmPIuCP4z" /></figure><p>where wᵢ is the weight for observation i, and h(Xᵢ) is the variance function for the predictors.</p><p>3. <strong>Fit the WLS Model:</strong><br> You can fit the WLS model by minimizing the weighted sum of squared residuals:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/0*ncVvrzmrGf0_Tt_K" /></figure><p>or equivalently, the normal equation for WLS can be expressed as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/0*89n4jCR0FwyT3Chz" /></figure><p>where W is a diagonal matrix containing the weights wᵢ.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd9024898743" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Assumption Audit: Are Errors Independent?]]></title>
            <link>https://medium.com/@akmahto1610/assumption-audit-are-errors-independent-1c92f34a21ea?source=rss-3f0636066975------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c92f34a21ea</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[assumptions]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[error-handling]]></category>
            <dc:creator><![CDATA[Aditya Mahto]]></dc:creator>
            <pubDate>Tue, 24 Dec 2024 11:47:54 GMT</pubDate>
            <atom:updated>2024-12-24T11:47:54.330Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PYO4GLJ0hf7aIX8v" /><figcaption>Photo by <a href="https://unsplash.com/@luddelorentz?utm_source=medium&amp;utm_medium=referral">Ludde Lorentz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Check if Errors are Independent</h3><h4>Residual Plots vs. Time (or Sequence)</h4><ul><li><strong>What it is:</strong> If your data are time series or ordered in some way (like spatial data or longitudinal data), plotting the residuals against time (or another sequential variable) can reveal patterns.</li><li><strong>How to check:</strong><br>– <strong>Independent errors:</strong> Residuals should appear randomly scattered around zero with no discernible patterns.<br>– <strong>Dependent errors:</strong> If there’s a pattern, like trends (errors getting larger or smaller over time) or cyclic behaviour (errors follow a repeating pattern), this suggests the errors are not independent.</li></ul><p>Example: If you see consecutive positive or negative residuals, it may suggest autocorrelation, meaning the errors depend on previous errors.</p><h4>Autocorrelation Function (ACF) Plot</h4><ul><li><strong>What it is:</strong> The autocorrelation function plot measures the correlation between residuals at different time lags</li><li><strong>How to check:</strong><br>– If the autocorrelations (at different lags) are close to zero, this suggests that the residuals are independent.<br>– If the autocorrelations are significantly different from zero, this indicates that residuals are correlated with their previous values, suggesting dependence.</li></ul><h4>Durbin-Watson (DW) Test</h4><ul><li><strong>What it is</strong>: The Durbin-Watson test is a statistical test specifically designed to detect the presence of first-order autocorrelation in the residuals of a regression model.</li><li><strong>How to calculate:</strong> The DW statistic is computed as:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/0*G_e0GWnfa4Y40vW5" /></figure><p>where eₜ are the residuals at time t, and n is the number of observations.</p><ul><li><strong>How to interpret:</strong><br>– DW ≈ 2: No autocorrelation.<br>– DW &lt; 2: Evidence of positive autocorrelation. <br>– DW &gt; 2: Evidence of negative autocorrelation.</li><li><strong>Critical values:</strong> Compare the calculated DW statistic to lower (dₗ) and upper (dᵤ) critical values:<br>– DW &lt; dₗ: Positive autocorrelation.<br>– DW &gt; 4 − dₗ: Negative autocorrelation. <br>– dₗ ≤ DW ≤ dᵤ : Inconclusive.<br>– dᵤ &lt; DW &lt; 4 − dᵤ : No autocorrelation.</li></ul><p>When errors are dependent: If evidence of autocorrelation is detected using the DW test, consider alternative methods such as Generalized Least Squares (GLS) or time series models (e.g., ARIMA, ARMA).</p><h3>Correlated Errors Case</h3><p>If the errors in a regression model are normally distributed but have a covariance matrix Σ≠ σ²I (i.e., the errors are heteroscedastic or correlated), we need to apply a transformation to ”whiten” the errors, making them homoscedastic (with constant variance) and uncorrelated. This transformation will allow us to apply Ordinary Least Squares(OLS) again.</p><p>We have the model with the usual dimensions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/0*A_aVnD6XFnudBBzY" /></figure><p>where:<br>• y is the vector of observed outcomes.<br>• X is the matrix of predictor variables.<br>• β is the vector of coefficients to estimate.<br>• ϵ are the errors, which are normally distributed with covariance matrix Σ :ϵ ∼ N (0, Σ).</p><p>In ordinary least squares (OLS), we assume Σ = σ²I, which means errors are independent and homoscedastic. However, when Σ ≠σ²I, we cannot directly use OLS.</p><h4>Transformation to OLS</h4><p>To transform the model into a form suitable for applying Ordinary Least Squares (OLS), we proceed as follows:</p><p><strong>Step 1: Cholesky Decomposition of Σ</strong><br> Since Σ is a positive definite matrix, we can decompose it using Cholesky decomposition:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/97/0*hLYnIszD9L8POwfr" /></figure><p>where L is a lower triangular matrix.</p><p><strong>Step 2: Pre-multiply by L</strong>⁻¹<strong> </strong><br>To ”whiten” the errors (i.e., make them uncorrelated with constant variance), we pre-multiply both sides of the regression equation by L⁻¹:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/253/0*-7RqEj5bnEj3nrnc" /></figure><p><strong>Step 3: Simplification<br></strong>Define the following new variables for simplicity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/0*cBN69AB6fTKW_uJJ" /></figure><p>The transformed model becomes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/0*xmf6wrdADqymLtfL" /></figure><p>Since ϵ ∼ N (0, Σ), the transformed errors ϵ* satisfy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/0*q7EJ5jCJnP0vL7fB" /></figure><p>This implies ϵ* are independent and homoscedastic with covariance matrix I.</p><h4>Apply OLS on the Transformed Model</h4><p>We can now apply OLS to the transformed model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*xmf6wrdADqymLtfL" /></figure><p>The OLS estimate of β is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/0*y5_mRjccjov2IHft" /></figure><p>This is the <strong>Generalized Least Squares (GLS)</strong> estimator, which accounts for heteroscedasticity and correlation in the errors by incorporating Σ.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c92f34a21ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Assumption Audit: Choosing Data Subsets]]></title>
            <link>https://medium.com/@akmahto1610/assumption-audit-choosing-data-subsets-f2b1675d547b?source=rss-3f0636066975------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2b1675d547b</guid>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[assumptions]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Aditya Mahto]]></dc:creator>
            <pubDate>Mon, 23 Dec 2024 08:33:12 GMT</pubDate>
            <atom:updated>2024-12-23T08:33:12.177Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hh8h8qwYXvnicDx1" /><figcaption>Photo by <a href="https://unsplash.com/@on_earth_in_space?utm_source=medium&amp;utm_medium=referral">Klaus Steinberg</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>One of the common problems when we deal with a large number of features is multicollinearity. We assumed that the features are independent. If X′X is singular, then β can have multiple solutions. If X′X is close to singular, we have a multicollinearity problem, causing unstable estimation of β.</p><h3>Check if Multicollinearity Exists?</h3><p>To diagnose multicollinearity in your regression model, you can use the following methods:</p><ul><li><strong>Condition Number:</strong> The condition number of the matrix of predictors (X′X) is a diagnostic tool for multicollinearity. Large condition numbers (above 30) indicate potential multicollinearity.</li><li><strong>Variance Inflation Factor (VIF):</strong> VIF quantifies how much the variance of a regression coefficient is inflated due to multicollinearity with other predictors. A high VIF (greater than 5 or 10) suggests the presence of multicollinearity.</li><li><strong>Formula for VIF:</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/189/0*osoIYzJOgOTCPnPx" /></figure><ul><li>If VIF is high (higher than 30) for certain predictors, consider removing them individually to assess the impact on multicollinearity in the remaining model.</li></ul><h3>Resolving the Problem</h3><p>To address multicollinearity in your model, you can apply the following methods:</p><ul><li><strong>Remove or Combine Highly Correlated Predictors:</strong> If two or more predictors are highly correlated, consider removing one of them or combining them (e.g. using their mean or sum) to reduce collinearity.</li><li><strong>Principal Component Analysis (PCA):</strong> PCA reduces the dimensionality of the predictor variables by transforming them into uncorrelated principal components, which helps mitigate multicollinearity.</li><li><strong>Ridge Regression (L2 Regularization):</strong> Ridge regression adds a penalty term to the regression equation that shrinks the coefficients and reduces the impact of multicollinearity by penalizing large coefficient values. The loss function for Ridge regression is:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/0*QfUSeorwVHL68HEW" /></figure><p>where λ is the regularization parameter controlling the penalty strength.</p><ul><li><strong>Lasso Regression (L1 Regularization):</strong> Lasso regression also adds a penalty term but can shrink some coefficients to zero, effectively performing variable selection and reducing multicollinearity. The loss function for Lasso regression is:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/0*TEpuiS1enwVyZMyZ" /></figure><p>where ∥β∥₁ is the L1 norm (sum of the absolute values of the coefficients), and λ is the regularization.</p><ul><li><strong>Subset Selection Methods:</strong> Subset selection involves identifying the most relevant set of predictors to simplify the model, reduce multicollinearity, and improve predictive performance.</li></ul><h3>Why Subset Selection is Important</h3><p><strong>• Model Simplification:</strong> Reduces complexity, making the model easier to interpret. <br><strong>• Avoid Overfitting:</strong> Prevents overfitting, ensuring generalization to test data.<br><strong>• Improving Efficiency:</strong> Fewer variables improve computational efficiency.<br><strong>• Reducing Multicollinearity:</strong> Helps remove redundant predictors.</p><h3>Methods of Subset Selection</h3><h4>Forward Selection</h4><p><strong>• Steps:</strong> Start with no predictors, then add predictors iteratively to improve model performance. <br> <strong>• Advantages:</strong> Simple, less computationally intensive.<br> <strong>• Disadvantages:</strong> Can overlook combined variable effects and miss optimal models.</p><h4>Backward Elimination</h4><p><strong>• Steps:</strong> Start with all predictors, remove the least significant, and continue until significance is achieved. <br><strong>• Advantages:</strong> Potentially simpler models; starts with full interaction consideration.<br> <strong>• Disadvantages:</strong> Computationally intensive.</p><h4>Stepwise Selection</h4><p>Stepwise selection combines forward and backward methods to add predictors and reconsider existing ones iteratively.</p><h3>Information Criteria for Subset Selection</h3><p>Information criteria such as Mallows’ Cₚ, AIC, and BIC can help in selecting the optimal subset of predictors by balancing model fit and complexity. The model with the lowest value of the respective criterion is typically preferred.</p><h4>Mallows’ Cₚ</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/235/0*nEHhHqLBvGrEAymk" /></figure><p>• SSE: Sum of squared errors.<br>• <em>p</em>: Number of predictors.<br>• <em>σ²</em>: Estimated variance of residuals.</p><h4>Akaike Information Criterion (AIC)</h4><p>AIC penalizes model complexity, with lower AIC values indicating a better model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/234/0*iFmQmKxp0O1BnRi7" /></figure><p>where L is the likelihood of the model and k is the number of parameters.</p><h4>Bayesian Information Criterion (BIC)</h4><p>BIC is similar to AIC but with a stronger penalty, which favours simpler models:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/0*jrweYasMaHO_H50I" /></figure><p>where n is the number of data points.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2b1675d547b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multiple Linear Regression — A complete Guide]]></title>
            <link>https://medium.com/@akmahto1610/multiple-linear-regression-a-complete-guide-c74b2c6cb33b?source=rss-3f0636066975------2</link>
            <guid isPermaLink="false">https://medium.com/p/c74b2c6cb33b</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Aditya Mahto]]></dc:creator>
            <pubDate>Mon, 23 Dec 2024 08:32:49 GMT</pubDate>
            <atom:updated>2025-07-19T19:58:34.474Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8QXrPsYNO3sPXi9ktZwWlA.jpeg" /></figure><h3>Multiple Linear Regression — A Complete Guide</h3><h3>Introduction</h3><p>In this section, we provide a brief recap of multiple linear regression. We will use the same notation throughout the subsequent sections to ensure consistency.<br>Consider a linear model of the form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/131/0*kIh9LgBgkahe7YDH" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/0*NZ7Oollp6y46z_kh" /></figure><p>Here:<br>• Y represents the dependent variable, measured over n observations.<br>• X represents the matrix of independent variables (predictors), including a column of 1s for the intercept. There are p predictors in addition to the intercept.<br>• β is the vector of regression coefficients to be estimated.<br>• ϵ denotes the vector of error terms, one for each observation.</p><p>The dimensions of the matrices are:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/0*o6xyfQ5UDOES0it0" /></figure><p>Our goal is to find βˆ that minimises the sum of squared errors. The loss function (or residual sum of squares) is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/0*jcLB6ybwK1Qp5rF-" /></figure><p>Taking the derivative with respect to β and setting it to zero:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/0*wLQxw_vc_E4Ytrrr" /></figure><p>Solving for β, we get the <strong>ordinary least squares (OLS)</strong> estimator :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/0*oQVyk2yON_32zmKv" /></figure><p><em>(Note: (X′X)⁻¹ must exist.)</em></p><h4>Fitted Values and the Hat Matrix</h4><p>The fitted values Yˆ can be expressed as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/0*NWQ307WD2Lh_qBOD" /></figure><p>Define the hat matrix H as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/0*ijewxnwJUNTFgbix" /></figure><p>The hat matrix H is idempotent, which means: H² = H.</p><p>Similarly, (I − H) is also idempotent.</p><h4>Residuals</h4><p>The residuals are given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/0*I3wjgWNw1er27Ywg" /></figure><h4>Assumptions on the Error Terms</h4><p>We assume:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/0*xdlqwrL-aErj4IMU" /></figure><p>Thus:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/136/0*75QvJ8sD1B3YeF3e" /></figure><h4>Properties of the OLS Estimators</h4><p><strong>Unbiasedness of βˆ</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/0*NFjdnDhR9RXowhQr" /></figure><p>Thus, βˆ is unbiased. <br><strong>Variance of βˆ</strong>: Using Var(Y ) = σ²I:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/0*1DN0DHIUgv4Hgk0P" /></figure><p><strong>Expectation of Residuals:</strong></p><p>Since HX = X, it follows that (I − H)X = 0, and therefore:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/88/0*mwu3q2iTs39_R1Oj" /></figure><h4><strong>Estimating σ²:</strong></h4><p>To find an unbiased estimator of σ², start with:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/149/0*X25LtUbODCvQ7_sf" /></figure><p>Consider:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/0*ecn1QyFaY1TxpZ_W" /></figure><p>Since E[YY′] = σ²I:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/203/0*iNLdgH5HH236O1sa" /></figure><p>To compute tr(H), we use the cyclic property of the trace, which states that tr(ABC) = tr(BCA). Applying this property:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/0*FV1N4sNF-VC49E7L" /></figure><p>Since X′X is symmetric and invertible, (X′X)⁻¹X′X = Iₚ₊₁ , where Iₚ₊₁ is the (p+1) identity matrix. The trace of (I − H) gives the degrees of freedom:</p><p>Thus:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/0*l-5QJ8griU1DujDX" /></figure><p>An unbiased estimator for σ² is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/162/0*Ddmx1y8tzBn0X3GT" /></figure><p>Taking the expectation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/238/0*Ui8VddV5Vrg6Qd5r" /></figure><p>Hence, σˆ² is unbiased.</p><h4>Key Assumptions of Linear Regression</h4><ul><li><strong>No Multicollinearity:</strong> The columns of X are linearly independent.</li><li><strong>Normality of Errors:</strong> The error terms ϵ are normally distributed.</li><li><strong>Homoscedasticity:</strong> The error terms have constant variance σ².</li><li><strong>Independence of Errors:</strong> The error terms are independent of each other.</li><li><strong>Linearity:</strong> The relationship between the dependent variable and the predictors is linear.</li></ul><p>By ensuring these assumptions hold, the OLS estimator is unbiased, consistent, and has the minimum variance among all linear unbiased estimators.</p><h3>Topics to be Covered Next</h3><ul><li><a href="https://medium.com/@akmahto1610/assessing-component-significance-p-value-confidence-intervals-and-standard-errors-02b0d9703287"><strong>Assessing Component Significance: P-value, Confidence intervals, and Standard errors:</strong></a><strong> </strong>This involves evaluating the statistical significance of each predictor in the model using p-values and confidence intervals derived from their estimated coefficients. Standard errors indicate the variability of these estimates, helping assess their reliability.</li><li><a href="https://medium.com/@akmahto1610/assumption-audit-choosing-data-subsets-f2b1675d547b"><strong>Assumption Audit: Choosing Data Subsets:</strong></a> This entails selecting appropriate subsets of the data to ensure that the assumptions of the model hold true within the chosen domain. This step is particularly important in cases with heterogeneous data or influential observations.</li><li><a href="https://medium.com/@akmahto1610/assumption-audit-is-error-distribution-normal-8e37d42ebb68"><strong>Assumption Audit: Is Error Distribution Normal?</strong></a> Checking if the residuals follow a normal distribution is crucial for valid hypothesis testing. This can be evaluated using visual methods (e.g. Q-Q plots) or statistical tests.</li><li><a href="https://medium.com/@akmahto1610/assumption-audit-does-homoscedasticity-for-error-hold-dd9024898743"><strong>Assumption Audit: Does Homoscedasticity for Error Hold?</strong></a> Homoscedasticity assumes constant variance of residuals across all levels of the independent variables. This can be assessed visually using<br>residual vs. fitted value plots.</li><li><a href="https://medium.com/@akmahto1610/assumption-audit-are-errors-independent-1c92f34a21ea"><strong>Assumption Audit: Are Errors Independent?</strong></a> Residuals should not exhibit autocorrelation, meaning their values should be uncorrelated across observations. Methods like the Durbin-Watson test or plotting residuals against time can be used to check this.</li><li><a href="https://medium.com/@akmahto1610/assumption-audit-is-the-model-linear-256668f0627e"><strong>Assumption Audit: Is the model linear?</strong></a> Linearity assumes that the relationship between predictors and the dependent variable is linear. This can be evaluated through residual plots or by incorporating polynomial or interaction terms to account for nonlinear relationships.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c74b2c6cb33b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Assessing Component Significance: P-value, Confidence intervals and Standard errors]]></title>
            <link>https://medium.com/@akmahto1610/assessing-component-significance-p-value-confidence-intervals-and-standard-errors-02b0d9703287?source=rss-3f0636066975------2</link>
            <guid isPermaLink="false">https://medium.com/p/02b0d9703287</guid>
            <category><![CDATA[p-values-explained]]></category>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[linear-regression]]></category>
            <dc:creator><![CDATA[Aditya Mahto]]></dc:creator>
            <pubDate>Mon, 23 Dec 2024 08:29:13 GMT</pubDate>
            <atom:updated>2024-12-23T08:29:13.167Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8sH5QrG35d3aR_x_" /><figcaption>Photo by <a href="https://unsplash.com/@cbyoung?utm_source=medium&amp;utm_medium=referral">Clark Young</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In a regression model, when deciding whether to drop a predictor variable, you typically look at its p-value in conjunction with the corresponding t-statistic. The p-value helps you assess whether the variable has a statistically significant effect on the dependent variable. If the p-value is high (commonly above 0.05), it suggests that the variable might not be contributing significantly to the model, and you might consider dropping it.</p><p>To understand this process, let’s start with the t-distribution, the t-statistic, and how the p-value is derived.</p><h3>t-Statistic and Hypothesis Testing</h3><p>For a given predictor Xⱼ, the null hypothesis H₀ is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/118/0*6u2IIrI9x2hJz9iI" /></figure><p>This means that the coefficient βⱼ (the effect of the predictor on the response) is zero, i.e., the variable Xⱼ does not significantly contribute to explaining the variance in y. <br>The alternative hypothesis is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/118/0*CnWjaoZhAEzG3rIS" /></figure><p>The t-statistic is used to test the null hypothesis. The t-statistic for a regression coefficient βⱼ is given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/124/0*GpOn5Jb9rs4_ymFQ" /></figure><p>Where:<br> • βˆⱼ is the estimated coefficient for predictor Xⱼ ,<br> • SE(βˆⱼ ) is the standard error of βˆⱼ , which measures the variability of the estimate.</p><h3>Relationship Between t-Statistic and p-Value</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sg3AWTtUMq0Zq2HhvtE-_w.png" /></figure><p>The t-statistic follows a <strong>t-distribution</strong> with n − k − 1 degrees of freedom, where n is the number of observations and k is the number of predictors (excluding the intercept).<br>The <strong>p-value</strong> associated with the t-statistic tells you the probability of observing a value of the t-statistic as extreme as, or more extreme than, the observed value, under the assumption that the null hypothesis is<br>true.<br>The p-value is the probability of observing a t-statistic as extreme as tⱼ , given the null hypothesis is true:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/0*m32Irx4P-IrW2fb-" /></figure><ul><li>A <strong>low p-value</strong> (typically p &lt; 0.05) suggests that the null hypothesis can be rejected, implying that βⱼ is statistically significant.</li><li>A <strong>high p-value</strong> suggests that the null hypothesis cannot be rejected, implying that the variable may not be important, and thus, you might consider dropping it from the model.</li></ul><h3>Example: Dropping a Variable Based on t-Statistic and p-Value</h3><p>Consider a multiple linear regression model with three predictors: X₁, X₂, and X₃. You fit the model and obtain the following output for the coefficients, their standard errors, t-values, and p-values:</p><pre>╔═════════════╦══════════════╦════════════════╦════════════════╦══════════╗<br>║ Predictor   ║ Coefficient  ║ Standard Error ║ t-statistic tᵢ ║ p-value  ║<br>╠═════════════╬══════════════╬════════════════╬════════════════╬══════════╣<br>║ Intercept   ║ 5.0          ║ 1.2            ║ 4.17           ║ 0.001    ║<br>║ X₁          ║ 1.3          ║ 0.5            ║ 2.6            ║ 0.02     ║<br>║ X₂          ║ -0.8         ║ 0.4            ║ -2.0           ║ 0.07     ║<br>║ X₃          ║ 0.05         ║ 0.3            ║ 0.17           ║ 0.87     ║<br>╚═════════════╩══════════════╩════════════════╩════════════════╩══════════╝</pre><p>In this case:</p><ul><li><strong>X₁</strong> has a <strong>p-value of 0.02</strong>, less than 0.05, so we reject the null hypothesis at the 95% confidence level, making <strong>X₁</strong> significant and keeping it in the model.</li><li><strong>X₂ </strong>has a <strong>p-value of 0.07</strong>, above 0.05, so it is borderline. Further investigation may be needed.</li><li><strong>X₃</strong> has a <strong>p-value of 0.87</strong>, much higher than 0.05, indicating it is not significant and could be dropped.</li></ul><h3>F-Score and Overall Model Significance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0hoNwO45IbLqt5n9hm6ENg.png" /></figure><p>The <strong>F-score</strong> (or <strong>F-statistic</strong>) in the context of Ordinary Least Squares (OLS) regression is used to assess the overall significance of the regression model. It tests whether the regression model as a whole provides a better fit to the data than a model that contains no predictors (i.e., the intercept-only model).</p><h4>Hypotheses in the F-Test</h4><ul><li><strong>Null Hypothesis H₀</strong>: All regression coefficients (except the intercept) are equal to zero. In other words, none of the independent variables explain the variability in the dependent variable.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/0*D7vylzvbGz8dIRF7" /></figure><ul><li><strong>Alternative Hypothesis H₁</strong>: At least one regression coefficient is not equal to zero, meaning that at least one independent variable contributes to explaining the dependent variable.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/0*8-TPv9YIP38NNJy4" /></figure><h4>Formula for the F-Statistic</h4><p>The F-statistic compares the explained variance (sum of squares due to the regression model) to the unexplained variance (sum of squares due to residuals). The formula for the F-statistic is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/0*rbIVAdMSIA7UXvl8" /></figure><p>Where:<br>• SSR is the Sum of Squares due to Regression (explained variance by the model).<br>• SSE is the Sum of Squares due to Error (unexplained variance or residuals).<br>• k is the number of predictor variables (degrees of freedom for the regression).<br>• n is the number of observations</p><p>If the computed F-statistic is greater than the critical value from the F distribution table (for a given significance level), you reject the null hypothesis and conclude that the model is statistically significant.</p><h3>Prediction Confidence Intervals</h3><p>A prediction confidence interval provides a range within which we expect future observations to fall, given the model’s predictions. It accounts for both the uncertainty in the estimated model parameters and the inherent variability in the data.</p><p><strong>In-Sample Prediction Interval:</strong> For an in-sample prediction, the prediction interval for a given observation yᵢ is given by</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/0*VChq83bsz8Mftuxg" /></figure><p>where: <br>- yˆᵢ is the predicted value for observation i, <br>- t(α/2,n-k-1) is the critical value from the t-distribution for the given confidence level, <br>- σˆ² is the estimated variance of the errors, <br>- hᵢᵢ is the leverage of the i-th observation (i.e., the diagonal element of the hat matrix H = X(X′X)⁻¹X′).</p><p><strong>Out-of-Sample Prediction Interval:</strong> For out-of-sample predictions (i.e., for new, unseen data points), the prediction interval is adjusted to account for the additional uncertainty:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/0*8tcXrUoh-jDKgmD2" /></figure><p>where xᵢ is the vector of explanatory variables for the new observation. The additional term x′ᵢ(X′X)⁻¹xᵢ represents the uncertainty associated with the prediction for a new, unseen data point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*U9Gltlfo8U2rgADEsL_Tbg.png" /><figcaption>Regression Analysis with Fitted Curve, Confidence interval and Prediction Interval</figcaption></figure><h3>Conclusion</h3><p>In summary, assessing component significance through p-values, confidence intervals, and standard errors is crucial in regression analysis. By understanding these concepts, you can make informed decisions about which predictors to retain in your model, enhancing its predictive accuracy and interpretability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02b0d9703287" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>