This function carries out the bayesian modeling process with spatial cross-validation as described in Allen and Kim (2020). Given a focal-competitor data frame, it appends a column with predicted growth values.
run_cv( focal_vs_comp, comp_dist, blocks, prior_param = NULL, run_shuffle = FALSE )
focal_vs_comp | data frame from |
---|---|
comp_dist | Distance to determine which neighboring trees to a focal tree are competitors. |
blocks | An sf object of a |
prior_param | A list of |
run_shuffle | boolean as to whether to run permutation test shuffle of competitor tree species within a particular focal_ID |
focal_vs_comp
with new column of predicted growth_hat
Other modeling functions:
comp_bayes_lm()
,
create_bayes_lm_data()
,
predict.comp_bayes_lm()
run_cv( focal_vs_comp_ex, comp_dist = 1, blocks = blocks_ex )#> # A tibble: 6 × 8 #> focal_ID focal_sp dbh foldID geometry growth comp #> <dbl> <fct> <dbl> <fct> <POINT> <dbl> <list> #> 1 2 american_beech 20 1 (1.5 2.5) 0.800 <tibble [2 × 4]> #> 2 3 sugar_maple 15 1 (1.75 2.25) 1.00 <tibble [1 × 4]> #> 3 4 american_beech 12 1 (3 1.5) 0.400 <tibble [1 × 4]> #> 4 5 sugar_maple 35 1 (3.25 1.75) 1.40 <tibble [1 × 4]> #> 5 7 sugar_maple 22 2 (8 1.5) 0.600 <tibble [3 × 4]> #> 6 9 sugar_maple 42 2 (8.75 1.5) 1.40 <tibble [3 × 4]> #> # … with 1 more variable: growth_hat <dbl>