run_cv {forestecology}R Documentation

Run the bayesian model with spatial cross validation

Description

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.

Usage

run_cv(
  focal_vs_comp,
  comp_dist,
  blocks,
  prior_param = NULL,
  run_shuffle = FALSE
)

Arguments

focal_vs_comp

data frame from create_focal_vs_comp()

comp_dist

Distance to determine which neighboring trees to a focal tree are competitors.

blocks

An sf object of a blockCV block output

prior_param

A list of ⁠{a_0, b_0, mu_0, V_0}⁠ prior hyperparameters. Defaults to a_0 = 250, b_0 = 250, mu_0 a vector of zeros of length p + 1, V_0 an identity matrix of dimension (p + 1) x (p + 1)

run_shuffle

boolean as to whether to run permutation test shuffle of competitor tree species within a particular focal_ID

Value

focal_vs_comp with new column of predicted growth_hat

See Also

Other modeling functions: comp_bayes_lm(), create_bayes_lm_data(), predict.comp_bayes_lm()

Examples


run_cv(
  focal_vs_comp_ex,
  comp_dist = 1,
  blocks = blocks_ex
)

[Package forestecology version 0.2.0 Index]