ASA Connect

 View Only

Remove impact of an independent variable

  • 1.  Remove impact of an independent variable

    Posted 09-14-2023 16:43

    I want to remove impact of an independent variable (x1) in a multi variable liner regression model that has two independent variables x1 and x2. Would the following approach be correct to do that?

    1. Do regression between dependent variable y and independent variable x2
    2. Get residuals from model in step 1
    3. Do regression between residual as dependent variable and x1 as independent variable
    4. Run predict on model in step 3
    5. Subtract predictions in step 3 from y to get adjusted_y

    I am doing this in R



    ------------------------------
    Parag Kulkarni
    ------------------------------