This function runs the modified arcsine-log calibration curve to estimate critical soil test values (CSTV) following Correndo et al. (2017)
Usage
mod_alcc(
data = NULL,
ry,
stv,
target,
confidence = 0.95,
tidy = TRUE,
plot = FALSE
)
logLik_alcc(object, ...)
boot_mod_alcc(data, ry, stv, n = 500, target = 90, confidence = 0.95, ...)
Arguments
- data
Optional argument to call and object of type data.frame or data.table containing the stv and ry data, Default: NULL
- ry
name of the vector containing relative yield values (%) of type
numeric
.- stv
name of the vector containing soil test values of type
numeric
.- target
numeric
value of relative yield target (e.g. 90 for 90%) to estimate the CSTV.- confidence
numeric
value of confidence level (e.g. 0.95 for significance = 0.05)- tidy
logical operator (TRUE/FALSE) to decide the type of return. TRUE returns a tidy data frame or tibble (default), FALSE returns a list.
- plot
logical operator (TRUE/FALSE) to decide the type of return. TRUE returns a ggplot, FALSE returns either a list (tidy == FALSE) or a data.frame (tidy == TRUE).
- object
the "object" is the output data frame from approx with resid column
- ...
when running bootstrapped samples, the
...
(open arguments) allows to add grouping variable/s (factor or character) Default: NULL- n
sample size for the bootstrapping Default: 500
Value
returns an object of type ggplot
if plot = TRUE.
returns an object of class data.frame
if tidy = TRUE,
returns an object of class list
if tidy = FALSE.
logLik_alcc: AIC on original scale function
boot_mod_alcc: bootstrapping function
Details
See online-documentation for additional details.
Note
For extended reference, we recommend to visit doi:10.7910/DVN/NABA57 and https://github.com/adriancorrendo/modified-ALCC by Adrian Correndo.
References
Correndo et al. (2017). A modification of the arcsine–log calibration curve for analysing soil test value–relative yield relationships. Crop and Pasture Science, 68(3), 297-304. doi:10.1071/CP16444
Examples
# \donttest{
# Example 1 dataset
dat <- data.frame("ry" = c(65,80,85,88,90,94,93,96,97,95,98,100,99,99,100),
"stv" = c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15))
# Run
fit_example <- mod_alcc(data = dat, ry = ry, stv = stv, target=90, confidence = 0.95)
#> Warning: 7 STV points exceeded two-times (2x)
#> the CSTV for 90% of RY. Risk of leverage. You may consider a sensitivity analysis by
#> removing extreme points, re-run the mod_alcc(), and check results.
fit_example
#> # A tibble: 1 × 18
#> n r RMSE_alcc AIC_alcc AIC_sma BIC_sma p_value confidence target CSTV
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 15 0.968 1.45 59.6 -23.5 -20.0 3.30e-9 0.95 90 4.48
#> # ℹ 8 more variables: LL <dbl>, UL <dbl>, CSTV90 <dbl>, n.90x2 <int>,
#> # CSTV100 <dbl>, n.100 <int>, Curve <list>, SMA <list>
# }