Skip to contents

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

Usage

cate_nelson_1971(data = NULL, stv, ry, tidy = FALSE, plot = FALSE)

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

tidy

logical operator (TRUE/FALSE) to decide the type of return. TRUE returns a data.frame, FALSE returns a list (default).

plot

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

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.

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 (1971). A simple statistical procedure for partitioning soil test correlation data into two classes. Soil Sci. Soc. Am. Proc. 35:658-660. doi:10.2136/sssaj1971.03615995003500040048x

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_1971 <- cate_nelson_1971(data = dat, 
 ry = ry, stv = stv, tidy=FALSE, plot=FALSE)
#> Warning: Chi-squared approximation may be incorrect
 
 fit_example_cn_1971
#> $n
#> [1] 15
#> 
#> $CRYV
#> [1] 86.5
#> 
#> $CSTV
#> [1] 3.5
#> 
#> $quadrants
#>   q.I q.II q.III q.IV positive negative
#> 1   0   12     0    3       15        0
#> 
#> $X2
#> 
#> 	Pearson's Chi-squared test with Yates' continuity correction
#> 
#> data:  data.frame(row.1, row.2)
#> X-squared = 9.401, df = 1, p-value = 0.002169
#> 
#> 
#> $anova
#> Analysis of Variance Table
#> 
#> Response: y
#>           Df Sum Sq Mean Sq F value    Pr(>F)    
#> xgroup     1 874.02  874.02  29.519 0.0001145 ***
#> Residuals 13 384.92   29.61                      
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> $R2
#> [1] 0.6942517
#> 
# }