0
$\begingroup$

I am interested in determining the effect of climate shocks on nutrition outcomes. I am modeling nutrition outcomes in terms of several explanatory variables, including climate. I would like to determine which individual's nutrition outcome was most affected by the climate variable, after accounting for the effects of all other variables.

The best approach I can think of for this would be to run two models, one including every explanatory variable besides climate (such as birth weight, diet, etc), and one with all of those variables but also including climate. Then, the differencing the residuals between the two models would show which observations climate has the greatest impact on.

To test whether this is a good approach, I have run some R code to simulate this sort of situation:

b0 <- -3
b1 <- 3
b2 <- -3
b3 <- 3

x0 <- rnorm(100, 0, 1)
x1 <- rnorm(100, 0, 1)
x2 <- rnorm(100, 0, 1)
x3 <- rnorm(100, 0, 1)

#Variable x3 only affects y for the first 5 observations
x3[6:100] <- 0

y <- x0*b0 + x1*b1 + x2*b2 + x3*b3 + rnorm(100, 0, 3)

mod1 <- lm(y~x0 + x1 + x2)
mod2 <- lm(y~x0 + x1 + x2 + x3)

diff <- mod2$residuals - mod1$residuals
tail(names(diff)[order(diff)])

After differencing the residuals, the first five observations always among the largest, but there are also observations with a large difference in residuals where x3 had no effect. Have I taken the correct approach here? Would there be a better way to estimate the impact of a particular explanatory variable on each observation? Additionally, when running the model with actual data, it will likely be a mixed-effects model, not a simple linear model like I have simulated.

$\endgroup$
0
$\begingroup$

It's not real clear why you'd want to do such an analysis, but your approach does seem to accomplish that. Essentially, you are determining whether and to what extent a particular y_pred differs from y with a 2-parameter vs 3-parameter model. But, note that it is difficult to assign any meaning to this difference. If a particular point's residual is smaller with 3 parameters than 2, it does not mean that there is something special about the relationship between the 3rd predictor and that point - it is a function of the overall fit, and thus the rest of the data. You might consider turning to influence/leverage analysis if you are interested in how much particular points sway the fit.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.