StatBean Name: Percentiles

Purpose: Calculates percentiles for a single column of numeric data.

DataSource: Any.


Read/Write Properties
NameTypeDescriptionPossible ValuesDefault Value
tablewiseExclusionbooleanWhether all rows of the data table containing a missing value in any column should be excluded from the plot.true,falsefalse
xVariableNameStringThe name of the column with data values to be plotted on the horizontal axis.Any string."X"

Other Public Methods
NameDescriptionArgumentsReturn Value
double getPercentile(double p)Returns the p-th percentile.Percentage at which percentile will be calculated.p-th percentile


Code Sample

//create a datasource bean
FileDataSource fileDataSource1 = new STATBEANS.FileDataSource();

//set the file name to be read
fileDataSource1.setFileName("c:\\statbeans\\samples\\cardata.txt");

//create a calculation bean
Percentiles percentiles1 = new STATBEANS.Percentiles();

//set the name of the data column
percentiles1.setXVariableName("mpg");

//make the calculation bean a listener
fileDataSource1.addDataChangeListener(percentiles1.listenerForDataChange);

//instruct the fileDataSource bean to read the file
fileDataSource1.readData();

//retrieve the percentiles
double p10=percentiles1.getPercentile(10.0);
double p50=percentiles1.getPercentile(50.0);
double p90=percentiles1.getPercentile(90.0);