Skip to contents

This function helps to fit a Mitscherlich-style exponential response model for relative yield (ry) as a function of soil test values (stv).

Usage

mits_formula_1(x, a, b, c)

mits_formula_2(x, b, c)

mits_formula_3(x, c)

mitscherlich(
  data = NULL,
  stv,
  ry,
  type = 1,
  target = 95,
  tidy = TRUE,
  plot = FALSE,
  resid = FALSE
)

boot_mitscherlich(data, stv, ry, type = 1, n = 999, target = 95, ...)

Arguments

x

selfstart vector. for model fit Default: NULL

a

selfstart arg. for asymptote parameter, Default: NULL

b

selfstart arg. for b parameter (b = -X_intercept) Default: NULL

c

selfstart arg. for curvature parameter 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.

type

string or number that indicates the type of Mitscherlich model to fit. Default: 1. For model with 'no restrictions' use type = 1, type = "no restriction", or type = "free"; For model with 'asymptote = 100' use type = 2, type = "asymptote 100", or type = "100"; For model with 'asymptote = 100 and xintercept = 0'" type = 3, type = "asymptote 100 from 0", or type = "fixed".

target

numeric value of relative yield target (e.g. 90 for 90%) to estimate the CSTV. Default: NULL

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

Mitscherlich type 1 formula

Mitscherlich type 2 formula

Mitscherlich type 3 formula

mitscherlich: function

boot_mitscherlich: bootstrapping function

Details

See online-documentation for additional details.

Note

For extended reference, we recommend to visit: https://github.com/austinwpearce/SoilTestCocaCola by Austin Pearce.

References

Melsted, S.W. and Peck, T.R. (1977). The Mitscherlich-Bray Growth Function. In Soil Testing (eds T. Peck, J. Cope and D. Whitney). doi:10.2134/asaspecpub29.c1

Examples

# \donttest{
 # 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_mits <- mitscherlich(data = dat, type = 1, 
 ry = ry, stv = stv, resid = TRUE, plot = FALSE)

 
 fit_example_mits
#> # A tibble: 1 × 13
#>   asymptote     b curvature equation  y_intercept target  CSTV   AIC  AICc   BIC
#>       <dbl> <dbl>     <dbl> <chr>           <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1      98.7  2.07     0.371 98.7(1-e…        52.8     95  6.77  64.0  68.0  66.8
#> # ℹ 3 more variables: R2 <dbl>, RMSE <dbl>, pvalue <dbl>
# }