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

Implement NCV #30

Open Aariq opened 2 months ago

Aariq commented 2 months ago

A follow up on comments in #25.

So far NCV (as opposed to REML) seems like it is going to be the way to go. A lot needs to be done to make it work still though, and it's possibly not worth it (or it goes in a separate paper).

Aariq commented 1 month ago

Possibly helpful: Moran's I for estimating spatial autocorrelation of residuals. E.g.

years <- 1981:2023
walk(years, \(.x) {
  gdd_df |>
    mutate(.resid = residuals(m_reml)) |>
    filter(year == .x) |>
    select(x, y, .resid) |>
    rast() |>
    autocor(global = FALSE) |>
    plot(main = paste("Moran's I for", .x))
})

Or just get a single number with ... |> rast() |> autocor(global = TRUE). This could be useful for comparing REML and NCV to check that it actually helps with spatial autocorrelation. Residuals should show no autocorrelation.