You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I discovered some unexpected behaviour in interpolate_to_heights. When using a coarse grid, individuals in the the largest class are removed, where instead I expected to keep them.
It's not quite right to represent their density at the highest interpolation point, so I think we need to append the largest individual in each time step.
Here is a pared down reprex using pieces of the code from interpolate_to_heights
# helper from `interpolate_to_heights`f<-function(x, y, xout) {
y_pred<-stats::spline(x, y, xout=xout, method="natural")$yy_pred[!dplyr::between(xout, min(x), max(x))] <-NAy_pred
}
# interpolation grid - expect to include density between 3-4pts<-1:4# but nodes in large size bracket are not represented by final solutiondata<-data.frame(step=1,
species=1,
time=10,
height= c(0.1, 1.2, 2.3, 3.3),
density= c(0.1, 0.1, 0.1, 0.2))
data %>%
dplyr::group_by(species, time, step) %>%
dplyr::summarise(
dplyr::across(where(is.double), ~f(height, .x, xout=pts)),
.groups="keep")
# A tibble: 4 × 5# Groups: species, time, step [1]speciestimestepheightdensity<dbl><dbl><dbl><dbl><dbl>1110110.1022110120.09143110130.16341101NANA
The text was updated successfully, but these errors were encountered:
I discovered some unexpected behaviour in
interpolate_to_heights
. When using a coarse grid, individuals in the the largest class are removed, where instead I expected to keep them.It's not quite right to represent their density at the highest interpolation point, so I think we need to append the largest individual in each time step.
Here is a pared down reprex using pieces of the code from
interpolate_to_heights
The text was updated successfully, but these errors were encountered: