I made this linear regression that shows how well estimated animal locations (longitude) predict actual animal locations.
estimate <- c(-1.514276, -1.513683, -1.514253, -1.514207, -1.513557, -1.513634, -1.513870, -1.511210, -1.511552, -1.511772, -1.511580, -1.511802, -1.509500, -1.510037, -1.510214)
actual <- c(-1.514255, -1.514053, -1.514527, -1.514223, -1.513672, -1.513729, -1.513934, -1.511118, -1.511567, -1.511658, -1.511585, -1.511830, -1.509438, -1.509843, -1.510080)
lm_longitude <- lm(actual ~ estimate)
summary(lm_longitude)
Call:
lm(formula = actual ~ estimate)
Residuals:
Min 1Q Median 3Q Max
-2.630e-04 -3.825e-05 8.945e-06 6.530e-05 1.645e-04
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.09325 0.02706 3.445 0.00435 **
estimate 1.06167 0.01790 59.325 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.000112 on 13 degrees of freedom
Multiple R-squared: 0.9963, Adjusted R-squared: 0.996
F-statistic: 3519 on 1 and 13 DF, p-value: < 2.2e-16
As you can see, estimated locations are very good predictors for actual locations. I was initially alarmed at the residuals vs fitted values plot. It appears to shows residuals that are correlated with the fitted values:
library(ggplot2)
df_lm_longitude <- ggplot2::fortify(lm_longitude)
ggplot(df_lm_longitude, aes(.fitted, .resid)) + geom_point() + stat_smooth()
But change the scale of the y axis, and residuals vs fitted values plot looks perfect:
ggplot(df_lm_longitude, aes(.fitted, .resid)) + geom_point() + stat_smooth() + ylim(-0.01, 0.01)
So one of the assumptions of linear regression is that residuals should not be correlated with fitted values. In the model above, the residuals are correlated with the fitted values at a large scale. But zoom out to a small scale, and residuals are not correlated at all?
What resolution should I be using for y axis in residuals vs fitted values plot?