calc_bin_prob: Calculate bin probabilities for a univariate ordinal dataset

Description Usage Arguments Value

View source: R/univariate_models.R

Description

x is the independent variable and v is the response variable for univariate ordinal data. Bin the data by x, and calculate the proportion of observations falling into each ordinal category for each bin.

The input bin_bounds is optional. If it is not provided, 20 evenly spaced bins on the interval min(x) to max(x) are used.

The output is a list containing three variables:

bin_centers – The x-values of the bin centers bin_counts – A matrix with dimenesions num_bins by num_cat giving the counts of the ordinal variable (v) for each bin and category bin_prop – A matrix with dimenesions num_bins by num_cat giving the probabilities of the ordinal variable (v) for each bin and category (a normalized version of bin_counts)

Usage

1
calc_bin_prob(x, v, bin_bounds = NA)

Arguments

x

The vector of independent variables

v

The vector of responses (m-values)

bin_bounds

(Optional) The bounds to use for binning. If not given, 20 evenly spaced bins on the interval min(x) to max(x) are used.

Value

A list with the bin centers, bin counts, and bin proportions


MichaelHoltonPrice/yada documentation built on Sept. 19, 2021, 11:27 p.m.