How to check for independence of errors? How to check for independence of errors in OLS regression?
Let's say I have 10 observations for each hour. If I plot residuals ordered by time, I have the problem that adjacent residuals refer to the same day.
 A: Since you are looking at hourly observations over time, your data would often be called "time series" data. A common way to look at if the residuals are correlated is by looking at autocorrelation. That is, the correlation of the series with itself. We often look at correlations by lag, such that we look at how correlated an observation is at time $t$ with time $t + 1$.
In R, we could do something like:
cor(lh[1:(length(lh) - 1)], lh[2:length(lh)])

Which correlates all of the values of lh (except for the last data point) with the very next value of lh. So this looks at time $t$ correlated with time $t+1$ for $t = 1, 2, ..., T - 1$ where $T$ is the total number of times.
lh is a built-in time series in R. Running the above code returns 0.5807322, showing that the time series is autocorrelated. This will produce correlated residuals if it is not accounted for in the model.
I suggest looking into the area of time series analysis (I like Introductory Time Series with R by Cowpertwait and Metcalfe). What you need in particular seems to be the ACF plot, which is covered here: Interpretation of this ACF plot, and can be run in R with:
acf(lh)

And returns:

The y-axis is a correlation, and the x-axis is the lag. This shows that the data is dependent on adjacent time points (lag = 1, as shown above with the cor call), but probably not any further time points (lag = 2, 3, ...).
