Nothing
## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
## ----setup--------------------------------------------------------------------
library(ConFluxPro)
## ----load base_dat------------------------------------------------------------
data("base_dat", package = "ConFluxPro")
mod_pf <- pro_flux(base_dat)
## ----bootstrap-gasdata--------------------------------------------------------
set.seed(42) # to get exactly same result every time
mod_pf_bs_gasdata <-
bootstrap_error(mod_pf,
n_samples = 25,
sample_from = "gasdata")
## -----------------------------------------------------------------------------
## after bootstrapping
mod_pf_bs_gasdata %>%
filter(prof_id == 1) %>%
efflux()
## originial model
mod_pf %>%
filter(prof_id == 1) %>%
efflux()
## -----------------------------------------------------------------------------
mod_pf_bs_gasdata %>%
filter(prof_id == 1) %>%
production()
## -----------------------------------------------------------------------------
library(dplyr)
soilphys <- cfp_soilphys(base_dat)
set.seed(42)
soilphys_replicate_TPS <-
soilphys %>%
# get base TPS info
select(site, upper, lower, TPS) %>%
distinct() %>%
rename(TPS_mean = TPS) %>%
# repeat each row 3 times
cross_join(data.frame(replicate_id = 1:3)) %>%
# generate new, random TPS values
mutate(TPS = rnorm(n(), TPS_mean, 0.01)) %>%
# join with rest of dataset
left_join(soilphys %>% select(!TPS),
by = c("site", "upper", "lower"),
relationship = "many-to-many") %>%
# recaluclate DS and c_air
complete_soilphys(DSD0_formula = "a*AFPS^b", quiet = TRUE) %>%
cfp_soilphys(id_cols = c("site", "Date", "replicate_id"))
## -----------------------------------------------------------------------------
replicate_dat <-
cfp_dat(cfp_gasdata(base_dat),
soilphys_replicate_TPS,
cfp_layers_map(base_dat))
mod_pf_replicate <-
cfp_pfmod(replicate_dat)
## -----------------------------------------------------------------------------
set.seed(42)
mod_pf_bs_soilphys <-
bootstrap_error(mod_pf_replicate,
n_samples = 25,
sample_from = "soilphys",
rep_cols = "replicate_id")
## -----------------------------------------------------------------------------
## boostrapping from soilphys
mod_pf_bs_soilphys %>%
filter(prof_id < 10) %>%
efflux()
## boostrapping from gasdata
mod_pf_bs_gasdata %>%
filter(prof_id < 10) %>%
efflux()
## -----------------------------------------------------------------------------
set.seed(42)
mod_pf_bs_both <-
bootstrap_error(mod_pf_replicate,
n_samples = 25,
sample_from = "both",
rep_cols = "replicate_id")
mod_pf_bs_both %>%
filter(prof_id < 10) %>%
efflux()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.