I have carried out a model on some long-term data I have looking at bird arrival dates in relation to different weather conditions and have run into some problems when plotting the results. I have plotted the regression line no problem but when I try and plot the 95% confidence intervals they cross. The graph is below.

Arrival date of birds in relation to the North Atlantic Oscillation

So my questions are: Is there any mathematical reason this should happen?

Do you think it could be my code? - I am using a for loop in R with the confint function to input the corresponding values into the equation as obtained from the predicted model. My code for the confidence intervals is below:

#lwr confint 
for(i in 1:length(ndat[,1]))
   ci[3,1]*((ndat$nao[i]-0.3014286)/2.301913) +
   ci[2,1]*(ndat$ntemp[i]) +

#upr confint
for(i in 1:length(ndat[,1]))
   ci[3,2]*((ndat$nao[i]-0.3014286)/2.301913) +
   ci[2,2]*(ndat$ntemp[i]) +

Originally, the plot has an interaction term in it that's why there is also "ntemp". I didn't include it in the graph because it wasn't necessary here. ndat is a new data frame with a new set of x values.

Any help would be VERY appreciated as I am really confused.

  • $\begingroup$ See this post: stats.stackexchange.com/questions/85560/… $\endgroup$ – user89073 Jan 14 '16 at 9:47
  • $\begingroup$ Thank you that's interesting! But where the confidence intervals cross isn't at the mean... Do you think the confint function assumes a fixed mean? $\endgroup$ – Thomas Jan 14 '16 at 10:38
  • $\begingroup$ Why don't you generate random numbers for which you know exactly what you should obtain ? I do not know the function confint. I would be tempted to code it myselft. That way you know how everything works. $\endgroup$ – user89073 Jan 15 '16 at 13:48

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.