A function to calculate the bin midpoints.

Description

This function returns the bin midpoints for use in calculating midpoint-based statistics. The code is not written to handle left censored bins or more than one right censored bins.

Usage

1
getMids(ID, hb, lb, ub, alpha_bound)

Arguments

ID

A vector of group IDs

hb

A vector of heights for each bin

lb

A vector of lower bounds, which must all be real numbers.

ub

A vector of upper bouns, which can have one censored bin per group.

alpha_bound

A numeric value indicating the bound on alpha for determining the midpoint of the upper-most, censored bin. To unbound the value of alpha, set alpha_bound = numeric(0).

Details

For all non-censored bins, ie real number upper and lower bounds, the midpoint is simply the arithemtic mean of the bounds. This assumes the number of observations are normally distributed in each bin. However, for the right-censored bin we relax this assumption when calcuting the bin midpoint. FIXME - say something about the method we use to calculate midpoint of the upper bin.

Value

returns a list with the following elements:

References

FIXME - references

Examples

1
2
3
4
5
6
7
8
9
data(state_bins)

bin_mids <- getMids(ID = state_bins[,'State'], hb = 
state_bins[,'hb'], lb = state_bins[,'bin_min'], ub = 
state_bins[,'bin_max'], alpha_bound = 10/9)

bin_mids_unbound <- getMids(ID = state_bins[,'State'], hb = 
state_bins[,'hb'], lb = state_bins[,'bin_min'], ub = 
state_bins[,'bin_max'], alpha_bound = numeric(0))