Skip to contents

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 numeric.

ry

name of the vector containing relative yield values (%) of type numeric.

target

numeric value of relative yield target (e.g. 90 for 90%) to estimate the CSTV. The target needs to be < plateau, otherwise, target = plateau.

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 ... (open arguments) allows to add grouping variable/s (factor or character) Default: NULL

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

Details

See online-documentation for additional details.

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

Examples

# \donttest{
# 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
#> # A tibble: 1 × 17
#>   intercept slope quadratic equation       plateau  CSTV lowerCL upperCL CI_type
#>       <dbl> <dbl>     <dbl> <chr>            <dbl> <dbl>   <dbl>   <dbl> <chr>  
#> 1      61.0  8.59    -0.502 61 + 8.59x + …    97.7  8.56     6.6    10.5 Wald C…
#> # ℹ 8 more variables: target <dbl>, STVt <dbl>, AIC <dbl>, AICc <dbl>,
#> #   BIC <dbl>, R2 <dbl>, RMSE <dbl>, pvalue <dbl>
# }