linear_plateau {soiltestcorr} | R Documentation |
Linear-plateau response function
Description
This function helps to fit a linear-plateau model in order to estimate critical soil test values (CSTV) above which yield response becomes flat.
Usage
SS_LP(x, a, b, xs)
linear_plateau(
data = NULL,
stv,
ry,
target = NULL,
tidy = TRUE,
plot = FALSE,
resid = FALSE
)
boot_linear_plateau(data, stv, ry, n = 1000, target = NULL, ...)
Arguments
x |
selfstart arg. for explanatory variable in SSlinp Default: NULL |
a |
selfstart arg. for intercept Default: NULL |
b |
selfstart arg. for slope Default: NULL |
xs |
selfstart arg. for break/join point in SSlinp Default: NULL |
data |
Optional argument to call and object of type data.frame or data.table containing the soil test value (STV) and relative yield (RY) data, Default: NULL |
stv |
name of the vector containing soil test values (-) of type |
ry |
name of the vector containing relative yield values (%) of type |
target |
|
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 plot the linear-plateau model, Default: FALSE |
resid |
logical operator (TRUE/FALSE) to plot residuals analysis, Default: FALSE |
n |
sample size for the bootstrapping Default: 500 |
... |
when running bootstrapped samples, the |
Details
See online-documentation for additional details.
Value
returns an object of type ggplot
if plot = TRUE.
returns a residuals plot if resid = TRUE.
returns an object of class data.frame
if tidy = TRUE,
returns an object of class list
if tidy = FALSE.
SS_LP: selfStart function to pass into the linear_plateau fit
linear_plateau: function
boot_linear_plateau: bootstrapping function
Note
For extended reference, we recommend to visit: https://gradcylinder.org/post/linear-plateau/ by Austin Pearce. Self-start function code adapted from nlraa package by F. Miguez https://github.com/femiguez/nlraa
References
Anderson, R. L., and Nelson, L. A. (1975). A Family of Models Involving Intersecting Straight Lines and Concomitant Experimental Designs Useful in Evaluating Response to Fertilizer Nutrients. Biometrics, 31(2), 303–318. doi:10.2307/2529422
See Also
eval_tidy
,defusing-advanced
nlsLM
SSlinp
AIC
,lm
,optim
,coef
,predict
AICc
model-quality
nlsResiduals
bind
ggplot
,aes
,geom_rug
,geom_point
,geom_abline
,geom_path
,annotate
,labs
,theme
annotate
Examples
# Example 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_lp <- linear_plateau(data = dat,
ry = ry, stv = stv, resid = TRUE, plot = FALSE)
fit_example_lp