dataFrame.columns.stat — confidenceIntervalWilson()
Description
The confidenceIntervalWilson() method of the stat object computes the Wilson confidence interval for the proportion represented by the selected binary columns.
Signature
dataFrame.columns(...columnNames).stat.confidenceIntervalWilson()Argument
...columnNames( string[] )- The name of the columns from which to compute the Wilson confidence interval
Returns
stat(object)- A statistic object containing the Wilson confidence interval and related statistics.
estimate(number)- The estimated proportion.
ci(object)- The confidence interval bounds.
lower(number)- The lower confidence interval bound.
upper(number)- The upper confidence interval bound.
margin(object)- The distance between the estimate and the confidence interval bounds.
lower(number)- The distance between the estimate and the lower bound.
mean(number)- The mean of the lower and upper margins.
upper(number)- The distance between the estimate and the upper bound.
Notes
- The method is intended for binary data.
- The method applies the Wilson score interval for estimating a binomial proportion.
- Wilson intervals generally provide better coverage than the normal approximation, especially for small samples or proportions near
0or1. - The confidence interval may be asymmetric around the estimate.
margin.meanis calculated as the average ofmargin.lowerandmargin.upper.- Negative values indicate that the second selected column has a larger mean than the first selected column.
Example
// calculate the confidence interval for 2 columns of the dataFrame
var stat = dataFrame.columns('groupA', 'groupB').stat.confidenceIntervalWilson();
// log the stat details
notebook.log(stat);