usa-npn / cales-thermal-calendars

Estimating trends in phenology in the northeastern US
https://usa-npn.github.io/cales-thermal-calendars/spatial-trends-report.html
MIT License
0 stars 0 forks source link

Fit GAMs to describe spatial and temporal trends in DOY taken to reach a GDD threshold #26

Closed Aariq closed 1 month ago

Aariq commented 4 months ago

First off, this is a lot of commits because I've been using GitHub to move code back and forth from my local computer to the HPC—I will squash these when merging this PR likely.

This PR is too big, so that's why I'm going to merge it soon even though it's not quite finished.

In it, I've experimented with different resolutions of data and different values for k provided to the spatial term of a GAM using ti() smoothers (ANOVA style tensor product terms). The basic model is:

DOY ~ 
      ti(x, y, bs = "cr", d = 2, k = k_spatial) +
      ti(year_scaled, bs = "cr", k = 20) +
      ti(x, y, year_scaled, d = c(2,1), bs = c("cr", "cr"), k = c(100, 20))

where k_spatial is varied in _targets.R using tar_map().

I then take those models and calculate average slopes at a 50km resolution. The results are qualitatively similar—positive trend in the north, negative trend in the south.

After merging this, I will open another PR that cleans up a lot of the "experimental" bits and focuses on producing some preliminary plots for Theresa to give her collaborators.