Skip to contents

This function runs the quadrants analysis suggested by Cate and Nelson (1965)

Usage

cate_nelson_1965(data = NULL, stv, ry, target, tidy = TRUE, plot = FALSE)

boot_cn_1965(data, ry, stv, target = 90, n = 5, ...)

Arguments

data

argument to call a data.frame or data.table containing the data

stv

argument to call the vector or column containing the soil test value (stv) data

ry

argument to call the vector or column containing the relative yield (ry) data

target

argument to specify the ry target (numeric) to estimate the critical stv for

tidy

logical operator (TRUE/FALSE) to decide the type of return. TRUE returns a tibble, FALSE returns a list. Default: TRUE.

plot

logical operator (TRUE/FALSE) to decide the type of return. TRUE returns a ggplot, FALSE returns either a list (tidy == FALSE) or a tibble (tidy == TRUE).

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 an object of class data.frame if tidy = TRUE,

returns an object of class list if tidy = FALSE.

boot_cn_1965: bootstrapping function

Details

See online-documentation for additional details.

Note

This code was adapted from Mangiafico, S. S. (2013). Cate-Nelson Analysis for Bivariate Data Using R-project. The Journal of Extension, 51(5), Article 33. https://tigerprints.clemson.edu/joe/vol51/iss5/33/

References

Cate & Nelson (1965). A rapid method for correlation of soil test analysis with plant response data. North Carolina Agric. Exp. Stn., International soil Testing Series l. No. 1.

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_cn_1965 <- cate_nelson_1965(data = dat, 
 ry = ry, stv = stv, target = 90, tidy=FALSE, plot=FALSE)
#> Warning: Chi-squared approximation may be incorrect
 
 fit_example_cn_1965
#> $n
#> [1] 15
#> 
#> $CRYV
#> [1] 90
#> 
#> $CSTV
#> [1] 4.5
#> 
#> $R2
#> [1] 0.6697782
#> 
#> $AIC
#> [1] 98.39784
#> 
#> $BIC
#> [1] 100.522
#> 
#> $RMSE
#> [1] 5.264518
#> 
#> $quadrants
#>   q.I q.II q.III q.IV positive negative
#> 1   0   11     0    4       15        0
#> 
#> $X2
#> 
#> 	Pearson's Chi-squared test with Yates' continuity correction
#> 
#> data:  data.frame(row.1, row.2)
#> X-squared = 10.322, df = 1, p-value = 0.001314
#> 
#> 
#> $anova
#> Analysis of Variance Table
#> 
#> Response: y
#>           Df Sum Sq Mean Sq F value    Pr(>F)    
#> xgroup     1 843.21  843.21  26.367 0.0001917 ***
#> Residuals 13 415.73   31.98                      
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
# }