Hi Everyone, Please bear to go through this detailed problem (it is probably more statistically related), as I need your expert opinions. I am working on a project to look at the impact of climate change on agricultural yield of crops, and I was advised to detrend the yield and climate data. But the R-Squared I got from using the detrended data for regression was poor and I don't know how to continue.
Here is the original data:
tomatodf <- data.frame(data_list$Tomato)
head(tomatodf)
## Year Yield Tmax Tmin Ppt Wspd
## 1 1961 3.10 25.2 17.3 10.6 6.6
## 2 1962 3.10 25.2 17.6 11.6 6.5
## 3 1963 4.59 24.7 16.9 11.4 6.8
## 4 1964 4.21 24.5 17.2 29.4 9.7
## 5 1965 4.33 24.6 16.8 7.3 9.8
## 6 1966 4.04 24.7 17.0 30.4 8.4
I detrended using the modeling option where I regress the variables of interest using a time sequence (the years in this case), and used the residuals for the new variables data. shown below.
Detrending code for yield:
mod1 <- lm(Yield ~ Year, data = tomatodf)
mod2 <- lm(Yield ~ poly(Year, 2), data = tomatodf)
summary(mod1)
**Code for the 4 climate data variables detrending: **
mod3 <- lm(Tmax_Average ~ Year, data=tomatodf)
mod4 <- lm(Tmin_Average ~ poly(Year, 2), data = tomatodf)
mod5 <- lm(Ppt_Average ~ poly(Year, 1), data = tomatodf)
mod6 <- lm(Wspd_Average ~ Year, data = tomatodf)
summary(mod3)
This is the detrended data:
## Year Yield Temp_max Temp_min Precpt Windspeed
## 1 1961 0.9915214 0.51687840 0.40459257 -7.305324 -1.9856019
## 2 1962 0.3209267 0.48432072 0.71292214 -6.337402 -2.0711412
## 3 1963 1.1551298 -0.04823697 0.01993058 -6.569480 -1.7566805
## 4 1964 0.1341306 -0.28079466 0.32561792 11.398442 1.1577802
## 5 1965 -0.3720708 -0.21335235 -0.07001586 -10.733636 1.2722409
## 6 1966 -1.2734745 -0.14591003 0.13302926 12.334286 -0.1132983
As a new user, I can't put more than one image, so here is the summary results for the multiple linear regression:
I will appreciate your responses.
Thanks