rcompanion (version 2.2.2)

cateNelson: Cate-Nelson models for bivariate data

Description

Produces critical-x and critical-y values for bivariate data according to a Cate-Nelson analysis.

Usage

cateNelson(x, y, plotit = TRUE, hollow = TRUE, xlab = "X",
  ylab = "Y", trend = "positive", clx = 1, cly = 1,
  xthreshold = 0.1, ythreshold = 0.1, progress = TRUE,
  verbose = TRUE, listout = FALSE)

Arguments

x

A vector of values for the x variable.

y

A vector of values for the y variable.

plotit

If TRUE, produces plots of the output.

hollow

If TRUE, uses hollow circles on the plot to indicate data not fitting the model.

xlab

The label for the x-axis.

ylab

The label for the y-axis.

trend

"postive" if the trend of y vs. x is generally positive. "negative" if negative.

clx

Indicates which of the listed critical x values should be chosen as the critical x value for the final model.

cly

Indicates which of the listed critical y values should be chosen as the critical y value for the final model.

xthreshold

Indicates the proportion of potential critical x values to display in the output. A value of 1 would display all of them.

ythreshold

Indicates the proportion of potential critical y values to display in the output. A value of 1 would display all of them.

progress

If TRUE, prints an indicator of progress as for loops progress.

verbose

If FALSE, suppresses printed output of tables.

listout

If TRUE, outputs a list of data frames instead of a a single data frame. This allows a data frame of critical values and associated statistics to be extracted, for example if one would want to sort by Cramer's V.

Value

A data frame of statistics from the analysis: number of observations, critical level for x, sum of squares, critical value for y, the number of observations in each of the quadrants (I, II, III, IV), the number of observations that conform with the model, the proportion of observations that conform with the model, the number of observations that do not conform to the model, the proportion of observations that do not conform to the model, a p-value for the Fisher exact test for the data divided into the groups indicated by the model, and Cramer's V for the data divided into the groups indicated by the model.

Output also includes printed lists of critical values, explanation of the values in the data frame, and plots: y vs. x; sum of squares vs. critical x value; the number of observations that do not conform to the model vs. critical y value; and y vs. x with the critical values shown as lines on the plot, and the quadrants labeled.

Details

Cate-Nelson analysis divides bivariate data into two groups. For data with a positive trend, one group has a large x value associated with a large y value, and the other group has a small x value associated with a small y value. For a negative trend, a small x is associated with a large y, and so on.

The analysis is useful for bivariate data which don't conform well to linear, curvilinear, or plateau models.

This function will fail if either of the largest two or smallest two x values are identical.

References

http://rcompanion.org/rcompanion/h_02.html

Examples

Run this code
# NOT RUN {
data(Nurseries)
cateNelson(x          = Nurseries$Size,
           y          = Nurseries$Proportion,
           plotit     = TRUE,
           hollow     = TRUE,
           xlab       = "Nursery size in hectares",
           ylab       = "Proportion of good practices adopted",
           trend      = "positive",
           clx        = 1,
           xthreshold = 0.10,
           ythreshold = 0.15)

# }

Run the code above in your browser using DataCamp Workspace