quadratic_plateau {soiltestcorr} | R Documentation |
Quadratic-plateau response function
Description
This function helps to fit a quadratic-plateau response model and to estimate a critical soil test values (CSTV) above which yield response becomes flat.
Usage
SS_QP(x, a, b, xs)
quadratic_plateau(
data = NULL,
stv,
ry,
target = NULL,
tidy = TRUE,
plot = FALSE,
resid = FALSE
)
boot_quadratic_plateau(data, stv, ry, n = 1000, target = NULL, ...)
Arguments
x |
selfstart arg. for explanatory variable in SSquadp3xs Default: NULL |
a |
selfstart arg. for intercept Default: NULL |
b |
selfstart arg. for slope Default: NULL |
xs |
selfstart arg. for break/join point in SSquadp3xs Default: NULL |
data |
Optional argument to call and object of type data.frame or data.table containing the stv and 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 quadratic-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_QP: selfStart function to pass into the quadratic_plateau fit
quadratic_plateau: function
boot_quadratic_plateau: bootstrapping function
Note
For extended reference, we recommend to visit https://gradcylinder.org/post/quad-plateau/ by Austin Pearce. Self-start function code adapted from nlraa package by F. Miguez https://github.com/femiguez/nlraa
References
Bullock, D.G. and Bullock, D.S. (1994) Quadratic and Quadratic-Plus-Plateau Models for Predicting Optimal Nitrogen Rate of Corn: A Comparison. Agron. J., 86: 191-195. doi:10.2134/agronj1994.00021962008600010033x
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
df <- 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_qp <- quadratic_plateau(data = df,
stv = stv, ry = ry, resid = TRUE, plot = FALSE)
fit_example_qp