Strange pattern in residual plot from mixed effect model

I've run a mixed effect model in R by using lme. The explanatory (Temp_Diff & Distance) and responsive (LF_Diff) factors are continued variables.

VARIABLE = MEAN(STD)

Temp_Diff = 0.31(0.8)

Distance = 141(115)

LF_Diff = -3.62(9.02)


Normally, residuals should be plotted against fitted values to identify violation of homogeneity. However, I got a residual plot with an obvious pattern. I can't show the picture because I am new, but the pattern shows a linear line increaed from minus to positive values. that I couldn't figure out what the causes are. I tried to drop some outlier points, but the pattern is still there. Does anyone have any experiences about that?

# ---The Code---------------------------------------
attach(ashlf);names(ashlf);
ashlf.lme <- lme(LF_Diff~Temp_Diff+Distance, random=~1|Site/Year, data=ashlf, method="ML");
summary(ashlf.lme);
stepAIC(ashlf.lme);
plot(ashlf.lme);

##---The output of summary(ashlf)-------------------
AIC     BIC    logLik
275.8956 285.877 -131.9478

Random effects:
Formula: ~1 | Site
(Intercept)
StdDev:    1.098288

Formula: ~1 | Year %in% Site
(Intercept) Residual
StdDev:    6.905381 1.401097

Fixed effects: LF_Diff ~ Temp_Diff + Distance
Value Std.Error DF   t-value p-value
(Intercept)  3.607701 2.0825324 18  1.732363  0.1003
Temp_Diff   -4.273440 1.6115431 18 -2.651769  0.0162
Distance    -0.041130 0.0111402 18 -3.692059  0.0017  migrated from stackoverflow.comNov 14 '12 at 12:18

This question came from our site for professional and enthusiast programmers.

• I have found that the problem is caused by the random effect. If I change "the random intercept model (random=~1|Site/Year) to "the random intercept and slope model (random=~1+Site|Year)", the residual plot becomes better, like the second figure I posted! Currently, I have no idea what the mathematical theory is hidden inside it. – CWT Nov 14 '12 at 15:12
• A standard remedy for residual drift like this in linear models, both fixed and mixed, is to put an additional variable into the model. You can even figure out which variable by plotting the residuals versus candidate variables instead of fitted values, and if the drift is not linear, that's a clue for what transformation of the new variable to use. – f1r3br4nd Mar 15 '13 at 8:02